Run a Full Node using Binaries
This tutorial guides you through starting and running a full node using binaries. For the system requirements, see the Minimum Technical Requirements guide.
Steps in this guide involve waiting for the Heimdall and Bor services to fully sync. This process takes several days to complete.
Please use snapshots for faster syncing without having to sync over the network. For detailed instructions, see Snapshot Instructions for Heimdall and Bor.
For snapshot download links, see the Polygon Chains Snapshots page.
Overview
- Prepare the machine
- Install Heimdall and Bor binaries on the full node machine
- Set up Heimdall and Bor services on the full node machine
- Configure the full node machine
- Start the full node machine
- Check node health with the community
You have to follow the exact outlined sequence of actions, otherwise you will run into issues.
Install build-essential
This is required for your full node. In order to install, run the below command:
sudo apt-get update
sudo apt-get install build-essential
Install Binaries
Polygon node consists of 2 layers: Heimdall and Bor. Heimdall is a tendermint fork that monitors contracts in parallel with the Ethereum network. Bor is basically a Geth fork that generates blocks shuffled by Heimdall nodes.
Both binaries must be installed and run in the correct order to function properly.
Heimdall
Install the latest version of Heimdall and related services. Make sure you checkout to the correct release version. Note that the latest version, Heimdall v.0.3.0, contains enhancements such as:
- Restricting data size in state sync txs to:
- 30Kb when represented in bytes
- 60Kb when represented as string
- Increasing the delay time between the contract events of different validators to ensure that the mempool doesn't get filled very quickly in case of a burst of events which can hamper the progress of the chain.
The following example shows how the data size is restricted:
Data - "abcd1234"
Length in string format - 8
Hex Byte representation - [171 205 18 52]
Length in byte format - 4
To install Heimdall, run the below commands:
curl -L https://raw.githubusercontent.com/maticnetwork/install/main/heimdall.sh | bash -s -- <heimdall_version> <network_type> <node_type>
heimdall_version: valid v0.3+ release tag from https://github.com/maticnetwork/heimdall/releases
network_type: mainnet
and mumbai
node_type: sentry
That will install the heimdalld
and heimdallcli
binaries. Verify the installation by checking the Heimdall version on your machine:
heimdalld version --long
Configure heimdall seeds (Mainnet)
sed -i 's|^seeds =.*|seeds = "[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656"|g' /var/lib/heimdall/config/config.toml
chown heimdall /var/lib/heimdall
Configure heimdall seeds (Mumbai)
sed -i 's|^seeds =.*|seeds = "[email protected]:26656,[email protected]:26656,[email protected]:26656"|g' /var/lib/heimdall/config/config.toml
chown heimdall /var/lib/heimdall
Bor install
Install the latest version of Bor, based on valid v0.3+ released version.
curl -L https://raw.githubusercontent.com/maticnetwork/install/main/bor.sh | bash -s -- <bor_version> <network_type> <node_type>
bor_version: valid v0.3+ release tag from https://github.com/maticnetwork/bor/releases
network_type: mainnet
and mumbai
node_type: sentry
That will install the bor
binary. Verify the installation by checking the Bor version on your machine:
bor version
Configure bor seeds (mainnet)
sed -i 's|.*\[p2p.discovery\]| \[p2p.discovery\] |g' /var/lib/bor/config.toml
sed -i 's|.*bootnodes =.*| bootnodes = ["enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f[email protected]44.232.55.71:30303","enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1[email protected]159.203.9.164:30303","enode://4be7248c3a12c5f95d4ef5fff37f7c44ad1072fdb59701b2e5987c5f3846ef448[email protected]3.93.224.197:30303","enode://32dd20eaf75513cf84ffc9940972ab17a62e88ea753b0780ea5eca9f40f925406[email protected]3.212.183.151:30303"]|g' /var/lib/bor/config.toml
chown bor /var/lib/bor
Configure bor seeds (mumbai)
sed -i 's|.*\[p2p.discovery\]| \[p2p.discovery\] |g' /var/lib/bor/config.toml
sed -i 's|.*bootnodes =.*| bootnodes = ["enode://320553cda00dfc003f499a3ce9598029f364fbb3ed1222fdc20a94d97dcc4d8ba[email protected]54.147.31.250:30303","enode://f0f48a8781629f95ff02606081e6e43e4aebd503f3d07fc931fad7dd5ca1ba52b[email protected]34.226.134.117:30303"]|g' /var/lib/bor/config.toml
chown bor /var/lib/bor
Update service config user permission
sed -i 's/User=heimdall/User=root/g' /lib/systemd/system/heimdalld.service
sed -i 's/User=bor/User=root/g' /lib/systemd/system/bor.service
Start Services
Run the full Heimdall node with these commands on your Sentry Node:
sudo service heimdalld start
Now, you need to make sure that Heimdall is synced completely, and then only start Bor. If you start Bor without Heimdall syncing completely, you will run into issues frequently.
To check if Heimdall is synced
- On the remote machine/VM, run
curl localhost:26657/status
- In the output,
catching_up
value should befalse
Once Heimdall is synced, run the below command:
sudo service bor start
Logs
Logs can be managed by the journalctl
linux tool. Here is a tutorial for advanced usage: How To Use Journalctl to View and Manipulate Systemd Logs.
Check Heimdall node logs
journalctl -u heimdalld.service -f
Check Heimdall Rest-server logs
journalctl -u heimdalld-rest-server.service -f
Check Bor Rest-server logs
journalctl -u bor.service -f
Ports and Firewall Setup
Open ports 22, 26656 and 30303 to world (0.0.0.0/0) on sentry node firewall.
You can use VPN to restrict access for port 22 as per your requirement and security guidelines.