# Smart Vault CLI

Leth is the Command Line Interface tool for interacting with a Lightstreams node and Smart Vault. Leth also exposes a HTTP API for accessing these same commands from a client.

## leth

The Leth tool run at the command line.

```
leth [flags]
```

**Options**

```
  -h, --help   help for leth
```

## acl

Features Leth Access Control List (ACL) capabilities such as granting file permissions.

```
leth acl [flags]
```

**Options**

```
  -h, --help   help for acl
```

## acl grant

Grant an ACL permission to another account.

Usage:

```
leth acl grant --nodeid=1 --network=rinkeby --permission=read --acl=0xd966aa573f8AcBfEb3724B661B420c258ceA5D38 --owner=0xadC486F16F003897fb927e22438cb1b820f79879 --to=0xadc486f16f003897fb927e22438cb1b820f79879
```

Possible Outputs:

```
{"is/granted":"true"}
{"error": {"code": "SOME/INTERNAL/ERROR/CODE", "message": "explanatory error message"}}
```

```
leth acl grant [flags]
```

**Options**

```
      --acl string          ACL ID (Deployed Smart Contract Hex Addr) associated with the stored file.
  -h, --help                help for grant
      --network string      Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int          ID of the node in order to support multiple nodes on the same machine. 0 by default.
      --owner string        The account with rights to grant the ACL permission.
      --permission string   Permission to grant. Possible values: [noaccess,read,write,admin]
      --to string           Account address to whom the permission should be granted.
```

## acl grant-public

Grant a read access to everybody.

Usage:

```
leth acl grant-public --nodeid=1 --network=rinkeby --acl=0xd966aa573f8AcBfEb3724B661B420c258ceA5D38 --owner=0xadC486F16F003897fb927e22438cb1b820f79879
```

Possible Outputs:

```
{"is/granted":"true"}
{"error": {"code": "SOME/INTERNAL/ERROR/CODE", "message": "explanatory error message"}}
```

```
leth acl grant-public [flags]
```

**Options**

```
      --acl string       ACL ID (Deployed Smart Contract Hex Addr) associated with the stored file.
  -h, --help             help for grant-public
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
      --owner string     The account with rights to grant the ACL permission.
```

## acl revoke-public

Revoke a public read access from everybody.

Usage:

```
leth acl revoke-public --nodeid=1 --network=rinkeby --acl=0xd966aa573f8AcBfEb3724B661B420c258ceA5D38 --owner=0xadC486F16F003897fb927e22438cb1b820f79879
```

Possible Outputs:

```
{"is/revoked":"true"}
{"error": {"code": "SOME/INTERNAL/ERROR/CODE", "message": "explanatory error message"}}
```

```
leth acl revoke-public [flags]
```

**Options**

```
      --acl string       ACL ID (Deployed Smart Contract Hex Addr) associated with the stored file.
  -h, --help             help for revoke-public
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
      --owner string     The account with rights to grant the ACL permission.
```

## auth

Verifies that an authentication token is valid.

Usage:

```
leth auth --nodeid=1 --network=rinkeby --peer=QmW6hffkDWCYK988j1oyAi26F6HEkHDvQ7qKKxoSNJwmyS --token=eyJibG9ja2NoYWluIjoiRVRIIiwiZXRoX2FkZHJlc3MiOiIweEM5NjZhYTU3MzA4QWNCZkViMzcyNkI2NjFCQzIwYzI1OGNlQTVEMzgiLCJpYXQiOjI3NzExNDUsImVhdCI6Mjc3MTIwNX0.2Z2Qm8MSVaTTVZRbtIjuKjjQXYFuprmmo5Okat85RiIkEwIFQObaimFkCieonHG6dyFqKx6h-hFdGeV8DbtEbAE
```

Possible Outputs:

```
{"is/authenticated":"true","user":"0xC966aa57308AcBfEb3726B661BC20c258ceA5D38"}
{"error": {"code": "SOME/INTERNAL/ERROR/CODE", "message": "explanatory error message"}}
```

```
leth auth [flags]
```

**Options**

```
  -h, --help             help for auth
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
      --token string     Token to authenticate.
      --peer string      PeerID who generated this token.
```

## docs

Generates LETH / usage docs based on code into the: 'docs/cmd/auto/generated'.

```
leth docs [flags]
```

**Options**

```
  -h, --help   help for docs
```

## init

Initializes new Lightstreams node for connecting to the chosen network.

```
leth init [flags]
```

**Options**

```
      --force            Force node data initialization, erase previous folder in case this exists. False by default.
  -h, --help             help for init
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
```

## run

Runs full Leth node by spawning blockchain and IPFS daemons.

```
leth run [flags]
```

**Options**

```
  -h, --help             help for run
      --https            Serves an HTTPs server on your localhost. False by default.
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
```

## shop

Features capabilities for selling/buying digital content.

```
leth shop [flags]
```

**Options**

```
  -h, --help   help for shop
```

## shop buy

Allows an account to purchase permission to access a copy of the digital content from a seller.

Usage:

```
leth shop buy --nodeid=1 --network=rinkeby --shop=0xshopIDF16F003897fb927e22438cb1b820f79879 --acl=0xd966aa573f8AcBfEb3724B661B420c258ceA5D38 --from=0xadC486F16F003897fb927e22438cb1b820f79879
```

Possible Outputs:

```
{"success":"true"}
{"error": {"code": "SOME/INTERNAL/ERROR/CODE", "message": "explanatory error message"}}
```

```
leth shop buy [flags]
```

**Options**

```
      --acl string       ACL ID to buy.
      --from string      The account buying the ACL permission.
  -h, --help             help for buy
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
      --shop string      Shop ID where ACL can be bought.
```

## shop create

Creates a smart contract for managing the sale of digital content.

Usage:

```
leth shop create --nodeid=1 --network=rinkeby --from=0xadC486F16F003897fb927e22438cb1b820f79879
```

Possible Outputs:

```
{"shop":"0xshopIDF16F003897fb927e22438cb1b820f79879"}
{"error": {"code": "SOME/INTERNAL/ERROR/CODE", "message": "explanatory error message"}}
```

```
leth shop create [flags]
```

**Options**

```
      --from string      The owner of the shop.
  -h, --help             help for create
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
```

## shop sell

Specifies digital content for sale that to the smart contract controlling access permissions to the digital content.

Usage:

```
leth shop sell --nodeid=1 --network=rinkeby --shop=0xshopIDF16F003897fb927e22438cb1b820f79879 --acl=0xd966aa573f8AcBfEb3724B661B420c258ceA5D38 --price/wei=1000000000000000000 --from=0xadC486F16F003897fb927e22438cb1b820f79879 
```

Possible Outputs:

```
{"success":"true"}
{"error": {"code": "SOME/INTERNAL/ERROR/CODE", "message": "explanatory error message"}}
```

```
leth shop sell [flags]
```

**Options**

```
      --acl leth storage add    ACL ID to sell (returned by leth storage add /).
      --from string             The account with rights to sell an ACL permission in the shop.
  -h, --help                    help for sell
      --network string          Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int              ID of the node in order to support multiple nodes on the same machine. 0 by default.
      --price/wei string        For how much PHTs in Wei can users buy this ACL?
      --shop leth shop create   Shop ID where ACL can be sold/bought. (returned by leth shop create /).
```

## user

Capabilities for managing a user's account.&#x20;

```
leth user [flags]
```

**Options**

```
  -h, --help   help for user
```

## user signin

Generates an authentication token to be used verifying a user's identity.&#x20;

Usage:

```
leth user signin --nodeid=1 --network=rinkeby --account=0xadc486f16f003897fb927e22438cb1b820f79879 --peer=QmW6hffkDWCYK988j1oyAi26F6HEkHDvQ7qKKxoSNJwmyS
```

Possible Outputs:

```
{"token":"eyJibG9ja2NoYWluIjoiRVRIIiwiZXRoX2FkZHJlc3MiOiIweGU5Q2JmNjgzRjQ3OTkwMTEzNGE3QTc4RTkxYzljNTIzM2I4RjlDMDQiLCJpYXQiOjMwNTA0NjcsImVhdCI6MzA1MDUyN30.VkAWASrD/20MggH2laXjPlcFpVVPsoLniyTyyTPwFoYV5EQfZG/p/YP-q8u1eyxOpm5Xq4ai5MMcFnu9HBbAE"}
{"error": {"code": "SOME/INTERNAL/ERROR/CODE", "message": "explanatory error message"}}
```

```
leth user signin [flags]
```

**Options**

```
      --account string   Your account HEX address to login with.
  -h, --help             help for signin
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
      --peer string      The PeerId of the Smart Vault node where this token will be valid for.
```

## user signup

Creates a new user account.

Usage:

```
leth user signup --nodeid=1 --network=rinkeby
```

Possible Outputs:

```
{"account":"0xadc486f16f003897fb927e22438cb1b820f79879","error":""}
{"account":"0x0000000000000000000000000000000000000000","error":"some error message"}
```

```
leth user signup [flags]
```

**Options**

```
  -h, --help             help for signup
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
```

## version

Returns the version of the Leth tool.

```
leth version [flags]
```

**Options**

```
  -h, --help   help for version
```

## wallet

Capabilities for managing a user's funds.

```
leth wallet [flags]
```

**Options**

```
  -h, --help   help for wallet
```

## wallet balance

Get an account balance in Wei.

Usage:

```
leth wallet balance --nodeid=1 --network=rinkeby --account=0xadc486f16f003897fb927e22438cb1b820f79879
```

Possible Outputs (3ETH):

```
{"balance":"3000000000000000000","error":""}
{"balance":"0","error":"some error message"}
```

```
leth wallet balance [flags]
```

**Options**

```
      --account string   Account address to check balance for.
  -h, --help             help for balance
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
```

## wallet transfer

Transfer funds from an account to another.

Usage:

```
leth wallet transfer --nodeid=1 --network=rinkeby --from=0xadc486f16f003897fb927e22438cb1b820f79879 --to=0x0dD46808e9780E4a23dd562962300bA029bCfFEf --value=1200000000000000000
```

Possible Outputs:

```
{"success":"true"}
{"error": {"code": "SOME/INTERNAL/ERROR/CODE", "message": "explanatory error message"}}
```

```
leth wallet transfer [flags]
```

### Options

```
      --from string      Account address to transfer Ether from.
  -h, --help             help for transfer
      --network string   Possible values: 'sirius', 'mainnet', 'standalone', 'rinkeby', 'ganache'.
      --nodeid int       ID of the node in order to support multiple nodes on the same machine. 0 by default.
      --to string        Account address to transfer Ether to.
      --value string     Amount of Ether to transfer in Wei format. 1 ETH = 1000000000000000000 Wei
```

###
