Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update instruction guideline #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
69 changes: 68 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,68 @@
# GenesisNode
# Block Producer Guideline
The purpose of this document is to provide a guideline for Block Producers on setting up a CAN Producer Node. Target audiences are preferably technical personnels with prior experience on network infrastructure and server setup.

## Dependencies
Follow this [CAN repository](https://github.com/canfoundation/CAN) to install the required dependencies.

## Setup Producer Node
Clone the code repository:
```
git clone --single-branch --branch bp_node https://github.com/canfoundation/can-node
cd can-node
cd producer-node
```
Set the following configuration in ```start.sh``` ```genesis_start.sh``` ```hard_start.sh``` file:
```
BPACCOUNT = {Producer Name}
PUBKEY = {Public Key}
PRIKEY = {Private Key}
--http-server-address 127.0.0.1:{HTTP Port} \
--p2p-listen-endpoint 0.0.0.0:{P2P Port}\
--p2p-peer-address {Peer 1}
--p2p-peer-address {Peer 2}
--p2p-peer-address {Peer 3}
--p2p-peer-address {Peer 4}
```
Set permission to run the shell scripts:
```
sudo chmod 755 start.sh genesis_start.sh hard_start.sh stop.sh clean.sh
```
### Initiate Producer Node
Only run this script if you start for the first time or deleted blockchain folder:
```
./genesis_start.sh
```
Check block synchronization status:
```
cd blockchain
tail -f nodeos.log
```
### Stop Producer Node
To stop the node, run the following script:
```
./stop.sh
```
### Start Producer Node
To start the node again, run the following script:
```
./start.sh
```
If you run into an error like ```"perhaps we need to replay"```, run this script to replay all the transactions from the genesis block:
```
./hard_start.sh
```
### Clean Blockchain Data
If your blockchain data is faulty and need to be built again, follow the below sequence:
```
./stop.sh
./clean.sh
./genesis_start.sh
```

## Infrastructure Recommendation
At the minimum, we recommend to setup the cloud server with at least 3 layers as of below:
1. Full Node Layer: full nodes to relay blocks and release APIs to other backend services.
2. Seed Layer: peer seed nodes to establish VPN connections with trusted BPs.
3. Block Production Layer: where our BP nodes are located privately with a Master producing node and a Slave node to take over production in case the Master node is in a failure state.

![alt text](https://www.lucidchart.com/publicSegments/view/7b73f835-bacc-4cfb-a57c-e9ac079e110d/image.jpeg)
20 changes: 14 additions & 6 deletions genesis/genesis_start.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/bin/bash
DATADIR="./blockchain"
BPACCOUNT=
PUBKEY=EOS6yNeFEiMVartK5M6VZP5KB9vuj1Y4Lt5Xvyp2wGjpHzapdvjc1
PRIKEY=5KewLbtaCEAD8DFrgBfJF8y4BwVpoKGGoKJqLmrgTRB9jFt13xG

if [ ! -d $DATADIR ]; then
mkdir -p $DATADIR;
fi

nodeos \
--genesis-json $DATADIR"/../../genesis.json" \
--signature-provider EOS6pcdgzFGRXquEYJrrn4sJxGw5bGPZABiqWpyi1jRZp4PBUd6ud=KEY:5KWWqPKUxj1PN6vtJrssd2pbbKFk2m4WZLMHmf4Nowov5Xu9pYU \
--signature-provider $PUBKEY=KEY:$PRIKEY \
--plugin eosio::producer_plugin \
--plugin eosio::producer_api_plugin \
--plugin eosio::chain_api_plugin \
Expand All @@ -17,16 +20,21 @@ nodeos \
--data-dir $DATADIR"/data" \
--blocks-dir $DATADIR"/blocks" \
--config-dir $DATADIR"/config" \
--producer-name eosio \
--http-server-address 0.0.0.0:8888 \
--producer-name $BPACCOUNT \
--http-server-address 127.0.0.1:8888 \
--p2p-listen-endpoint 0.0.0.0:9010 \
--access-control-allow-origin=* \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors \
--enable-stale-production \
--p2p-peer-address localhost:9011 \
--p2p-peer-address localhost:9012 \
--p2p-peer-address localhost:9013 \
--chain-state-db-size-mb 8192 \
--pause-on-startup \
--p2p-peer-address 192.168.111.1:9010 \
--p2p-peer-address 192.168.111.2:9010 \
--p2p-peer-address 192.168.111.3:9010 \
--p2p-peer-address 192.168.111.4:9010 \
--p2p-peer-address 192.168.111.5:9010 \
--p2p-peer-address 192.168.111.6:9010 \
>> $DATADIR"/nodeos.log" 2>&1 & \
echo $! > $DATADIR"/eosd.pid"
20 changes: 14 additions & 6 deletions genesis/hard_start.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/bin/bash
DATADIR="./blockchain"
BPACCOUNT=
PUBKEY=EOS6yNeFEiMVartK5M6VZP5KB9vuj1Y4Lt5Xvyp2wGjpHzapdvjc1
PRIKEY=5KewLbtaCEAD8DFrgBfJF8y4BwVpoKGGoKJqLmrgTRB9jFt13xG

if [ ! -d $DATADIR ]; then
mkdir -p $DATADIR;
fi

nodeos \
--signature-provider EOS6pcdgzFGRXquEYJrrn4sJxGw5bGPZABiqWpyi1jRZp4PBUd6ud=KEY:5KWWqPKUxj1PN6vtJrssd2pbbKFk2m4WZLMHmf4Nowov5Xu9pYU \
--signature-provider $PUBKEY=KEY:$PRIKEY \
--plugin eosio::producer_plugin \
--plugin eosio::producer_api_plugin \
--plugin eosio::chain_api_plugin \
Expand All @@ -16,17 +19,22 @@ nodeos \
--data-dir $DATADIR"/data" \
--blocks-dir $DATADIR"/blocks" \
--config-dir $DATADIR"/config" \
--producer-name eosio \
--http-server-address 0.0.0.0:8888 \
--producer-name $BPACCOUNT \
--http-server-address 127.0.0.1:8888 \
--p2p-listen-endpoint 0.0.0.0:9010 \
--access-control-allow-origin=* \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors \
--enable-stale-production \
--p2p-peer-address localhost:9011 \
--p2p-peer-address localhost:9012 \
--p2p-peer-address localhost:9013 \
--chain-state-db-size-mb 8192 \
--pause-on-startup \
--p2p-peer-address 192.168.111.1:9010 \
--p2p-peer-address 192.168.111.2:9010 \
--p2p-peer-address 192.168.111.3:9010 \
--p2p-peer-address 192.168.111.4:9010 \
--p2p-peer-address 192.168.111.5:9010 \
--p2p-peer-address 192.168.111.6:9010 \
--hard-replay-blockchain \
>> $DATADIR"/nodeos.log" 2>&1 & \
echo $! > $DATADIR"/eosd.pid"
Expand Down
22 changes: 15 additions & 7 deletions genesis/start.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/bin/bash
DATADIR="./blockchain"
BPACCOUNT=
PUBKEY=EOS6yNeFEiMVartK5M6VZP5KB9vuj1Y4Lt5Xvyp2wGjpHzapdvjc1
PRIKEY=5KewLbtaCEAD8DFrgBfJF8y4BwVpoKGGoKJqLmrgTRB9jFt13xG

if [ ! -d $DATADIR ]; then
mkdir -p $DATADIR;
fi

nodeos \
--signature-provider EOS6pcdgzFGRXquEYJrrn4sJxGw5bGPZABiqWpyi1jRZp4PBUd6ud=KEY:5KWWqPKUxj1PN6vtJrssd2pbbKFk2m4WZLMHmf4Nowov5Xu9pYU \
--signature-provider $PUBKEY=KEY:$PRIKEY \
--plugin eosio::producer_plugin \
--plugin eosio::producer_api_plugin \
--plugin eosio::chain_api_plugin \
Expand All @@ -16,17 +19,22 @@ nodeos \
--data-dir $DATADIR"/data" \
--blocks-dir $DATADIR"/blocks" \
--config-dir $DATADIR"/config" \
--producer-name eosio \
--http-server-address 0.0.0.0:8888 \
--p2p-listen-endpoint 0.0.0.1:9010 \
--producer-name $BPACCOUNT \
--http-server-address 127.0.0.1:8888 \
--p2p-listen-endpoint 0.0.0.0:9010 \
--access-control-allow-origin=* \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors \
--enable-stale-production \
--p2p-peer-address localhost:9011 \
--p2p-peer-address localhost:9012 \
--p2p-peer-address localhost:9013 \
--chain-state-db-size-mb 8192 \
--pause-on-startup \
--p2p-peer-address 192.168.111.1:9010 \
--p2p-peer-address 192.168.111.2:9010 \
--p2p-peer-address 192.168.111.3:9010 \
--p2p-peer-address 192.168.111.4:9010 \
--p2p-peer-address 192.168.111.5:9010 \
--p2p-peer-address 192.168.111.6:9010 \
>> $DATADIR"/nodeos.log" 2>&1 & \
echo $! > $DATADIR"/eosd.pid"