Executing Node

1. Bios_Boot_Node folder and create genesis.json

~# cd $HOME
~# mkdir Bios_Boot_Node
~# cd Bios_Boot_Node
~/Bios_Boot_Node# touch genesis.json
~/Bios_Boot_Node# vi genesis.json
{
"initial_timestamp": "2020-07-15T00:00:00.000",
"initial_key": "[eosio Public Key]",
"initial_configuration": {
        "max_block_net_usage": 1048576,
        "target_block_net_usage_pct": 1000,
        "max_transaction_net_usage": 524288,
        "base_per_transaction_net_usage": 12,
        "net_usage_leeway": 500,
        "context_free_discount_net_usage_num": 20,
        "context_free_discount_net_usage_den": 100,
        "max_block_cpu_usage": 200000,
        "target_block_cpu_usage_pct": 1000,
        "max_transaction_cpu_usage": 150000,         
        "max_transaction_lifetime": 3600,
        "deferred_trx_expiration_window": 600,
        "max_transaction_delay": 3888000,
        "max_inline_action_size": 4096,
        "max_inline_action_depth": 4,
        "max_authority_depth": 6,
        "max_generated_transaction_count": 16
},
  "initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000"
}

For [eosio public key], enter the Public Key which has created in the previous step.

2. create config.ini

~/Bios_Boot_Node# mkdir config
~/Bios_Boot_Node# cd config
~/Bios_Boot_Node/config# touch config.ini
~/Bios_Boot_Node/config# vi config.ini

access-control-allow-origin = *
contracts-console = true
http-validate-host = false
verbose-http-errors = true

reversible-blocks-db-size-mb = 2048

max-transaction-time = 2000

chain-threads = 8
http-threads = 6

p2p-max-nodes-per-host = 5
max-clients = 5

wasm-runtime = eos-vm
eos-vm-oc-enable = true

plugin = eosio::producer_plugin
plugin = eosio::producer_api_plugin
plugin = eosio::chain_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::http_plugin
plugin = eosio::history_api_plugin
plugin = eosio::history_plugin

3. genesis Node start

~# cd $HOME/Bios_Boot_Node
~/Bios_Boot_Node# mkdir genesis
~/Bios_Boot_Node# cd genesis
~/Bios_Boot_Node/genesis# touch node_start.sh
~/Bios_Boot_Node/genesis# vi node_start.sh

#!/bin/bash
DATADIR=$HOME"/Bios_Boot_Node/node_data"
if [ ! -d $DATADIR ]; then
  mkdir -p $DATADIR;
fi

nodeos \
--agent-name "Bios-Boot-Node" \
--producer-name "eosio" \
--genesis-json $HOME"/Bios_Boot_Node/genesis.json" \
--enable-stale-production \
--signature-provider [eosio Public Key]=KEY:[eosio Private Key] \
--data-dir $DATADIR"/data" \
--config-dir $HOME"/Bios_Boot_Node/config" \
--blocks-dir $DATADIR"/blocks" \
--http-server-address "localhost:18888" \
--p2p-listen-endpoint "0.0.0.0:19000" \
>> $DATADIR"/nodeos.log" 2>&1 & \
echo $! > $DATADIR"/nodeosd.pid"
echo /=========Node Start=========
echo View log command: tail -f $DATADIR/nodeos.log
echo ============================/

~/Bios_Boot_Node/genesis# sh node_start.sh
~# tail -f $HOME/Bios_Boot_Node/node_data/nodeos.log
~# ps -ef | grep eos
~# cleos -u http://localhost:18888 get info
~# curl http://localhost:18888/v1/chain/get_info | jq

For [eosio Public Key], [eosio Private Key], enter the Public Key which has created in the previous step.

4. Node stop

To stop genesis node, write stop.sh on the Shell script file in the directory then execute it.

~/Bios_Boot_Node/genesis# touch stop.sh
~/Bios_Boot_Node/genesis3 vi stop.sh

#!/bin/bash
DATADIR=$HOME"/Bios_Boot_Node/node_data"

if [ -f $DATADIR"/nodeosd.pid" ]; then
pid=`cat $DATADIR"/nodeosd.pid"`
echo $pid
kill $pid
rm -r $DATADIR"/nodeosd.pid"
echo -ne "Stoping Node"
while true; do
[ ! -d "/proc/$pid/fd" ] && break
echo -ne "."
sleep 1
done
echo -ne "\rNode Stopped. \n"
fi

~/Bios_Boot_Node/genesis# sh stop.sh

5. Node restart

If 'genesis node' is stopped, it cannot restart the process by using the created script from '3.bootnode henesis start'. When above script is used, blockchain DB will be initialized and created. To avoid, restart by using --hard-replay-blockchain option of nodeos.

~/Bios_Boot_Node/genesis# touch hard_replay.sh
~/Bios_Boot_Node/genesis# vi hard_replay.sh

#!/bin/bash
DATADIR=$HOME"/Bios_Boot_Node/node_data"
if [ ! -d $DATADIR ]; then
  mkdir -p $DATADIR;
fi

nodeos \
--agent-name "Bios-Boot-Node" \
--producer-name "eosio" \
--genesis-json $HOME"/Bios_Boot_Node/genesis.json" \
--enable-stale-production \
--signature-provider [eosio Public Key]=KEY:[eosio Private Key] \
--data-dir $DATADIR"/data" \
--config-dir $DATADIR"/config" \
--blocks-dir $DATADIR"/blocks" \
--http-server-address "localhost:18888" \
--p2p-listen-endpoint "0.0.0.0:19000" \
--hard-replay-blockchain \
>> $DATADIR"/nodeos.log" 2>&1 & \
echo $! > $DATADIR"/nodeosd.pid"

~/Bios_Boot_Node/genesis# sh hard_replay.sh

Last updated