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

[docs] Update various cleos how-tos and fix index - 2.1 #10009

Merged
merged 8 commits into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ To uninstall the EOSIO built/installed binaries and dependencies, run:
1. [Roadmap](https://github.com/EOSIO/Documentation/blob/master/Roadmap.md)

## Getting Started
Instructions detailing the process of getting the software, building it, running a simple test network that produces blocks, account creation and uploading a sample contract to the blockchain can be found in the [Getting Started](https://developers.eos.io/welcome/latest/getting-started) walkthrough.
Instructions detailing the process of getting the software, building it, running a simple test network that produces blocks, account creation and uploading a sample contract to the blockchain can be found in the [Getting Started](https://developers.eos.io/welcome/v2.1/getting-started-guide) walkthrough.

## Contributing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ link_text: Local Single-Node Testnet With Consensus Protocol

## Goal

This section describes how to set up a single-node blockchain configuration running on a single host with [consensus protocol](https://developers.eos.io/welcome/latest/protocol/consensus_protocol) enabled. This is referred to as a _**single host, single-node testnet with consensus**_. We will set up one node on your local computer and have it produce blocks. The following diagram depicts the desired single host testnet.
This section describes how to set up a single-node blockchain configuration running on a single host with [consensus protocol](https://developers.eos.io/welcome/v2.1/protocol/consensus_protocol) enabled. This is referred to as a _**single host, single-node testnet with consensus**_. We will set up one node on your local computer and have it produce blocks. The following diagram depicts the desired single host testnet.

![Single host single node testnet](single-host-single-node-testnet.png)

Expand Down
2 changes: 1 addition & 1 deletion docs/01_nodeos/08_troubleshooting/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ cleos --url http://localhost:8888 get info | grep server_version

### Error 3070000: WASM Exception Error

If you try to deploy the `eosio.bios` contract or `eosio.system` contract in an attempt to boot an EOSIO-based blockchain and you get the following error or similar: `Publishing contract... Error 3070000: WASM Exception Error Details: env.set_proposed_producers_ex unresolveable`, it is because you have to activate the `PREACTIVATE_FEATURE` protocol first. More details about it and how to enable it can be found in the [Bios Boot Sequence Tutorial](https://developers.eos.io/welcome/latest/tutorials/bios-boot-sequence/#112-set-the-eosiosystem-contract). For more information, you may also visit the [Nodeos Upgrade Guides](https://developers.eos.io/manuals/eos/latest/nodeos/upgrade-guides/).
If you try to deploy the `eosio.bios` contract or `eosio.system` contract in an attempt to boot an EOSIO-based blockchain and you get the following error or similar: `Publishing contract... Error 3070000: WASM Exception Error Details: env.set_proposed_producers_ex unresolveable`, it is because you have to activate the `PREACTIVATE_FEATURE` protocol first. More details about it and how to enable it can be found in the [Bios Boot Sequence Tutorial](https://developers.eos.io/welcome/v2.1/tutorials/bios-boot-sequence/#112-set-the-eosiosystem-contract). For more information, you may also visit the [Nodeos Upgrade Guides](https://developers.eos.io/manuals/eos/latest/nodeos/upgrade-guides/).
49 changes: 33 additions & 16 deletions docs/02_cleos/02_how-to-guides/how-to-create-a-wallet.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,60 @@
## Goal

Create a `keosd` wallet
Create a wallet using `keosd`.

## Before you begin

* Install the currently supported version of `cleos`
Make sure you meet the following requirements:

* Understand the following:
* What is an account
* What is a public and private key pair
* Familiarize with the [`cleos wallet create`](../03_command-reference/wallet/create.md) command and its parameters.
* Familiarize with the other [`cleos wallet`](../03_command-reference/wallet/index.md) commands.
* Install the currently supported version of `cleos`.

[[info | Note]]
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.

* Understand what an [account](https://developers.eos.io/welcome/v2.1/glossary/index/#account) is and its role in the blockchain.
* Understand [Accounts and Permissions](https://developers.eos.io/welcome/v2.1/protocol-guides/accounts_and_permissions) in the protocol documents.
* Understand what a [public](https://developers.eos.io/welcome/v2.1/glossary/index/#public-key) and [private](https://developers.eos.io/welcome/v2.1/glossary/index/#private-key) key pair is.

## Steps

Create a wallet and save the password to a file:
Perform the step below:

Create a default or named wallet and save the wallet password to a file:

```sh
cleos wallet create --file password.pwd
cleos wallet create [-n named_wallet] -f <file_to_save_pwd>
```

This should produce similar output as below. Note the wallet is named `default` if no name is provided.
Where `file_to_save_pwd` is the name of the file to write the wallet password to and `named_wallet` is an optional parameter to assign a name to the wallet.

Some examples are provided below:

* Create a default wallet and save the password to the file `default_wallet.pwd`:

**Example Output**

```sh
cleos wallet create -f default_wallet.pwd
```
```console
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
saving password to password.pwd
saving password to default_wallet.pwd
```

Alternatively, you can name a wallet with `-n` option:
* Create a named wallet `my_wallet` and save the password to the file `my_wallet.pwd`:

**Example Output**

```sh
cleos wallet create -n named_wallet -f passwd
cleos wallet create -n my_wallet -f my_wallet.pwd
```

You should see something like the output below:

```console
Creating wallet: named_wallet
Creating wallet: my_wallet
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
saving password to passwd
saving password to my_wallet.pwd
```
2 changes: 1 addition & 1 deletion docs/02_cleos/02_how-to-guides/how-to-create-an-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Create a new EOSIO blockchain account
| The cleos tool is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install the cleos tool.

* Acquire functional understanding of the following:
* [EOSIO Accounts and Permissions](https://developers.eos.io/welcome/latest/protocol/accounts_and_permissions)
* [EOSIO Accounts and Permissions](https://developers.eos.io/welcome/v2.1/protocol/accounts_and_permissions)
* Asymmetric cryptography (public and private keypair)

* Created an Owner and an Active key pair
Expand Down
41 changes: 28 additions & 13 deletions docs/02_cleos/02_how-to-guides/how-to-delegate-CPU-resource.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
## Goal

Delegate resource for an account or application
Delegate CPU bandwidth for an account or application.

## Before you begin

* Install the currently supported version of `cleos`
Make sure you meet the following requirements:

* Ensure the reference system contracts from `eosio.contracts` repository is deployed and used to manage system resources
* Familiarize with the [`cleos system delegatebw`](../03_command-reference/system/system-delegatebw.md) command and its parameters.
* Install the currently supported version of `cleos`.

* Understand the following:
* What is an account
* What is network bandwidth
* What is CPU bandwidth
[[info | Note]]
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.

* Ensure the reference system contracts from [`eosio.contracts`](https://github.com/EOSIO/eosio.contracts) repository is deployed and used to manage system resources.
* Understand what an [account](https://developers.eos.io/welcome/v2.1/glossary/index/#account) is and its role in the blockchain.
* Understand [CPU bandwidth](https://developers.eos.io/welcome/v2.1/glossary/index/#cpu) in an EOSIO blockchain.
* Understand [NET bandwidth](https://developers.eos.io/welcome/v2.1/glossary/index/#net) in an EOSIO blockchain.

## Steps

Delegate 0.01 SYS CPU bandwidth from `bob` to `alice`
Perform the step below:

Delegate CPU bandwidth from a source account to a receiver account:

```sh
cleos system delegatebw bob alice "0 SYS" "0.01 SYS"
cleos system delegatebw <from> <receiver> <stake_net_quantity> <stake_cpu_quantity>
```

You should see something below:
Where `from` is the account to delegate bandwidth from, `receiver` is the account to receive the delegated bandwidth, and `stake_net_quantity` and/or `stake_cpu_quantity` is the amount of tokens to stake for network (NET) bandwidth and/or CPU bandwidth, respectively.

Some examples are provided below:

* Delegate 0.01 SYS CPU bandwidth from `bob` to `alice`:

```console
**Example Output**

```sh
cleos system delegatebw bob alice "0 SYS" "0.01 SYS"
```
```json
executed transaction: 5487afafd67bf459a20fcc2dbc5d0c2f0d1f10e33123eaaa07088046fd18e3ae 192 bytes 503 us
# eosio <= eosio::delegatebw {"from":"bob","receiver":"alice","stake_net_quantity":"0.0000 SYS","stake_cpu_quanti...
# eosio.token <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.0010 EOS","memo":"stake bandwidth"}
# eosio <= eosio::delegatebw {"from":"bob","receiver":"alice","stake_net_quantity":"0.0000 SYS","stake_cpu_quantity":"0.0100 SYS"...
# eosio.token <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.0010 SYS","memo":"stake bandwidth"}
# bob <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.0010 SYS","memo":"stake bandwidth"}
# eosio.stake <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.0010 SYS","memo":"stake bandwidth"}
```
39 changes: 26 additions & 13 deletions docs/02_cleos/02_how-to-guides/how-to-delegate-net-resource.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
## Goal

Delegate resource for an account or application
Delegate network bandwidth for an account or application.

## Before you begin

* Install the currently supported version of `cleos`
Make sure you meet the following requirements:

* Ensure the reference system contracts from `eosio.contracts` repository is deployed and used to manage system resources

* Understand the following:
* What is an account
* What is network bandwidth
* What is CPU bandwidth
* Familiarize with the [`cleos system delegatebw`](../03_command-reference/system/system-delegatebw.md) command and its parameters.
* Install the currently supported version of `cleos`.

[[info | Note]]
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.

* Ensure the reference system contracts from [`eosio.contracts`](https://github.com/EOSIO/eosio.contracts) repository is deployed and used to manage system resources.
* Understand what an [account](https://developers.eos.io/welcome/v2.1/glossary/index/#account) is and its role in the blockchain.
* Understand [NET bandwidth](https://developers.eos.io/welcome/v2.1/glossary/index/#net) in an EOSIO blockchain.
* Understand [CPU bandwidth](https://developers.eos.io/welcome/v2.1/glossary/index/#cpu) in an EOSIO blockchain.

## Steps

Delegate 0.01 SYS network bandwidth from `bob` to `alice`
Perform the step below:

Delegate CPU bandwidth from a source account to a receiver account:

```sh
cleos system delegatebw bob alice "0.01 SYS" "0 SYS"
cleos system delegatebw <from> <receiver> <stake_net_quantity> <stake_cpu_quantity>
```

You should see something below:
Where `from` is the account to delegate bandwidth from, `receiver` is the account to receive the delegated bandwidth, and `stake_net_quantity` and/or `stake_cpu_quantity` is the amount of tokens to stake for network (NET) bandwidth and/or CPU bandwidth, respectively.

Some examples are provided below:

* Delegate 0.01 SYS network bandwidth from `bob` to `alice`:

```console
**Example Output**

```sh
cleos system delegatebw bob alice "0.01 SYS" "0 SYS"
```
```json
executed transaction: 5487afafd67bf459a20fcc2dbc5d0c2f0d1f10e33123eaaa07088046fd18e3ae 192 bytes 503 us
# eosio <= eosio::delegatebw {"from":"bob","receiver":"alice","stake_net_quantity":"0.0100 SYS","stake_cpu_quanti...
# eosio <= eosio::delegatebw {"from":"bob","receiver":"alice","stake_net_quantity":"0.0100 SYS","stake_cpu_quantity":"0.0000 SYS"...
# eosio.token <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.0010 SYS","memo":"stake bandwidth"}
# bob <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.0010 SYS","memo":"stake bandwidth"}
# eosio.stake <= eosio.token::transfer {"from":"bob","to":"eosio.stake","quantity":"0.0010 SYS","memo":"stake bandwidth"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Query infomation of an EOSIO account
[[info | Note]]
| The cleos tool is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install the cleos tool.

* Acquire functional understanding of [EOSIO Accounts and Permissions](https://developers.eos.io/welcome/latest/protocol/accounts_and_permissions)
* Acquire functional understanding of [EOSIO Accounts and Permissions](https://developers.eos.io/welcome/v2.1/protocol/accounts_and_permissions)


## Steps
Expand Down
102 changes: 95 additions & 7 deletions docs/02_cleos/02_how-to-guides/how-to-get-block-information.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,106 @@
## Goal

Query infomation of a block
Query infomation about a block.

## Before you begin

* Install the currently supported version of `cleos`
Make sure to meet the following requirements:

* Understand the following:
* What is a block
* Familiarize with the [`cleos get block`](../03_command-reference/get/block.md) command and its parameters.
* Install the currently supported version of `cleos`.

[[info | Note]]
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.

* Understand what a [block](https://developers.eos.io/welcome/v2.1/glossary/index/#block) is and its role in the blockchain.
* Understand the [block lifecycle](https://developers.eos.io/welcome/v2.1/protocol-guides/consensus_protocol/#5-block-lifecycle) in the EOSIO consensus protocol.

## Steps

Execute the command below:
Perform the step below:

Retrieve full or partial information about a block:

```sh
cleos get block [--info] <block_number_or_id>
```

Where `block_number_or_id` is the specified block number or block ID and `--info` is an optional parameter to retrieve a partial subset of the block information.

Some examples are provided below:

* Query the testnet to retrieve full block information about block number `48351112` or block ID `02e1c7888a92206573ae38d00e09366c7ba7bc54cd8b7996506f7d2a619c43ba`:

**Example Output**

```sh
cleos get block BLOCK_NUMBER
```
cleos -u https://api.testnet.eos.io get block 48351112
```
```json
{
"timestamp": "2021-01-28T17:58:59.500",
"producer": "inith",
"confirmed": 0,
"previous": "02e1c78787ff4d4ce6124831b936bb4ef6015e470868a535f1c6e04f3afed8a1",
"transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
"action_mroot": "1bf9d17b5a951cbb6d0a8324e4039744db4137df498abd53046ea26fa74d73c9",
"schedule_version": 1,
"new_producers": null,
"producer_signature": "SIG_K1_JxFfxGA1wZx9LCVjbrBb5nxTuJai7RUSiwRXyY866fYvZZyRtdmQFn9KJCqVHFAiYEsJpDb6dhTmHNDwipJm4rDiyhEmGa",
"transactions": [],
"id": "02e1c7888a92206573ae38d00e09366c7ba7bc54cd8b7996506f7d2a619c43ba",
"block_num": 48351112,
"ref_block_prefix": 3493375603
}
```

* Query the testnet to retrieve full block information about block ID `02e1c7888a92206573ae38d00e09366c7ba7bc54cd8b7996506f7d2a619c43ba`:

**Example Output**

```sh
cleos -u https://api.testnet.eos.io get block 02e1c7888a92206573ae38d00e09366c7ba7bc54cd8b7996506f7d2a619c43ba
```
```json
{
"timestamp": "2021-01-28T17:58:59.500",
"producer": "inith",
"confirmed": 0,
"previous": "02e1c78787ff4d4ce6124831b936bb4ef6015e470868a535f1c6e04f3afed8a1",
"transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
"action_mroot": "1bf9d17b5a951cbb6d0a8324e4039744db4137df498abd53046ea26fa74d73c9",
"schedule_version": 1,
"new_producers": null,
"producer_signature": "SIG_K1_JxFfxGA1wZx9LCVjbrBb5nxTuJai7RUSiwRXyY866fYvZZyRtdmQFn9KJCqVHFAiYEsJpDb6dhTmHNDwipJm4rDiyhEmGa",
"transactions": [],
"id": "02e1c7888a92206573ae38d00e09366c7ba7bc54cd8b7996506f7d2a619c43ba",
"block_num": 48351112,
"ref_block_prefix": 3493375603
}
```

* Query the local chain to retrieve partial block information about block number `1`:

**Example Output**

```sh
cleos get block --info 1
```
```json
{
"block_num": 1,
"ref_block_num": 1,
"id": "0000000130d70e94e0022fd2fa035cabb9e542c34ea27f572ac90b5a7aa3d891",
"timestamp": "2018-03-02T12:00:00.000",
"producer": "",
"confirmed": 1,
"previous": "0000000000000000000000000000000000000000000000000000000000000000",
"transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
"action_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
"schedule_version": 0,
"producer_signature": "SIG_K1_111111111111111111111111111111111111111111111111111111111111111116uk5ne",
"ref_block_prefix": 3526296288
}
```

Note that the partial block information excludes the variable fields `new_producers`, `header_extensions`, `transactions`, or `block_extensions`.
Empty file.
2 changes: 1 addition & 1 deletion docs/02_cleos/03_command-reference/get/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ cleos get account eosio --json
```

## See Also
- [Accounts and Permissions](https://developers.eos.io/welcome/latest/protocol/accounts_and_permissions) protocol document.
- [Accounts and Permissions](https://developers.eos.io/welcome/v2.1/protocol/accounts_and_permissions) protocol document.
2 changes: 1 addition & 1 deletion docs/02_cleos/03_command-reference/net/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Given, a valid, existing `hostname:port` parameter the above command returns a j
}
```

The `last_handshake` structure is explained in detail in the [Network Peer Protocol](https://developers.eos.io/welcome/latest/protocol/network_peer_protocol#421-handshake-message) documentation section.
The `last_handshake` structure is explained in detail in the [Network Peer Protocol](https://developers.eos.io/welcome/v2.1/protocol/network_peer_protocol#421-handshake-message) documentation section.
2 changes: 1 addition & 1 deletion docs/02_cleos/03_command-reference/set/set-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ The authority JSON object ...
```

## See Also
- [Accounts and Permissions](https://developers.eos.io/welcome/latest/protocol/accounts_and_permissions) protocol document.
- [Accounts and Permissions](https://developers.eos.io/welcome/v2.1/protocol/accounts_and_permissions) protocol document.
2 changes: 1 addition & 1 deletion docs/02_cleos/03_command-reference/set/set-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ cleos system voteproducer approve sandwichfarm someproducer -p sandwichfarm@voti
```

## See Also
- [Accounts and Permissions](https://developers.eos.io/welcome/latest/protocol/accounts_and_permissions) protocol document.
- [Accounts and Permissions](https://developers.eos.io/welcome/v2.1/protocol/accounts_and_permissions) protocol document.