Running a Full Node on Polygon: Heimdall and Bor Configuration

Anubhav Chaturvedi
4 min readMar 9, 2024

--

Introduction:

In the realm of blockchain technology, the Polygon network emerges as a promising layer-2 scaling solution for Ethereum, aiming to tackle the challenges of exorbitant fees and sluggish transaction speeds. Running a full node on the Polygon network not only grants you the ability to validate transactions but also empowers you to bolster network security. In this comprehensive tutorial, we’ll walk you through the process of initiating and operating a full node on the Polygon network utilizing binaries.

System Requirements:

Before diving into the setup process, it’s crucial to ensure that your system meets the minimum technical prerequisites for running a full node on the Polygon network. This includes having a machine equipped with at least 4 CPU cores, 16 GB of RAM, and 1 TB of storage capacity. For further details, you can refer to the Minimum Technical Requirements guide.

Moreover, it’s essential to acknowledge that the synchronization process for both Heimdall and Bor services can be time-consuming, often spanning several days. To expedite this process, an alternative approach involves utilizing a maintained snapshot, which significantly reduces the sync time to just a few hours. Given the substantial time savings provided by snapshots — especially considering the typical 4-day duration for sync completion — it’s prudent to opt for this method. Consequently, in this tutorial, we will leverage a snapshot to streamline the setup process effectively.

Installing Build-Essential Package: Setting Up Development Tools

The first step is to install build-essential, which is required for your full node. To install build-essential, run the following commands:

sudo apt update -y
sudo apt install build-essential -y

Install Binaries:

In the architecture of the Polygon node, two essential layers play distinct roles: Heimdall and Bor. Heimdall, deriving from Tendermint, operates as a parallel contract monitor alongside the Ethereum network. On the other hand, Bor, originating from Geth, is responsible for block generation, with its activities orchestrated by Heimdall nodes. To ensure the seamless functioning of the Polygon node, both binaries — Heimdall and Bor — need to be installed and executed in the correct sequence. This cohesive integration ensures efficient operation and synchronization within the Polygon network ecosystem.

Installing Heimdall:

To install the latest version of Heimdall and its associated services, execute the following commands, ensuring to replace <heimdall_version>, <network_type>, and <node_type> with the respective values pertinent to your setup:

curl -L https://raw.githubusercontent.com/maticnetwork/install/main/heimdall.sh | -- <heimdall_version> <network_type> <node_type>

For example,

curl -L https://raw.githubusercontent.com/maticnetwork/install/main/heimdall.sh | bash -s -- v1.0.3 mumbai sentry

To confirm the successful installation and version of Heimdall on your system, you can use the following command:

heimdalld version --long

Configure Heimdall Seeds:

Depending on the network type (mainnet or mumbai), you’ll need to configure the Heimdall seeds. Run the following commands to configure the seeds for the appropriate network:

Configure heimdall seeds (mainnet)

sed -i 's|^seeds =.*|seeds = "1500161dd491b67fb1ac81868952be49e2509c9f@52.78.36.216:26656,dd4a3f1750af5765266231b9d8ac764599921736@3.36.224.80:26656,8ea4f592ad6cc38d7532aff418d1fb97052463af@34.240.245.39:26656,e772e1fb8c3492a9570a377a5eafdb1dc53cd778@54.194.245.5:26656,6726b826df45ac8e9afb4bdb2469c7771bd797f1@52.209.21.164:26656"|g' /var/lib/heimdall/config/config.toml
chown heimdall /var/lib/heimdall

Configure heimdall seeds (mumbai)

sed -i 's|^seeds =.*|seeds = "9df7ae4bf9b996c0e3436ed4cd3050dbc5742a28@43.200.206.40:26656,d9275750bc877b0276c374307f0fd7eae1d71e35@54.216.248.9:26656,1a3258eb2b69b235d4749cf9266a94567d6c0199@52.214.83.78:26656"|g' /var/lib/heimdall/config/config.toml
chown heimdall /var/lib/heimdall

You can check latest seeds info on official Document.

Installing Bor:

Install the latest version of Bor, based on the valid release version.

curl -L https://raw.githubusercontent.com/maticnetwork/install/main/bor.sh | bash -s -- <bor_version> <network_type> <node_type>

For example:

curl -L https://raw.githubusercontent.com/maticnetwork/install/main/bor.sh | bash -s -- v1.2.7 mumbai sentry

Configure bor seeds (mainnet)

sed -i 's|.*\[p2p.discovery\]|  \[p2p.discovery\] |g' /var/lib/bor/config.toml
sed -i 's|.*bootnodes =.*| bootnodes = ["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5: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://bdcd4786a616a853b8a041f53496d853c68d99d54ff305615cd91c03cd56895e0a7f6e9f35dbf89131044e2114a9a782b792b5661e3aff07faf125a98606a071@43.200.206.40:30303", "enode://209aaf7ed549cf4a5700fd833da25413f80a1248bd3aa7fe2a87203e3f7b236dd729579e5c8df61c97bf508281bae4969d6de76a7393bcbd04a0af70270333b3@54.216.248.9:30303"]|g' /var/lib/bor/config.toml
chown bor /var/lib/bor

Next, update the service config user permission with the following commands:

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:

Once the Heimdall seeds are configured and the service config user permission is updated, you’re ready to initiate the Heimdall and Bor services. Execute the following commands to start the services:

sudo service heimdalld start    #start the service

sudo service heimdalld stop #stop the service

#download the snapshot and import it to data directory
curl -L https://snapshot-download.polygon.technology/snapdown.sh | bash -s -- --network mumbai --client heimdall --extract-dir /var/lib/heimdall/data --validate-checksum true
#wait until download is done, and start service again

Check if node is synced with this command

curl localhost:26657/status

In the output, catching_up value should be false , if its true wait and try again.

Once Heimdall is synced, run the below command:

sudo service bor start

Check 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

I hope this article was informative and provided you with the details you required. If you have any questions while reading the blog, message me on Instagram or LinkedIn. Special credits to my team member: Gaurav Kachariya.

Thank You…

--

--

Anubhav Chaturvedi
Anubhav Chaturvedi

Written by Anubhav Chaturvedi

Linux & DevOps Geek, Blockchain Developer ,Statistics & Data Nerd ,Solutions architect, passionate hands on instructor . High on Athletics and Travel

No responses yet