How to Run a Binance Smart Chain Node

December 29, 2021

Overview

Binance Smart Chain, BSC for short, is a blockchain that seeks to provide both an alternative and extension to the Ethereum Blockchain. It has done this through several clever implementations that took place during the building of the platform. This guide will walk you through the process of how to run your very own BSC node.

Prerequisites:
Taken from the Binance docs for node requirements 
  1.  A Virtual Private Server (VPS) running either Mac OS X or Linux
  2. 1 TB of free disk space, SSD
  3. 8 cores of CPU and 16 gigabytes of RAM
  4. An internet connection with upload/download speeds of at least 1 MB/s

What is Binance Smart Chain?

Great question! BSC is a standalone blockchain designed to take some of the mature tools from the Ethereum Ecosystem, such as the Ethereum Virtual Machine (EVM). It took this singular block from Ethereum and built on top of it with a few goals in mind. 

It wanted to be more environmentally friendly; it accomplished this by moving the consensus protocol to a blend of Proof-of-Authority and Delegated Proof of Stake. They named this new protocol "Proof of Staked Authority." The designers of BSC also wanted their new blockchain to be more performant than its Ethereum cousin. 

The project's overall goals were to reduce blocking time, shorten time to confirm transactions, use a staking-based governance network, and achieve cross-compatibility with Ethereum. BSC launched its mainnet in April of 2019.

If you would like more details on what influenced the design and decisions of those who made the system or the underlying algorithms, you should their white paper.

What Nodes Do

Perhaps after seeing the Binance Smart Chain's goals, you want to participate in the network. To accomplish this noble deed, you need to run a BSC Full Node. There are two different kinds of Full Nodes: Witness Nodes and Validator Nodes. 

Witness Nodes observe but do not participate in the consensus process. They serve to duplicate data and work as additional messengers in the network to serve up the current chain state. 

Validator Nodes on the other hand, do everything that Witness Nodes do, but they also are responsible for validating the transactions. In addition to the transaction validation, they also work to produce new blocks. You can imagine Validator Nodes as the counterpart to an Ethereum/Bitcoin "miner." In the next section I will walk you through how to setup and run a Witness Node.

Configuring the Project

The process of running a Validator Node compared to a Witness Node is similar. In this guide, we will be running a Witness Node as it is more accessible. This is because hardware requirements for a Validator Node are higher than its Witness Node sibling. You can find hardware requirements for both here.

All of the following commands should be done in your VPS and not your local machine.

The first thing you will need to do is install a recent version of Go.

Here are the commands to install Golang on a Linux  64-bit system:

configuring the project

Copy
wget https://golang.org/dl/go1.16.5.darwin-amd64.pkg
## set your GOPATH
export PATH=$PATH:/usr/local/go/bin
## confirm it works by running
go version


After installing Go you will want to set up your project directory. Run the following command to do so:

configuring the project

Copy
git clone https://github.com/binance-chain/bsc 
cd bsc
make geth


The next thing you will need to do is download a snapshot of the most up-to-date chain data and place it in your home folder.  You can find the data here.  After you have it downloaded, you will run the following command substituting the "NAME_OF_YOUR_HOME" with your home directory.

configuring the project

Copy
unzip geth.zip -d /NAME_OF_YOUR_HOME/node &

The snapshot will considerably speed up your node's syncing; BSC nodes are enormous compared to other blockchain nodes. It could take weeks to sync a node to tip if you didn't perform this step.

With your project directory up and snapshot downloaded, you will now download the config files and set them up.

The commands below will download the relevant files depending on whether you want to run a  node on the mainnet or testnet.

configuring the project

Copy
## mainet
wget https://github.com/binance-chain/bsc/releases/download/v1.1.0-beta/mainnet.zip
unzip mainnet.zip 
## testnet
wget https://github.com/binance-chain/bsc/releases/download/v1.1.0-beta/testnet.zip
unzip testnet.zip

This will extract a config.toml and a genesis.json file into your project directory.

How to run a Witness Node

With all of the initial configuration done, its time to run a node!
The next step is to write your genesis state onto your VPS with the following command.

how to run a witness node

Copy
geth --datadir node init genesis.json

Upon running the command above you should see an output similar to this:

how to run a witness node

Copy
INFO [07-02|18:28:08.337] Maximum peer count                       ETH=50 LES=0 total=50
INFO [07-02|18:28:08.337] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [07-02|18:28:08.337] Set global gas cap                       cap=50,000,000
INFO [07-02|18:28:08.337] Allocated cache and file handles         database=/root/bsc/node/geth/chaindata cache=16.00MiB handles=16
INFO [07-02|18:28:08.353] Persisted trie from memory database      nodes=15 size=2.32KiB time="70.575µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [07-02|18:28:08.353] Successfully wrote genesis state         database=chaindata                     ha=0d2184..d57b5b
INFO [07-02|18:28:08.354] Allocated cache and file handles         database=/root/bsc/node/geth/lightchaindata cache=16.00MiB handles=16
INFO [07-02|18:28:08.366] Persisted trie from memory database      nodes=15 size=2.32KiB time="29.71µs"  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [07-02|18:28:08.366] Successfully wrote genesis state         database=lightchaindata                     ha=0d2184..d57b5b


After running the command above, you will open your config.toml file and replace it with the following:

how to run a witness node

Copy
[Eth]
NetworkId = 56
NoPruning = false
NoPrefetch = false
LightPeers = 100
UltraLightFraction = 75
TrieTimeout = 100000000000
EnablePreimageRecording = false
EWASMInterpreter = ""
EVMInterpreter = ""

[Eth.Miner]
GasFloor = 30000000
GasCeil = 40000000
GasPrice = 1000000000
Recommit = 10000000000
Noverify = false

[Eth.TxPool]
Locals = []
NoLocals = true
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1000000000
PriceBump = 10
AccountSlots = 512
GlobalSlots = 10000
AccountQueue = 256
GlobalQueue = 5000
Lifetime = 10800000000000


[Node]
IPCPath = "geth.ipc"
HTTPHost = "localhost"
NoUSB = true
InsecureUnlockAllowed = false
HTTPPort = 8545
HTTPVirtualHosts = ["localhost"]
HTTPModules = ["eth", "net", "web3", "txpool", "parlia"]
WSPort = 8546
WSModules = ["net", "web3", "eth"]

[Node.P2P]
MaxPeers = 30
NoDiscovery = false
BootstrapNodes = ["enode://1cc4534b14cfe351ab740a1418ab944a234ca2f702915eadb7e558a02010cb7c5[email protected]52.71.43.172:30311","enode://28b1d16562dac280dacaaf45d54516b85bc6c994252a9825c5cc4e080d3e53446[email protected]34.246.65.14:30311","enode://5a7b996048d1b0a07683a949662c87c09b55247ce774aeee10bb886892e586e3c[email protected]35.73.137.11:30311"]
StaticNodes = ["enode://f3cfd69f2808ef64838abd8786342c0b22fdd28268703c8d6812e26e109f9a7cb[email protected]18.180.28.21:30311","enode://ae74385270d4afeb953561603fcedc4a0e755a241ffdea31c3f751dc8be5bf29c[email protected]54.178.30.104:30311","enode://d1cabe083d5fc1da9b510889188f06dab891935294e4569df759fc2c4d684b3b4[email protected]54.238.28.14:30311","enode://f420209bac5324326c116d38d83edfa2256c4101a27cd3e7f9b8287dc8526900f[email protected]54.178.62.117:30311","enode://c0e8d1abd27c3c13ca879e16f34c12ffee936a7e5d7b7fb6f1af5cc75c6fad704[email protected]54.65.247.12:30311","enode://f1b49b1cf536e36f9a56730f7a0ece899e5efb344eec2fdca3a335465bc4f619b[email protected]13.114.199.41:30311","enode://4924583cfb262b6e333969c86eab8da009b3f7d165cc9ad326914f576c575741e[email protected]18.180.17.171:30311","enode://4d041250eb4f05ab55af184a01aed1a71d241a94a03a5b86f4e32659e1ab1e144[email protected]54.178.99.222:30311","enode://b5772a14fdaeebf4c1924e73c923bdf11c35240a6da7b9e5ec0e6cbb95e783276[email protected]54.170.158.102:30311","enode://f329176b187cec87b327f82e78b6ece3102a0f7c89b92a5312e1674062c6e89f7[email protected]34.253.94.130:30311","enode://cbfd1219940d4e312ad94108e7fa3bc34c4c22081d6f334a2e7b36bb28928b568[email protected]54.75.11.3:30311","enode://c64b0a0c619c03c220ea0d7cac754931f967665f9e148b92d2e46761ad9180f5e[email protected]54.216.208.163:30311","enode://352a361a9240d4d23bb6fab19cc6dc5a5fc6921abf19de65afe13f1802780aecd[email protected]79.125.105.65:30311","enode://bb683ef5d03db7d945d6f84b88e5b98920b70aecc22abed8c00d6db621f784e42[email protected]54.195.127.237:30311","enode://11dc6fea50630b68a9289055d6b0fb0e22fb5048a3f4e4efd741a7ab09dd79e78[email protected]46.137.182.25:30311","enode://21530e423b42aed17d7eef67882ebb23357db4f8b10c94d4c71191f52955d97dc[email protected]54.216.119.18:30311","enode://d61a31410c365e7fcd50e24d56a77d2d9741d4a57b295cc5070189ad90d0ec749[email protected]34.204.129.242:30311","enode://bb91215b1d77c892897048dd58f709f02aacb5355aa8f50f00b67c879c3dffd7e[email protected]75.101.197.198:30311","enode://786acbdf5a3cf91b99047a0fd8305e11e54d96ea3a72b1527050d3d6f8c9fc027[email protected]107.23.90.162:30311","enode://4653bc7c235c3480968e5e81d91123bc67626f35c207ae4acab89347db675a627[email protected]54.144.170.236:30311","enode://c6ffd994c4ef130f90f8ee2fc08c1b0f02a6e9b12152092bf5a03dd7af9fd3359[email protected]54.147.151.108:30311","enode://99b07e9dc5f204263b87243146743399b2bd60c98f68d1239a3461d09087e6c41[email protected]54.81.225.170:30311","enode://1479af5ea7bda822e8747d0b967309bced22cad5083b93bc6f4e1d7da7be067cd[email protected]52.7.247.132:30311","enode://43562d35f274d9e93f5ccac484c7cb185eabc746dbc9f3a56c36dc5a9ef05a328[email protected]35.73.15.198:30311","enode://08867e57849456fc9b0b00771f53e87ca6f2dd618c23b34a35d0c851cd484a4b7[email protected]35.74.39.234:30311"]
ListenAddr = ":30311"
EnableMsgEvents = false

[Node.HTTPTimeouts]
ReadTimeout = 30000000000
WriteTimeout = 30000000000
IdleTimeout = 120000000000

One thing to note here is if you already know of several other reliable nodes you may place them under the StaticNodes array. Any nodes in this array will be connected to automatically upon booting up of the node.

Then to start your Witness node you will run the following command.

how to run a witness node

Copy
## start a full node
geth --config ./config.toml --datadir ./node --cache 18000 --rpc.allow-unprotected-txs --txlookuplimit 0


If you have the hardware requirements running the following will run a Validator Node instead of a Witness Node:

how to run a witness node

Copy
## generate the consensus key and input the password
geth account new --datadir ./node echo {your-password} > password.txt
geth --config ./config.toml --datadir ./node --syncmode snap -unlock {your-validator-address} --password password.txt --mine --allow-insecure-unlock --cache 18000

After running these you should see in your terminal's logs that you are starting to look for peers, and will begin syncing to their data. You will need some patience after running this command, as it can take several hours to sync a node all the way to tip.

Conclusion

Congratulations! If all of the steps were followed, and you were able to connect to other peers to sync your node, you will be successfully running your own BSC Full Node. Depending on your local region you may find it easier or harder to find peers to share data with to sync your chain all the way to tip. The key in this process is patience.

If you let the program run its course you should eventually find success. You are now the master of your own blockchain destiny. You can send transactions to be confirmed to the blockchain without relying on others, as you can route all of your traffic to the node that you are personally running!

Subscribe to our newsletter for more articles and guides on Ethereum. If you have any feedback, feel free to reach out to us via Twitter. You can always chat with us on our Discord community server, featuring some of the coolest developers you’ll ever meet :)

Related articles 9

How to run a OpenEthereum (ex-parity client) Node
Dec 29, 2021

Ethereum nodes are computers participating in Ethereum blockchain network, these nodes are actual computers running software that verifies, stores, and sometimes creates blocks. The actual software is called a "client" and it allows us to interact with the blockchain...

Continue reading
Introduction to Ethereum Rollups
Dec 29, 2021

Ethereum, the most popular blockchain, has seen scaling issues for quite a long time now. With high gas fees due to congestion being the primary pain point. With the increasing cost to use the network, a plethora of scaling solutions have emerged. Today in this guide, we...

Continue reading
How to install and run a Prysm Beacon node
Dec 29, 2021

Even if you're a newbie, rookie, or a pro in Ethereum it really excites all of us to see these developments in Ethereum. Whether it's all the hard forks like Istanbul, Atlantis, etc. or the development of Ethereum 2.0 - there is a lot to keep up with.In this...

Continue reading
How to run Expedition Block Explorer
Apr 12, 2022

In this article, we will talk about how to install and run the Expedition Ethereum Block explorer. While playing with the Ethereum blockchain network one might need to look up transactions, tokens, addresses, or prices. To accomplish these...

Continue reading
How to run Nethermind node
Dec 29, 2021

To run an Ethereum node without any problems, it is essential to choose a good node client. Nethermind is one of the oldest and most trusted Ethereum node clients. In this guide, let’s see how we can launch a Nethermind node.

Continue reading
How to run a Hyperledger Besu node
Dec 29, 2021

As the Ethereum network continues to grow, the need for an enterprise-ready Ethereum client arises. Hyperledger Besu is an enterprise-friendly Ethereum client that can implement both public and private permissioned networks. This guide will cover the requirements to run...

Continue reading
How to install and run a Geth node
Mar 23, 2022

Ethereum nodes are computers participating in Ethereum blockchain network. These nodes are actual computers running software that verifies, stores, and sometimes creates blocks. The actual software is called a "client," and it allows us to interact with the blockchain...

Continue reading
Ethereum full node vs archive node
Apr 12, 2022

If the Ethereum network is to be seen as a globally distributed computer, then nodes provide computational power and resources to this computer. In this guide, we’ll understand more about Ethereum full nodes and archive nodes then explore the difference between them.

Continue reading
How to Use Laika with QuickNode
Apr 22, 2022

Developers spend most of their time writing code, testing, and fixing bugs. A lot of the time spent with these tasks can be simplified by using a tool like Laika. Laika is a Web3 development tool that aims to improve the developer experience when interacting with the...

Continue reading