Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10403 from EOSIO/docs/devrel-1499-2.1
Browse files Browse the repository at this point in the history
[docs] Update reference for various cleos commands - 2.1
  • Loading branch information
lparisc authored May 27, 2021
2 parents 0e31501 + 858c661 commit d8c3b57
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 163 deletions.
74 changes: 44 additions & 30 deletions docs/02_cleos/03_command-reference/create/account.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,57 @@
## Command
```sh
cleos create account [OPTIONS] creator name OwnerKey [ActiveKey]
```
**Where:**
* [`OPTIONS`] = See **Options** in [**Command Usage**](command-usage) section below
* `creator` = The name of the existing account creating the new account
* `name` = The name of the new account
* `OwnerKey` = The owner public key or permission level for the new account
* [`ActiveKey`] = The active public key or permission level for the new account

**Note:** The arguments and options enclosed in square brackets are optional.

## Description
Create a new account on the blockchain (assumes system contract does not restrict RAM usage)
Use this command to create a new account on an EOSIO blockchain.

## Usage
[[info | Note]]
| This command assumes system contract does not restrict RAM usage.

```console
Usage: cleos create account [OPTIONS] creator name OwnerKey [ActiveKey]
## Command Usage
The following information shows the different positionals and options you can use with the `cleos create account` command:

Positionals:
creator TEXT The name of the account creating the new account (required)
name TEXT The name of the new account (required)
OwnerKey TEXT The owner public key or permission level for the new account (required)
ActiveKey TEXT The active public key or permission level for the new account
### Positionals
* `creator` _TEXT_ REQUIRED - The name of the account creating the new account
* `name` _TEXT_ REQUIRED - The name of the new account
* `OwnerKey` _TEXT_ REQUIRED - The owner public key or permission level for the new account
* `ActiveKey` _TEXT_ - The active public key or permission level for the new account

Options:
-h,--help Print this help message and exit
-x,--expiration set the time in seconds before a transaction expires, defaults to 30s
-f,--force-unique force the transaction to be unique. this will consume extra bandwidth and remove any protections against accidently issuing the same transaction multiple times
-s,--skip-sign Specify if unlocked wallet keys should be used to sign transaction
-j,--json print result as json
--json-file TEXT save result in json format into a file
-d,--dont-broadcast don't broadcast transaction to the network (just print to stdout)
--return-packed used in conjunction with --dont-broadcast to get the packed transaction
-r,--ref-block TEXT set the reference block num or block id used for TAPOS (Transaction as Proof-of-Stake)
--use-old-rpc use old RPC push_transaction, rather than new RPC send_transaction
-p,--permission TEXT ... An account and permission level to authorize, as in 'account@permission' (defaults to 'creator@active')
--max-cpu-usage-ms UINT set an upper limit on the milliseconds of cpu usage budget, for the execution of the transaction (defaults to 0 which means no limit)
--max-net-usage UINT set an upper limit on the net usage budget, in bytes, for the transaction (defaults to 0 which means no limit)
--delay-sec UINT set the delay_sec seconds, defaults to 0s
```
### Options
* `-h,--help` - Print this help message and exit
* `-x,--expiration` - set the time in seconds before a transaction expires, defaults to 30s
* `-f,--force-unique` - force the transaction to be unique. this will consume extra bandwidth and remove any protections against accidently issuing the same transaction multiple times
* `-s,--skip-sign` - Specify if unlocked wallet keys should be used to sign transaction
* `-j,--json` - print result as JSON
* `--json-file` _TEXT_ - save result in JSON format into a file
* `-d,--dont-broadcast` - don't broadcast transaction to the network (just print to `stdout`)
* `--return-packed` - used in conjunction with `--dont-broadcast` to get the packed transaction
* `-r,--ref-block` _TEXT_ - set the reference block num or block id used for TAPOS (Transaction as Proof-of-Stake)
* `--use-old-rpc` - use old RPC push_transaction, rather than new RPC send_transaction
* `-p,--permission` _TEXT_ ... - An account and permission level to authorize, as in `account@permission` (defaults to `creator@active`)
* `--max-cpu-usage-ms` _UINT_ - set an upper limit on the milliseconds of CPU usage budget, for the execution of the transaction (defaults to 0 which means no limit)
* `--max-net-usage` UINT - set an upper limit on the net usage budget, in bytes, for the transaction (defaults to 0 which means no limit)
* `--delay-sec` _UINT_ - set the `delay_sec` seconds, defaults to 0

## Requirements
For prerequisites to run this command, see the **Before you Begin** section of the [How to Create a Blockchain Account](../../02_how-to-guides/how-to-create-an-account.md) guide.

## Command
A set of EOSIO keys is required to create an account. The EOSIO keys can be generated by using `cleos create key`.
## Examples
The following examples demonstrate how to use the `cleos create account` command:

**Example 1.** Create a new account `tester` authorized by the creator account `inita`:
```sh
cleos create account inita tester EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA
```

## Output

```json
{
"transaction_id": "6acd2ece68c4b86c1fa209c3989235063384020781f2c67bbb80bc8d540ca120",
Expand Down
68 changes: 26 additions & 42 deletions docs/02_cleos/03_command-reference/create/key.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,46 @@
## Command
```sh
cleos create key [OPTIONS]
```
**Where**:
* [`OPTIONS`] = See **Options** in [**Command Usage**](command-usage) section below.

**Where**
* [OPTIONS] = See Options in Command Usage section below. You must choose one option of `--file` or `--to-console`

**Note**: The arguments and options enclosed in square brackets are optional.
**Note:** The arguments and options enclosed in square brackets are optional.

## Description
Creates a new keypair and either prints the public and private keys to the screen or to a file.
Use this command to create a new keypair and print the public and private keys

## Command Usage
The following information shows the different positionals and options you can use with the `cleos create key` command:

### Positionals:
- none
### Positionals
* none

### Options
- `-h,--help` - Print this help message and exit
- `--r1` - Generate a key using the R1 curve (iPhone), instead of the K1 curve (Bitcoin)
`-f`,`--file` _TEXT_ - Name of file to write private/public key output to. (Must be set, unless "--to-console" is passed
`--to-console` - Print private/public keys to console.
* `-h,--help` - Print this help message and exit
* `--r1` - Generate a key using the R1 curve (iPhone), instead of the K1 curve (Bitcoin)
* `-f`,`--file` _TEXT_ - Name of file to write private/public key output to. (Must be set, unless "--to-console" is passed
* `--to-console` - Print private/public keys to console

## Requirements
* Install the currently supported version of `cleos`.
[[info | Note]]
| The `cleos` tool is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will install the `cleos` and `keosd` command line tools.
For prerequisites to run this command, see the **Before you Begin** section of the [How to Create Keypairs](../../02_how-to-guides/how-to-create-key-pairs.md) topic.

## Examples
1. Create a new key pair and output to the screen
```shell
cleos create key --to-console
```
**Where**
`--to-console` = Tells the `cleos create key` command to print the private/public keys to the console.
The following examples demonstrate the `cleos create key` command:

**Example Output**
```shell
Private key: 5KDNWQvY2seBPVUz7MiiaEDGTwACfuXu78bwZu7w2UDM9A3u3Fs
Public key: EOS5zG7PsdtzQ9achTdRtXwHieL7yyigBFiJDRAQonqBsfKyL3XhC
**Example 1.** Create a new public/private keypair and print the output to the console:
```sh
cleos create key --to-console
```

2. Create a new key pair and output to a file
```shell
cleos create key --file my_keys.txt
```console
Private key: 5KPzrqNMJdr6AX6abKg*******************************cH
Public key: EOS4wSiQ2jbYGrqiiKCm8oWR88NYoqnmK4nNL1RCtSQeSFkGtqsNc
```
**Where**
`--file` keys.txt = Tells the `cleos create key` command to output the private/public keys to afile called `my_keys.txt`.

**Example Output**
```shell
saving keys to my_keys.txt
**Example 2.** Create a new public/private keypair and save it to a file named `pw.txt`:
```sh
cleos create key --file pw.txt
```

```shell
cat my_keys.txt
```

**Example Output**
```shell
Private key: 5KWcfnGao5K6WV65Zgjd1xvpugRUeKwb6oxzmwaS1tPE2Ef4qzo
Public key: EOS7oDiBtzSHtShprGFmXm9JLnwxhcPeDyhww3tXDvVATDYtciLGG
```console
saving keys to pw.txt
```
47 changes: 20 additions & 27 deletions docs/02_cleos/03_command-reference/get/account.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@

## Command
```sh
cleos get account [OPTIONS] name [core-symbol]
```
**Where**:
* [`OPTIONS`] = See **Options** in [**Command Usage**](command-usage) section below
* `name` = The name of the account to retrieve
* [`core-symbol`] = The expected core symbol of the chain you are querying

**Where**
* [OPTIONS] = See Options in Command Usage section below.

**Note**: The arguments and options enclosed in square brackets are optional.
**Note:** The arguments and options enclosed in square brackets are optional.

## Description
Retrieve an account from the blockchain
Use this command to retrieve information associated with an EOSIO account.

## Command Usage
The following information shows the different positionals and options you can use with the `cleos create key` command:
The following information shows the different positionals and options you can use with the `cleos get account` command:

### Positionals:
- `name` _TEXT_ - The name of the account to retrieve
- `core-symbol` _TEXT_ - The expected core symbol of the chain you are querying - OPTIONAL
### Positionals
* `name` _TEXT_ REQUIRED - The name of the account to retrieve
* `core-symbol` _TEXT_ - The expected core symbol of the chain you are querying

### Options
- `-h,--help` Print this help message and exit
- `-j,--json` - Output in JSON format
* `-h,--help` - Print this help message and exit
* `-j,--json` - Output in JSON format

## Requirements
* Install the currently supported version of `cleos.`
[[info | Note]]
| The `cleos` tool is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will install the `cleos` and `keosd` command line tools.
* You have access to an EOSIO blockchain.
For prerequisites to run this command, see the **Before you Begin** section of the [How to Get Account Information](../../02_how-to-guides/how-to-get-account-information.md) topic.

## Examples
The following examples demonstrate the `cleos get account` command:

1. Get formatted data for user **eosio**

```shell
**Example 1.** Retrieve human-readable information about the `eosio` account:
```sh
cleos get account eosio
```
**Where**
`eosio` = The name of the account.

**Example Output**
```console
privileged: true
permissions:
Expand All @@ -58,13 +53,11 @@ cpu bandwidth: (averaged over 3 days)

producers: <not voted>
```
2. Get JSON data for user **eosio**

**Example 2.** Retrieve JSON-formatted data about the `eosio` account:
```sh
cleos get account eosio --json
```
**Example Output**

```json
{
"account_name": "eosio",
Expand Down Expand Up @@ -131,4 +124,4 @@ cleos get account eosio --json
```

## See Also
- [Accounts and Permissions](https://developers.eos.io/welcome/v2.1/protocol/accounts_and_permissions) protocol document.
* [Accounts and Permissions](https://developers.eos.io/welcome/v2.1/protocol/accounts_and_permissions) protocol document.
38 changes: 25 additions & 13 deletions docs/02_cleos/03_command-reference/get/transaction.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
## Command
```sh
cleos get transaction [OPTIONS] id
```
**Where**:
* [`OPTIONS`] = See **Options** in [**Command Usage**](command-usage) section below
* `id` = ID of the transaction to retrieve

**Note:** The arguments and options enclosed in square brackets are optional.

## Description
Retrieves a transaction from the blockchain
Use this command to retrieve a transaction from the blockchain.

## Positional Parameters
`id`` _TEXT_ - ID of the transaction to retrieve
## Command Usage
The following information shows the different positionals and options you can use with the `cleos get transaction` command:

## Options
` -b,--block-hint` UINT the block number this transaction may be in
### Positionals
* `id` _TEXT_ REQUIRED - ID of the transaction to retrieve

**Command**
### Options
* `-h,--help` - Print this help message and exit
* `-b,--block-hint` _UINT_ - The block number this transaction may be in

```sh
cleos get transaction
```
**Output**
## Requirements
For prerequisites to run this command, see the **Before you Begin** section of the [How to Get Transaction Information](../../02_how-to-guides/how-to-get-transaction-information.md) topic.

## Example
## Examples
The following examples demonstrate the `cleos get transaction` command:

**Example 1.** Retrieve transaction information for transaction ID `eb4b94b7...b703`:
```sh
cleos get transaction eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703
```
Expand Down Expand Up @@ -75,5 +87,5 @@ cleos get transaction eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd
}
```

[[info | Important Note]]
| The above transaction id will not exist on your blockchain
[[info | Note]]
| The above transaction ID will not exist on your actual EOSIO blockchain.
9 changes: 3 additions & 6 deletions docs/02_cleos/03_command-reference/net/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
```sh
cleos net connect [OPTIONS] host
```

**Where:**
* [OPTIONS] = See **Options** in the [**Command Usage**](command-usage) section below.
* host = The hostname:port to connect to
Expand Down Expand Up @@ -30,22 +29,20 @@ Make sure you meet the following requirements:
* You have access to a producing node instance with the [`net_api_plugin`](../../../01_nodeos/03_plugins/net_api_plugin/index.md) loaded.

## Examples
The following examples demonstrate how to use the `cleos net connect` command:
The following examples demonstrate the `cleos net connect` command:

* Instruct default local node (listening at default http address `http://127.0.0.1:8888`) to connect to peer node listening at p2p address `localhost:9002`:
**Example 1.** Instruct default local node (listening at default http address `http://127.0.0.1:8888`) to connect to peer node listening at p2p address `localhost:9002`:
```sh
cleos net connect localhost:9002
```
**Output:**
```console
"added connection"
```

* Instruct local node listening at http address `http://127.0.0.1:8001` to connect to peer node listening at p2p address `localhost:9002`:
**Example 2.** Instruct local node listening at http address `http://127.0.0.1:8001` to connect to peer node listening at p2p address `localhost:9002`:
```sh
cleos -u http://127.0.0.1:8001 net connect localhost:9002
```
**Output:**
```console
"added connection"
```
Expand Down
9 changes: 3 additions & 6 deletions docs/02_cleos/03_command-reference/net/disconnect.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
```sh
cleos net disconnect [OPTIONS] host
```

**Where:**
* [OPTIONS] = See **Options** in the [**Command Usage**](command-usage) section below.
* host = The hostname:port to disconnect from
Expand Down Expand Up @@ -30,22 +29,20 @@ Make sure you meet the following requirements:
* You have access to a producing node instance with the [`net_api_plugin`](../../../01_nodeos/03_plugins/net_api_plugin/index.md) loaded.

## Examples
The following examples demonstrate how to use the `cleos net disconnect` command:
The following examples demonstrate the `cleos net disconnect` command:

* Instruct default local node (listening at default http address `http://127.0.0.1:8888`) to disconnect from peer node listening at p2p address `localhost:9002`:
**Example 1.** Instruct default local node (listening at default http address `http://127.0.0.1:8888`) to disconnect from peer node listening at p2p address `localhost:9002`:
```sh
cleos net disconnect localhost:9002
```
**Output:**
```console
"connection removed"
```

* Instruct local node listening at http address `http://127.0.0.1:8001` to disconnect from peer node listening at p2p address `localhost:9002`:
**Example 2.** Instruct local node listening at http address `http://127.0.0.1:8001` to disconnect from peer node listening at p2p address `localhost:9002`:
```sh
cleos -u http://127.0.0.1:8001 net disconnect localhost:9002
```
**Output:**
```console
"connection removed"
```
Expand Down
Loading

0 comments on commit d8c3b57

Please sign in to comment.