-
Download the latest version .deb installer of eosio in here.
-
Install the downloaded .deb package through running this command on terminal:
sudo apt install ./eosio_1.8.3-1-ubuntu-18.04_amd64.deb
-
Download the latest version .deb installer of eosio.cdt in here.
-
Install the downloaded .deb package through running this command on terminal:
sudo apt install ./eosio.cdt_1.6.2-1-ubuntu-18.04_amd64.deb
-
First, run keosd through invoking this command on terminal:
keosd &
-
Next, start nodeos through running this command:
nodeos -e -p eosio \ --plugin eosio::producer_plugin \ --plugin eosio::chain_api_plugin \ --plugin eosio::http_plugin \ --plugin eosio::state_history_plugin \ --plugin eosio::history_api_plugin \ --data-dir $HOME/.local/share/eosio/nodeos/data \ --config-dir $HOME/.local/share/eosio/nodeos/config \ --state-history-dir $HOME/.local/share/eosio/nodeos/shpdata \ --access-control-allow-origin='*' \ --contracts-console \ --http-validate-host=false \ --trace-history \ --chain-state-history \ --verbose-http-errors \ --filter-on='*' \ --disable-replay-opts >> nodeos.log 2>&1 &
-
Open a browser and browser to http://127.0.0.1:8888/v1/chain/get_info. Confirm that JSON response is displayed on page which indicates that the EOS node is running in local machine now.
{ "server_version": "7116e887", "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f", "head_block_num": 46, "last_irreversible_block_num": 45, "last_irreversible_block_id": "0000002db6fc4ecdd498e8daa422b4d118c5069e186cf82b3818f77582f27acd", "head_block_id": "0000002e6cad872259843a427e5d112242001c0702963831196159eafc1d8b71", "head_block_time": "2019-09-25T15:21:30.500", "head_block_producer": "eosio", "virtual_block_cpu_limit": 209189, "virtual_block_net_limit": 1096840, "block_cpu_limit": 199900, "block_net_limit": 1048576, "server_version_string": "v1.8.3", "fork_db_head_block_num": 46, "fork_db_head_block_id": "0000002e6cad872259843a427e5d112242001c0702963831196159eafc1d8b71" }
-
You could also peek log messages of the running nodeos through entering this command:
tail -f nodeos.log
info 2019-09-25T22:00:38.098 nodeos history_api_plugin.cpp:38 plugin_startup ] starting history_api_plugin info 2019-09-25T22:00:38.098 nodeos http_plugin.cpp:625 add_handler ] add api url: /v1/history/get_actions info 2019-09-25T22:00:38.098 nodeos http_plugin.cpp:625 add_handler ] add api url: /v1/history/get_controlled_accounts info 2019-09-25T22:00:38.098 nodeos http_plugin.cpp:625 add_handler ] add api url: /v1/history/get_key_accounts info 2019-09-25T22:00:38.098 nodeos http_plugin.cpp:625 add_handler ] add api url: /v1/history/get_transaction info 2019-09-25T22:00:38.501 nodeos producer_plugin.cpp:1845 produce_block ] Produced block 0000ad5ba0c4c28a... #44379 @ 2019-09-25T22:00:38.500 signed by eosio [trxs: 0, lib: 44378, confirmed: 0] info 2019-09-25T22:00:39.001 nodeos producer_plugin.cpp:1845 produce_block ] Produced block 0000ad5cd43efe1d... #44380 @ 2019-09-25T22:00:39.000 signed by eosio [trxs: 0, lib: 44379, confirmed: 0] info 2019-09-25T22:00:39.502 nodeos producer_plugin.cpp:1845 produce_block ] Produced block 0000ad5d87c3083c... #44381 @ 2019-09-25T22:00:39.500 signed by eosio [trxs: 0, lib: 44380, confirmed: 0] info 2019-09-25T22:00:40.001 nodeos producer_plugin.cpp:1845 produce_block ] Produced block 0000ad5ee67f09b0... #44382 @ 2019-09-25T22:00:40.000 signed by eosio [trxs: 0, lib: 44381, confirmed: 0] info 2019-09-25T22:00:40.502 nodeos producer_plugin.cpp:1845 produce_block ] Produced block 0000ad5f1c3db1be... #44383 @ 2019-09-25T22:00:40.500 signed by eosio [trxs: 0, lib: 44382, confirmed: 0] info 2019-09-25T22:00:41.001 nodeos producer_plugin.cpp:1845 produce_block ] Produced block 0000ad60b2aa078c... #44384 @ 2019-09-25T22:00:41.000 signed by eosio [trxs: 0, lib: 44383, confirmed: 0] info 2019-09-25T22:00:41.502 nodeos producer_plugin.cpp:1845 produce_block ] Produced block 0000ad6185392c5b... #44385 @ 2019-09-25T22:00:41.500 signed by eosio [trxs: 0, lib: 44384, confirmed: 0] ...
-
To stop the keosd, run this command on terminal:
pkill keosd
-
To stop the nodeos gracefully, run this command on terminal:
pkill nodeos
NOTE
Rebooting or turning off your machine while nodeos is running will cause the nodeos become failing and returns error message which suggest you to
hard replay
it, at the next moment you turn on your machine and start the nodeos back. In case this is happening, put--hard-replay
argument when starting the nodeos.nodeos -e -p eosio \ --hard-replay \ --plugin eosio::producer_plugin \ --plugin eosio::chain_api_plugin \ --plugin eosio::http_plugin \ --plugin eosio::state_history_plugin \ --plugin eosio::history_api_plugin \ --data-dir $HOME/.local/share/eosio/nodeos/data \ --config-dir $HOME/.local/share/eosio/nodeos/config \ --state-history-dir $HOME/.local/share/eosio/nodeos/shpdata \ --access-control-allow-origin='*' \ --contracts-console \ --http-validate-host=false \ --trace-history \ --chain-state-history \ --verbose-http-errors \ --filter-on='*' \ --disable-replay-opts >> nodeos.log 2>&1 &
By default, keosd has created a default wallet right after we started at 1st time. But we would like to create a new named wallet to familiarise with EOSIO Wallet.
-
Run
cleos wallet create --name localdev --to-console
command to create a new named wallet wherelocaldev
is name of the wallet.
NOTE
Since we are working in our local development machine, we use
--to-console
argument to output the wallet's password on terminal upon creation. Later, when we are going to create named wallets on Production node, we should replace the--to-console
argument with--file
argument, to prevent the Password is logged in shell's logs.
-
Run
cleos wallet list
to display a list of available wallets managed by the running keosd. Confirm that the name of wallet we created in earlier step, is displayed in the list. -
When we stop & restart the keosd and then running cleos command for displaying a list of wallets, we will notice that our created wallet is not displayed in the list. This means that the wallet is not opened. To reopen the wallet, run
cleos wallet open --name <wallet's name>
command.
- Create 2 Public-Private Key pairs, where 1st keys pair will be designated as the owner keys pair and the 2nd keys pair will be designated as the active keys pair, that are going to be used during local development. Make note these key pairs.
cleos create key
cleos create key
- Import the key pairs into the wallet by executing these commands:
cleos wallet import -n {wallet name} <private-OwnerKey>
andcleos wallet import -n {wallet name} <private-ActiveKey>
. Example:
cleos wallet import -n localdev --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
cleos wallet import -n localdev --private-key 5Kjxtcr9qw1BBCNdK5xu8Qmk7RJax4LtMfm3HKxTh9Bz6VzMbhL
- Next, we will need to import keys that belong to eosio system user. This account is used to setup the chain by loading system contracts that dictate the governance and consensus of the EOSIO chain. Every new EOSIO chain comes with a development key, and this key is the same. Load this key to sign transactions on behalf of the system user (eosio).
cleos wallet import -n localdev --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
- To display a list of the imported key on
localdev
wallet, invoke this command and paste thelocaldev
's noted password when prompted to enter the password:
cleos wallet private_keys --name localdev
Confirm that the output should be looked like this:
[
[
"EOS66o9pPD82sKhEyr2EpmmQHLvHb1dUPkUkcH1G4U5BfxUsHDf7h",
"5JDxdZzxGV94yu6izBRgWryAdecVCJfkEJpA5eU8sqJgQrXhBDm"
],[
"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
],[
"EOS8U3kANbT4VRijGytL4xoxaELD86YFQ8E6efBzCvHQmsmwCYmax",
"5HvdnRoCe1WRNqnt6gxVRFHifAxfaWsSa6xV8UALi2adRvdzeA2"
]
]
In order to interact with the nodeos
from the wallet such as performing various kind of transactions, we need to create & assign an Account
to the wallet 1st. The command for creating a new wallet is:
```bash
cleos create account eosio alice
```
- TODO: Add more info
-
Display list of wallet - Run
cleos wallet list
command. -
Create a new default wallet - Run
cleos wallet create
command. The wallet password will be displayed. Copy paste it into some safe place. -
Create a named wallet - Run
cleos wallet create -n <wallet name>
command. -
Lock default wallet - Run
cleos wallet lock
command. -
Lock named wallet - Run
cleos wallet lock -n <wallet name>
command. -
Unlock default wallet - Run
cleos wallet unlock --password <password>
command. -
Unlock named wallet - Run
cleos wallet unlock -n <wallet name> --password <password>
command. -
Open default wallet - Run
cleos wallet open
command. -
Open named wallet - Run
cleos wallet open -n <wallet name>
command. -
View public keys of unlocked wallet(s) - Run
cleos wallet keys
command. -
View private keys of unlocked wallet(s) - Run
cleos wallet private_keys -n <wallet name> --password <wallet's password>
command.
In order to interact with the nodeos
from the wallet such as performing various kind of transactions, we need to create & assign an Account
to the wallet 1st. The command for creating a new wallet is cleos create account ${authorizing_account} ${new_account} ${owner_public_key} ${active_public_key}
. In the running docker container, the authorizing_account
here is eosio
, so we are going to use it throughout rest of this tutorial. Example:
cleos create account eosio wendysa.acc EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV EOS5Zs8nyMYQsEdv4ZpeMnTwosELf4RvbZaGfztGbQjPNmBbzAqkv
Before running the create account command, we need to import eosio
private key into our default wallet 1st, through invoking this command: cleos wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
Run cleos get account {account_name} --json
command to verify the created account. Example: cleos get account wendysa --json
.
In case we need to create our own Tokens on EOS blockchain, we need to deploy eosio.token
smartcontract 1st as the initial step of doing this. Run this command to deploy the contract: cleos set contract {account_name} ./contracts/eosio.token/ ./contracts/eosio.token/eosio.token.wast ./contracts/eosio.token/eosio.token.abi
. Example:
cleos set contract wendysa ./contracts/eosio.token/ ./contracts/eosio.token/eosio.token.wast ./contracts/eosio.token/eosio.token.abi
To verify that previous contract has been deployed, run cleos get code {account_name}
to verify it. Example:
cleos get code wendysa
Command: cleos push action {account_name} create '{"issuer":"{account_name}","maximum_supply":"{max_supply_dec} {token_name}","can_freeze":"{0_or_1}","can_recall":"{0_or_1}","can_whitelist":"{0_or_1}"}' -p {account_name}
. Example:
cleos push action wendysa create '{"issuer":"wendysa,"maximum_supply":"1000000000.0000 XWS","can_freeze":"0","can_recall":"0","can_whitelist":"0"}' -p wendysa
Command: cleos push action {account_name} issue '{"to":"{target_account_name}","quantity":"{amount_dec} {token_name}","memo":"{free_text}"}' -p {account_name}
. Example:
cleos push action wendysa issue '{"to": "bytemaster", "quantity": "100.0000 XWS", "memo": "Airdrop WendySa Coins!"}' -p wendysa
Command: cleos get table {account_name_which_own_token_smartcontract} {target_account_name} accounts
. Example:
cleos get table wendysa bytemaster accounts
Command: cleos push action {account_name} transfer '{"from": "{sender_account_name}", "to":"{recipient_account_name}", "quantity": "{decimal_num} {token_name}", "memo": "{memo}"' -p {account_name}
. Example:
cleos push action wendysa transfer '{"from":"wendysa ","to":"bytemaster","quantity":"50.0000 XWS","memo":"First transfer"}' -p wendysa
TBD