Skip to content

lelerukjaymoh/How-to-sync-a-BSC-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 

Repository files navigation

How To Sync a BSC Node

System requirements

  • Desktop or laptop hardware running recent versions of Mac OS X, Windows, or Linux.
  • 2TB of free disk space, accessible at a minimum read/write speed of 100 MB/s.
  • 8 cores of CPU and 16 gigabytes of memory (RAM).
  • A broadband Internet connection with upload/download speeds of at least 1 megabyte per second Your full node has to run at least 4 hours per 24 hours in order to catch up with Binance Chain More hours will be better, run your node continuously for best results.


The specifications listed above are high end but will ensure you have a smooth sync process with fewer prunning. If you want the minimum specification requirements have a look here Minimum System Requirements.

Server recommendation: Hetzner AX61-NVMe


Sync Process

  1. Download the latest geth and mainnet using wget from the link below https://github.com/bnb-chain/bsc/releases - latest version (as of 3oth Jan 2023) is 1.1.18
wget https://github.com/bnb-chain/bsc/releases/download/v1.1.18/geth_linux
wget https://github.com/bnb-chain/bsc/releases/download/v1.1.18/mainnet.zip
  1. Make the geth_linux downloaded executable
chmod +x geth_linux
  1. Unzip the mainnet.zip file. You may need to install unzip if you dont have it in your machine
unzip mainnet.zip
  1. Generate the genesis block by runnin the command below
./geth_linux --datadir ./mainnet init genesis.json
  1. Download the latest snapshot from https://github.com/bnb-chain/bsc-snapshots by using the command below
wget -q -O - <snapshot URL> | tar -I lz4 -xvf -
  1. Replacing the with "THE_URL_TO_THE_LATEST_SNAPSHOT" (quotation marks included)
  2. Once downloaded, it will be extracted to a folder named server folder on the downloaded folder.
  3. Delete the chaindata and triecache data from the datadir folder (mainnet) if it already exists to sync afresh. Use the commands provided below
rm -rf mainnet/geth/chaindata
rm -rf mainnet/geth/triecache
  1. Move the chaindata and triecache data of the downloaded snapshot to your datadir (mainnet) using the commands below
mv server/data-seed/geth/chaindata mainnet/geth/chaindata
mv server/data-seed/geth/triecache mainnet/geth/triecache
  1. After moving the snapshot data, start the geth using the command below.
./geth_linux --config ./config.toml --datadir ./mainnet --cache 100000 --rpc.allow-unprotected-txs --txlookuplimit 0 --http --maxpeers 100 --ws --syncmode=full --snapshot=false --diffsync



Note

Geth syncing should be run in a screen session to ensure the process continues even after the ssh session is closed
- If you are using the latest snapshot and notice that the age more than 2 years, most likely you have an eror in you sync setup
- The first place to troubleshoot in such an issue is check that you have initailised the gennesis config correctly. Make sure that the datadir when initialisng the genesis config is correct.
- In case you want to make a change to the the config.toml file or any other config file, just stop the node sync by control + C. After making the change start the node again with the command for starting the node. The change will pick up
- The ip address for the websocket is not include in the config.toml. You need to manually add it

						HAPPY SYNCING

About

Steps, issues and advice on running a BSC geth node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published