Try   HackMD

💜 Polygon PoS - Running a Full Node Using Snapshots

Overview

⚠️ Warning: It is essential to follow the specified sequence of actions precisely; any deviations may result in potential issues.


Prepare the Machine

  1. Install Heimdall and Bor binaries on the full node machine.
  2. Set up Heimdall and Bor services on the full node machine.
  3. Configure the full node machine.
  4. Download snapshots (optional but recommended).
  5. Start the full node.
  6. Check the node's health with the community.

Install build-essential

This is required for your full node. Run the following command:

sudo apt-get update
sudo apt-get install build-essential

Install Binaries

The Polygon node consists of two layers:

  • Heimdall: A cosmos-sdk based app using a tendermint fork for consensus.
  • Bor: A Geth fork that generates blocks shuffled by Heimdall nodes.

Both binaries must be installed and run in the correct order to function properly.


Install Heimdall

Install the latest version of Heimdall and related services. Make sure you check for the correct release version.

Run:

curl -L https://raw.githubusercontent.com/maticnetwork/install/main/heimdall.sh | bash -s -- <HEIMDALL_VERSION> <NETWORK_TYPE> <NODE_TYPE>
Parameter Description
HEIMDALL_VERSION Valid v1.0+ release tag from Heimdall Releases
NETWORK_TYPE mainnet / amoy
NODE_TYPE sentry

Verify installation:

heimdalld version --long

Configure Heimdall Seeds (Mainnet)

sudo 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
sudo chown heimdall /var/lib/heimdall

Install Bor

Run:

curl -L https://raw.githubusercontent.com/maticnetwork/install/main/bor.sh | bash -s -- <BOR_VERSION> <NETWORK_TYPE> <NODE_TYPE>
Parameter Description
BOR_VERSION Valid v1.0+ release tag from Bor Releases
NETWORK_TYPE mainnet / amoy
NODE_TYPE sentry

Verify installation:

bor version

Update Service Config User Permission

sudo sed -i 's/User=heimdall/User=root/g' /lib/systemd/system/heimdalld.service
sudo sed -i 's/User=bor/User=root/g' /lib/systemd/system/bor.service

Download Snapshots

Visit All4nodes.io for a list of community snapshots.

Before proceeding, ensure aria2c is installed:

sudo apt-get update
sudo apt-get install aria2

Heimdall Mainnet Snapshot

1️⃣ Stop the service and reset the data:

sudo systemctl stop heimdalld.service
sudo rm -rf /var/lib/heimdall/data

2️⃣ Download the Heimdall snapshot:

wget https://snapshots.stakepool.dev.br/heimdall/heimdall-mainnet.txt

3️⃣ Use aria2c to download efficiently:

sudo mkdir -p data && cd data && sudo aria2c -j 6 -x 8 -s 6 --disk-cache=1024M --file-allocation=falloc --timeout=30 --retry-wait=5 --console-log-level=warn --auto-file-renaming=false --summary-interval=3600 -c -i ../heimdall-mainnet.txt && sudo chown -R heimdall:nogroup ./

4️⃣ Move the data directory:

sudo mv data /var/lib/heimdall

Bor Mainnet Snapshot (Pebble)

1️⃣ Stop the service and reset chaindata:

sudo systemctl stop bor.service
sudo rm -rf /var/lib/bor/data/bor/chaindata

2️⃣ Download the Bor snapshot:

wget https://snapshots.stakepool.dev.br/pbss/bor-mainnet-pebble.txt

3️⃣ Use aria2c to download efficiently:

sudo mkdir -p chaindata && cd chaindata && sudo aria2c -j 6 -x 8 -s 6 --disk-cache=1024M --file-allocation=falloc --timeout=30 --retry-wait=5 --console-log-level=warn --auto-file-renaming=false --summary-interval=3600 -c -i ../bor-mainnet-pebble.txt && sudo chown -R bor:nogroup ./

4️⃣ Move the chaindata directory:

sudo mv chaindata /var/lib/bor/data/bor

Start Services

1️⃣ Start Heimdall:

sudo service heimdalld start

⚠️ Wait for Heimdall to fully sync before starting Bor!
Check sync status:

curl localhost:26657/status

If catching_up is false, then Heimdall is synced.

2️⃣ Start Bor:

sudo service bor start

Logs

Check Heimdall logs:

journalctl -u heimdalld.service -f

Check Bor logs:

journalctl -u bor.service -f

Learn more about logs: How To Use Journalctl.


Done! Your Polygon PoS Full Node is Running!