How to start a Dawn3 testnetwork and add producers using eosio.bios

in #eos7 years ago (edited)

Hello EOS community,

We just launched a Dawn3 test network on DAWN-2018-03-29-ALPHA release.

The big change from Dawn2 is that BPs are added with the help of what we think will be called an “eosio.bios contract", and not from genesis.json.

Our testnet monitor: http://jungle.cryptolions.io:9898/monitor3/
Our Testnet Telegram Channel: https://t.me/jungletestnet
Github: https://github.com/CryptoLions/Jungle3Testnet

Welcome to the Jungle

Building your testnet

If you would like to build own test network, compile and install:

Create home dir

# mkdir /home/eos-DAWN-2018-03-29-ALPHA
# cd /home/eos-DAWN-2018-03-29-ALPHA
# git clone https://github.com/eosio/eos --recursive
# cd eos
# git checkout DAWN-2018-03-29-ALPHA
# git submodule update --recursive
# ./eosio_build.sh
# cd build
# make install

If everything was compiled okay, build a node:
Create a dir in opt

# mkdir /opt/mytestNedNode01
# mkdir /opt/mytestNedNode01/programs

Copy compiled node files (cleos, nodeos,..) from dirs:
/home/eos-DAWN-2018-03-29-ALPHA/eos/build/programs/cleos/cleos
/home/eos-DAWN-2018-03-29-ALPHA/eos/build/programs/nodes/nodes
Into /opt/mytestNedNode01/programs folder

Copy
/home/eos-DAWN-2018-03-29-ALPHA/eos/build/genesis.json
To /opt/mytestNedNode01

Create config.ini in /opt/mytestNedNode01

get-transactions-time-limit = 3
genesis-json = "/opt/mytestNedNode01/genesis.json"

block-log-dir = "blocks"

max-reversible-block-time = -1
max-pending-transaction-time = -1

http-server-address = 0.0.0.0:8888
p2p-listen-endpoint = 0.0.0.0:9876
p2p-server-address = localhost:9876
access-control-allow-origin = *

#p2p-peer-address = localhost:9876
#p2p-peer-address = localhost:9876

mongodb-queue-size = 256

agent-name = "Agent Name"
allowed-connection = any

log-level-net-plugin = info
max-clients = 25
connection-cleanup-period = 30
network-version-match = 0
sync-fetch-span = 1000
enable-stale-production = true
required-participation = 33

private-key=["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]
producer-name = eosio

plugin = eosio::producer_plugin
plugin = eosio::wallet_api_plugin
plugin = eosio::wallet_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::account_history_plugin
plugin = eosio::account_history_api_plugin

================================================================
Next, scripts to start/stop our node:

Create start.sh (https://github.com/CryptoLions/scripts/edit/master/start_nodeos.sh) in /opt/mytestNedNode01/ folder:

#!/bin/bash
EOSIOBINDIR=/opt/mytestNedNode01/programs
DATADIR=/opt/mytestNedNode01

$EOSIOBINDIR/nodeos --enable-stale-production true --data-dir $DATADIR --config-dir $DATADIR > $DATADIR/stdout.txt 2> $DATADIR/stderr.txt & echo $! > $DATADIR/eosd.pid

===============
Create stop.sh (https://github.com/CryptoLions/scripts/blob/master/stop.sh) in the same folder

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

====================================

--enable-stale-production true in start script we need only on the beginning and only for first node in our network.

See if everything is done and then start the node by running ./start.sh. Node log output will be in stderr.txt file If everything is ok we will see something like this:

So eosio start producing blocks..

Now we will start second node with new producer and allow him to produce blocks using eosio.bios contract

Lets create new keys for new account and new BP node

# cd /opt/mytestNedNode01
# programs/cleos -p 8888 --wallet-port 8888 create key (on screenshot different port used)

We received pair:
Private key: 5KD6xe4Jy162GzmNtYQ2ExEk4bVieJEfD4RTncicWDhemR6apww
Public key: EOS5YAH5XuNFQELAiNP9uDzLvnEkRdzNt8vvhvazUtMh9rysEF3Ta

Let’s stop the node: ./stop.sh

Duplicate folder /opt/mytestNedNode01 To /opt/mytestNedNode02

Let’s do some changes in both folders. In mytestNedNode02:
Edit Config.ini

genesis-json = "/opt/mytestNedNode02/genesis.json"

Change port to free

http-server-address = 0.0.0.0:8889
p2p-listen-endpoint = 0.0.0.0:9877
p2p-server-address = localhost:9877

Add peer to your first node

p2p-peer-address = localhost:9876

chage producer keys (generated before) and producer name

private-key=["EOS5YAH5XuNFQELAiNP9uDzLvnEkRdzNt8vvhvazUtMh9rysEF3Ta","5KD6xe4Jy162GzmNtYQ2ExEk4bVieJEfD4RTncicWDhemR6apww"]
producer-name = inita

Edit start.sh and stop.sh with new paths

=========
Now change /opt/mytestNedNode01/config.ini

And add peer to second node:

p2p-peer-address = localhost:9877

OK. Now start 01 node and then start 02 node..

First node will continue producing blocks as user eosio.
Second node will have in logs something like this:

Now go back to the first node and set up the eosio.bios contract

But first we need wallet with the imported eosio key inside

# cd /opt/mytestNedNode01
# programs/cleos -p 8888 --wallet-port 8888 wallet create
Record you wallet password:

Unlock wallet

# programs/cleos -p 8888 --wallet-port 8888 wallet unlock --password PW5JSPxuKBf6gu34upQydhs68iEE1uLvy8otMoibb7GpucNmL3EX4

Then import eosio key:

# programs/cleos -p 8888 --wallet-port 8888 wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

Add eosio.bios smartcontract to user eosio (it was built in you sources dir)

# programs/cleos -p 8888 --wallet-port 8888 set contract eosio /home/eos-DAWN-2018-03-29-ALPHA/eos/build/contracts/eosio.bios/eosio.bios.wast /home/eos-DAWN-2018-03-29-ALPHA/eos/build/contracts/eosio.bios/eosio.bios.abi

As result it will be JSON answer like this:

OK. Now prepare list of block producers.
Create a file setbp.json ( in /opt/mytestNedNode01) and insert this info inside:

{
"version": "12345",
"producers": [
{"producer_name":"inita", "signing_key":"EOS5YAH5XuNFQELAiNP9uDzLvnEkRdzNt8vvhvazUtMh9rysEF3Ta"},
{"producer_name":"eosio", "signing_key":"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"}
]
}

Note: In last version DAWN-2018-03-30-ALPHA parameter for eosio.bois changed from "signing_key" to "block_signing_key".

And the last step - enabling new block producer list

# programs/cleos -p 8888 --wallet-port 8888 push action eosio setprods "$(cat setbp.json)" -p eosio@active

After this command, second node will start producing block as inita user:

Welcome to our Jungle3 Testnetwork: https://github.com/CryptoLions/Jungle3Testnet

Comments, criticisms, and suggestions welcome.

🦁🦁🦁

Sort:  

Awesome work!

Awesome, thanks a lot for instructions!

Congratulations @cryptolions! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!

Do not miss the last announcement from @steemitboard!

So the latest dawn-v3 code - when you install contract - now expects a folder instead of actual files:
cleos -p 8888 --wallet-port 8888 set contract eosio /opt/eos/build/contracts/eosio.bios/

Coin Marketplace

STEEM 0.21
TRX 0.26
JST 0.039
BTC 95625.14
ETH 3355.68
USDT 1.00
SBD 3.05