forked from XinFinOrg/XinFin-Node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-node.sh
executable file
·34 lines (31 loc) · 1.46 KB
/
start-node.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
if [ ! -d /work/xdcchain/XDC/chaindata ]
then
wallet=$(XDC account new --password /work/.pwd --datadir /work/xdcchain | awk -v FS="({|})" '{print $2}')
echo "Initalizing Genesis Block"
coinbaseaddr="$wallet"
coinbasefile=/work/xdcchain/coinbase.txt
touch $coinbasefile
if [ -f "$coinbasefile" ]
then
echo "$coinbaseaddr" > "$coinbasefile"
fi
XDC --datadir /work/xdcchain init /work/genesis.json
else
wallet=$(XDC account list --datadir /work/xdcchain| head -n 1 | awk -v FS="({|})" '{print $2}')
fi
input="/work/bootnodes.list"
bootnodes=""
while IFS= read -r line
do
if [ -z "${bootnodes}" ]
then
bootnodes=$line
else
bootnodes="${bootnodes},$line"
fi
done < "$input"
INSTANCE_IP=$(curl https://checkip.amazonaws.com)
netstats="${INSTANCE_NAME}:[email protected]:3000"
echo "Starting nodes with $bootnodes ..."
XDC --ethstats ${netstats} --bootnodes ${bootnodes} --syncmode ${NODE_TYPE} --datadir /work/xdcchain --networkid 50 -port 30303 --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 --rpcport 8545 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS --rpcvhosts "*" --ws --wsaddr="0.0.0.0" --wsorigins "*" --wsport 8546 --wsapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS --unlock "${wallet}" --password /work/.pwd --mine --gasprice "1" --targetgaslimit "420000000" --verbosity 2 2>&1 >>/work/xdcchain/xdc.log | tee --append /work/xdcchain/xdc.log