# Linux
wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_linux |cut -d\" -f4)
mv geth_linux geth
chmod -v u+x geth
# mainnet
wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
unzip mainnet.zip
wget -O geth.tar.lz4 https://snapshots.48.club/geth.full.37756285.tar.zst
tar -I lz4 -xvf geth.tar.lz4
mv server/data-seed/geth/chaindata node/geth/chaindata
mv server/data-seed/geth/chaindata node/geth/triecache
./geth --datadir ./node init ./genesis.json
Note: This assumes geth is in current directory
- Create a file named
modify_chainid.sh
and paste the below script
#!/bin/bash
if ! command -v jq &> /dev/null; then
echo "Error: jq is not installed. For Debian based systems, run sudo apt-get install jq"
exit 1
fi
if [ ! -f genesis.json ]; then
echo "Error: genesis.json not found in the current directory."
exit 1
fi
read -p "Enter the new chain ID: " new_chain_id
jq --arg new_chain_id "$new_chain_id" '.config.chainId = $new_chain_id' genesis.json > tmp.json && mv tmp.json genesis.json
if [ ! -f config.toml ]; then
echo "Error: config.toml not found in the current directory."
exit 1
fi
sed -i "s/NetworkId = .*/NetworkId = $new_chain_id/" config.toml
echo "Chain ID modified successfully."
-
This script assumes that
genesis.json
andconfig.toml
are in the directory where you unzippedmainnet.zip
. -
Run the below command and enter chain id.
chmod +x modify_chainid.sh
./modify_chainid.sh
Run the below command with the chainID as in config.toml
.
## start a full node
./geth --config ./config.toml --datadir ./node --cache 8000 --networkid=<CHAIN_ID> --rpc.allow-unprotected-txs --history.transactions 0 --syncmode=full --db.engine=pebble