Skip to content

Commit

Permalink
add bootnode
Browse files Browse the repository at this point in the history
  • Loading branch information
pccr10001 committed Jan 28, 2019
1 parent 1a24ad0 commit 608cf2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 15 additions & 9 deletions Nnodes/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ COLOR_WHITE='\e[1;37m';
# One Docker container will be configured for each IP address in $ips

# Port prefix
rpc_start_port=22000
node_start_port=25000
raft_start_port=28000
rpc_start_port=23000
node_start_port=26000
raft_start_port=29000

# VIP Subnet
subnet="172.13.0.0/16"
subnet="172.14.0.0/16"

# Total nodes to deploy
total_nodes=5

# Signer nodes for Clique and IBFT
signer_nodes=7
signer_nodes=4

# Consensus engine ex. raft, clique, istanbul
consensus=raft
consensus=clique

# Block period for Clique and IBFT
block_period=1
block_period=0

# Docker image name
image=quorum
Expand Down Expand Up @@ -144,6 +144,8 @@ nodekeys=""

echo -e "${COLOR_WHITE}[2] Creating Enodes and static-nodes.json.${COLOR_RESET}"

bootnode="\""

echo "[" > static-nodes.json
n=1
for ip in ${ips[*]}
Expand All @@ -163,11 +165,14 @@ do

# Add the enode to static-nodes.json
echo ' "enode://'$enode'@'$ip':30303?raftport=50400"'$sep >> static-nodes.json
bootnode="${bootnode}enode:\\/\\/${enode}@${ip}:30303$sep"
echo -e " - ${COLOR_GREEN}Node #${n}${COLOR_RESET} with nodekey: ${COLOR_YELLOW}${enode:0:8}...${enode:120:8}${COLOR_RESET} configured. (IP: ${COLOR_BLUE}${ip}${COLOR_RESET})"

let n++
done

bootnode="${bootnode}\""

echo "]" >> static-nodes.json

#### Create accounts, keys and genesis.json file #######################
Expand Down Expand Up @@ -344,7 +349,8 @@ do
sed -i 's/full/full --mine --minerthreads 1 /g' $qd/start-node.sh
fi
fi


sed -i "s/{bootnode}/--bootnodes ${bootnode}/g" $qd/start-node.sh
let n++
done
rm -rf genesis.json static-nodes.json
Expand Down Expand Up @@ -372,7 +378,7 @@ do
ipv4_address: '$ip'
ports:
- $((n+rpc_start_port)):8545
- $((n+node_start_port)):9000
- $((n+node_start_port)):30303
- $((n+raft_start_port)):50400
user: '$uid:$gid'
EOF
Expand Down
2 changes: 1 addition & 1 deletion Nnodes/templates/start-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set -e
### Configuration Options
TMCONF=/qdata/tm.conf

GETH_ARGS="--datadir /qdata/dd --raft --rpc --rpcaddr 0.0.0.0 --rpcvhosts=* --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,clique,raft,istanbul --nodiscover --unlock 0 --password /qdata/passwords.txt --networkid 10"
GETH_ARGS="--datadir /qdata/dd --raft --rpc --rpcaddr 0.0.0.0 --rpcvhosts=* --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,clique,raft,istanbul --unlock 0 --password /qdata/passwords.txt --networkid 10 {bootnode}"

if [ ! -d /qdata/dd/geth/chaindata ]; then
echo "[*] Mining Genesis block"
Expand Down

0 comments on commit 608cf2e

Please sign in to comment.