Skip to content

Low Peer Count on Mainnet Node #2348

Description

@jonathan-nansen

Our validator node is only peering with 1-2 peers despite having all bootnodes configured.

Node info:

  • Enode: enode://4b689c352e3c2fc779601a08cfc85e03175058825f88f60ac321bc726c68b6a8d05f47cab912cc15ec26a165d25c275d8dc2d4f0f8a6f0c132bae95ac79052c6@135.125.170.224:30302
  • Docker image: xinfinorg/xdposchain:v2.6.8

docker-compose.yml:

version: "3"
services:
  xdc-node:
    container_name: xdc-mainnet-node
    image: xinfinorg/xdposchain:v2.6.8
    restart: always
    stop_grace_period: 5m
    entrypoint: bash /opt/blockchain/start.sh
    volumes:
      - "/blockchain/xdc/xinfin/xdcchain:/opt/blockchain/xdcchain"
      - "/blockchain/xdc/xinfin/keystore:/opt/blockchain/keystore"
      - "/blockchain/xdc/xinfin/genesis.json:/opt/blockchain/genesis.json"
      - "/blockchain/xdc/xinfin/start.sh:/opt/blockchain/start.sh"
      - "/blockchain/xdc/xinfin/bootnodes.list:/opt/blockchain/bootnodes.list"
      - "/blockchain/xdc/xinfin/.pwd:/opt/blockchain/.pwd"
      - "/etc/localtime:/etc/localtime:ro"
    ports:
      - "30302:30302/tcp"
      - "30302:30302/udp"
      - "10.252.0.130:6061:6060"
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "5"

start.sh:

#!/bin/bash

WORK_DIR="/opt/blockchain"
KEYSTORE_DIR="${WORK_DIR}/keystore"

BIN="XDC-mainnet"

# Create account only if keystore is empty (survives chaindata wipes)
if [ -z "$(ls -A ${KEYSTORE_DIR} 2>/dev/null)" ]; then
    echo "No account found, creating one..."
    ${BIN} account new --password "${WORK_DIR}/.pwd" --keystore "${KEYSTORE_DIR}"
fi

# Init genesis only if chaindata is absent
if [ ! -d "${WORK_DIR}/xdcchain/XDC/chaindata" ]; then
    echo "Initializing Genesis Block"
    ${BIN} init --datadir "${WORK_DIR}/xdcchain" "${WORK_DIR}/genesis.json"
fi

wallet=$(${BIN} account list --keystore "${KEYSTORE_DIR}" 2>/dev/null | head -n 1 | awk -F '[{}]' '{print $2}')
coinbasefile="${WORK_DIR}/xdcchain/coinbase.txt"
echo "${wallet}" > "${coinbasefile}"

bootnodes=""
while IFS= read -r line; do
    if [ -z "${bootnodes}" ]; then
        bootnodes=$line
    else
        bootnodes="${bootnodes},$line"
    fi
done < "${WORK_DIR}/bootnodes.list"

netstats="nansen:xinfin_xdpos_hybrid_network_stats@stats.xinfin.network:3000"

echo "Starting XDC node (chain_id=50, port=30302, sync=full, bootnodes=$(echo "$bootnodes" | tr ',' '\n' | wc -l))..."
args=(
    --ethstats "${netstats}"
    --bootnodes "${bootnodes}"
    --syncmode "full"
    --gcmode "full"
    --datadir "${WORK_DIR}/xdcchain"
    --keystore "${KEYSTORE_DIR}"
    --networkid 50
    --port 30302
    --nat extip:135.125.170.224
    --unlock "${wallet}"
    --password "${WORK_DIR}/.pwd"
    --gasprice "1"
    --targetgaslimit "420000000"
    --verbosity 2
    --store-reward
    --metrics
    --metrics.addr "0.0.0.0"
    --metrics.port 6060
)

args+=(--http=false)
args+=(--ws=false)

${BIN} "${args[@]}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions