Developers Forum for XinFin XDC Network

s4njk4n
s4njk4n

Posted on

[Solved] XDC mainnet docker container restarting loop

On adding --enable-0x-prefix to start-node.sh for a mainnet RPC, I'm ending up with the Docker container continually restarting. Is there something else I need to do to add the 0x prefix support and also get the node functional?

Steps performed were:
sudo ./docker-down.sh
sudo nano start-node.sh
Add --enable-0x-prefix and then save file
sudo ./docker-up.sh

Docker container is now in a restarting loop (see below for docker ps output)


start-node.sh content is as follows:

#!/bin/bash

if [ ! -d /work/xdcchain/XDC/chaindata ]
then
  wallet=$(XDC account new --password /work/.pwd --datadir /work/xdcchain | awk -F '[{}]' '{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 -F '[{}]' '{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}:xinfin_xdpos_hybrid_network_stats@stats.xinfin.network: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,net,shh,txpool,personal,web3,XDPoS --rpcvhosts "*"  --ws --wsaddr="0.0.0.0" --wsorigins "*" --wsport 8546 --wsapi admin,db,eth,debug,net,shh,txpool,personal,web3,XDPoS  --unlock "${wallet}" --password /work/.pwd --mine --gasprice "1" --targetgaslimit "420000000" --verbosity 3 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log --enable-0x-prefix
Enter fullscreen mode Exit fullscreen mode

sudo docker ps outputs:

CONTAINER ID   IMAGE                         COMMAND                 CREATED         STATUS                         PORTS     NAMES
c18ac4ebf76d   xinfinorg/xdposchain:v1.5.0   "bash /work/entry.sh"   2 minutes ago   Restarting (1) 7 seconds ago             mainnet_xinfinnetwork_1
Enter fullscreen mode Exit fullscreen mode

Discussion (2)

Collapse
s4njk4n profile image
s4njk4n Author

Actually please ignore. I found the error. The option to enable 0x prefix was in the wrong place after the pipe character. All fixed by moving along before the |

I'll leave this post up in case anyone else does the same thing.

Cheers

Collapse
s4njk4n profile image
s4njk4n Author

Just adding further information with the solution. The --enable-0x-prefix flag works when placed at the start of the XDC startup command in start-node.sh

Here is a working example:
XDC --enable-0x-prefix --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,net,shh,txpool,personal,web3,XDPoS --rpcvhosts "" --ws --wsaddr="0.0.0.0" --wsorigins "*" --wsport 8546 --wsapi admin,db,eth,debug,net,shh,txpool,personal,web3,XDPoS --unlock "${wallet}" --password /work/.pwd --mine --gasprice "1" --targetgaslimit "420000000" --verbosity 3 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log