Tutorial: How to Launch a Full Node with Erigon on BNB Smart Chain

Corey W.Corey W.
4 min read

Introduction

This tutorial will demonstrate the following processes:

  1. Configuring the remote server to run a full node.
  2. Building the Erigon Client on Binance Smart Chain from the source code.
  3. Using Erigon to deploy the full node on Binance Smart Chain.

00 Getting started

0.1 Essential hardware

SpecificationsHardware Requirements
SystemMac, Linux, or Windows machine with the latest operating system (OS) installed
Server OSLinux Ubuntu
Free Hard Drive Space2 TB
RAM16 GB

0.2 Essential software

SpecificationsSoftware Requirements
Terminal EmulatorLinux: Terminal (native) - Mac OS: Terminal (native), Termius (free/paid) - Windows: Windows Terminal (native), PuTTy (free)
Recommended SettingsSSH Enabled, TDP/UDP traffic enabled
Virtual Machine (Optional)Ubuntu Desktop, Ubuntu Server

0.3 Enabling / disabling Secure Shell (SSH)

To access the remote server, the user must enable Secure Shell (SSH) on their system.

# Enable SSH
sudo systemsetup -setremotelogin on
Password: [*****]   # System password
# Disable SSH
sudo systemsetup -setremotelogin off

01 Updating and configuring the server

1.1 Connect to the server via SSH

# Log in with your server admin credentials

ssh <your_username>@<server_ip_address>
Password: [*****]

Tip:

# To suspend the connection...
CTRL+Z  # For Windows/Linux
CMD+Z   # For Mac

1.2 System updates and installations

1.2.1 Run Linux updates

# Update Linux OS, upgrade packages, remove outdated programs
sudo apt update && sudo apt-dist upgrade -y && sudo apt autoremove -y

1.2.2 Install Go – (Get it Here)

# Download & extract the latest version of Go (current: v1.17.8)
wget -c https://go.dev/dl/go1.17.8.linux-amd64.tar.gz && sudo tar -C /usr/local -xzf go1.17.8.linux-amd64.tar.gz
# Create a new directory
# Set the $GOPATH environment variable
# Set the $PATH variable to include $GOROOT and $GOPATH

mkdir ~/.go
GOROOT=/usr/local/go && GOPATH=~/.go && PATH=$PATH:$GOROOT/bin:$GOPATH/bin
# Replace existing Go version with the latest version
sudo update-alternatives --install "/usr/bin/go" "go" "/usr/local/go/bin/go" 0 && update-alternatives --set go /usr/local/go/bin/go
# Check for updated version
go version

Go version screenshot

1.2.3 Create the server's home folder

mkdir ~/srv/svc && cd srv/svc

1.2.4 Install the essential Ubuntu packages

# Run as super ('sudo') user

apt install snap
apt install npm
apt install git
apt install make
apt install mdadm

# Install Axel with Snap package

snap install axel

02 Building the Erigon client

2.1 Install Build essentials

apt install build-essential

2.2 Clone the Erigon repository

git clone https://github.com/ledgerwatch/erigon --recursive

github repo

2.3 Create a new folder to run Erigon

mkdir erigon && cd erigon
make all

2.4 Review the Erigon files

cd build/bin
echo $PATH
ls -ai

Erigon Directory

2.5 Copy the Erigon files to the local directory

sudo cp ./* /usr/local/bin

2.6 Move back into the Erigon folder

cd ~/srv/svc/erigon/
cd ..

2.7 Verify the launch path

which erigon

2.8 Show Erigon commands

erigon --help

03 Running the BSC node with Erigon

3.1 Update your erver's security settings

3.1.1 Block unauthorized access with Fail2Ban

sudo apt install fail2ban -y

3.1.2 Activate Ubuntu firewall

# Check the Ubuntu Firewall (ufw) status
# Activate Ubuntu Firewall

sudo ufw status
sudo ufw allow ssh

UFW

3.2 Sync with Binance Smart Chain

This step will likely take a while to complete.

3.2.1 Sync normally

erigon --chain=bsc --datadir=/srv/svc --metrics --metrics.addr=0.0.0.0 --metrics.port=6060 --private.api.addr=0.0.0.0:9090 --pprof --pprof.addr=0.0.0.0 --pprof.port=6061

3.2.2 Sync in the background

nohup bash -c 'erigon --chain=bsc --datadir=/srv/svc --metrics --metrics.addr=0.0.0.0 --metrics.port=6060 --private.api.addr=0.0.0.0:9090 --pprof --pprof.addr=0.0.0.0 --pprof.port=6061'

BSC Sync

3.3 Monitor your node's performance with NetData (optional)

  1. Register for a free account.
  2. Log into the user portal and select "Connect Nodes."
  3. Copy the provided script and run it in the terminal.
wget -O /tmp/netdata-kickstart.sh...

NetData

0
Subscribe to my newsletter

Read articles from Corey W. directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Corey W.
Corey W.