Full Node Binaries

Polygon Full Node Setup Using Binaries

Pre-requisites

Minimum System Requirements

  • Minimum system requirements are as follows:

    16 GiB of memory

    4 core CPU (t2 xLarge)

    Minimum 60GB disk (make sure it is extendable)

It is essential that you have 2 different Machines / VM for your Sentry and Validator Node. Having a single Machine to run both, your Sentry and Validator nodes will run into issues

You can obviously opt for higher setup infra to future-proof your Node. However, anything below the minimum requirements, you will run into issues sooner than later. The minimum requirements set above is for both Sentry and Validator nodes.

Install build essentials

This is required for both your Sentry and Validator node

sudo apt-get install build-essential

Install GO

This is required for both your Sentry and Validator node

wget https://gist.githubusercontent.com/ssandeep/a6c7197811c83c71e5fead841bab396c/raw/e38212982ab8cdfc11776fa1a3aaf92b69e1cb15/go-install.sh
bash go-install.sh
sudo ln -nfs ~/.go/bin/go /usr/bin/go

Note: Go version 1.15+ is recommended

Install Binaries

Heimdall

This is required for both your Sentry and Validator node

Next, install the latest version of Heimdall and services. Make sure you checkout the correct released version on Git

cd ~/
git clone https://github.com/maticnetwork/heimdall
cd heimdall
# Checkout to a proper version
# For eg: git checkout v0.2.1-mainnet
git checkout <TAG OR BRANCH>
make install

That will install the heimdalld and heimdallcli binaries. Verify that everything is OK:

heimdalld version --long

Bor

This is required for both your Sentry and Validator node

Next, install the latest version of Bor. Make sure you checkout the correct released version via Git

cd ~/
git clone https://github.com/maticnetwork/bor
cd bor
# Checkout to a proper version
# For eg: git checkout v0.2.7
git checkout <TAG OR BRANCH>
make bor-all
sudo ln -nfs ~/bor/build/bin/bor /usr/bin/bor
sudo ln -nfs ~/bor/build/bin/bootnode /usr/bin/bootnode

That will install the bor binary and bootnode binary:

bor version

Setup node files

Fetch launch repo

cd ~/
git clone https://github.com/maticnetwork/launch

Setup launch directory

To setup network directory, network name and type of node are required.

Available networks: mainnet-v1

Node types: sentry and validator

cd ~/
mkdir -p node
cp -rf launch/<network-name>/sentry/<node-type>/* ~/node
# To setup sentry node for Polygon mainnet
# cp -rf launch/mainnet-v1/sentry/sentry/* ~/node

Setup network directories

Heimdall data setup

cd ~/node/heimdall
bash setup.sh

Bor data setup

cd ~/node/bor
bash setup.sh

Setup service files

Download service.sh file

cd ~/node
wget https://raw.githubusercontent.com/maticnetwork/launch/master/<network-name>/service.sh
# To setup sentry node for mainnet (mainnet-v1)
# wget https://raw.githubusercontent.com/maticnetwork/launch/master/mainnet-v1/service.sh

Generate the metadata file

sudo mkdir -p /etc/matic
sudo chmod -R 777 /etc/matic/
touch /etc/matic/metadata

Generate services files and copy them into system directory

cd ~/node
bash service.sh
sudo cp *.service /etc/systemd/system/

Setup config files

  • Login to the remote machine / VM

  • You will need to add a few details in the config.toml file. To open the config.toml file run the following command vi ~/.heimdalld/config/config.toml

    Now in the config file you will have to change Moniker and add seeds information

    moniker=<enter unique identifier> For example, moniker=my-sentry-node
    • Check for the parameter private_peer_ids. You will need to add your Validator NodeID here. To get your Validator NodeID, you will need to run this command on your Validator node instance: heimdalld tendermint show-node-id. After you add your NodeID it should look something like this private_peer_ids = "2170800c8a57.....a350f1c0ff"

    • Change the value of Pex to true

    • Change the value of Prometheus to true

    • Set the max_open_connections value to 100

      Make sure you keep the proper formatting when you make the changes above.

  • Next you need to make changes in the [start.sh](http://start.sh) file for Bor. Add the following flag in vi ~/node/bor/start.sh to the bor start params:

--bootnodes "enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f[email protected]44.232.55.71:30303,enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1[email protected]159.203.9.164:30303"

To enable Archive mode you can add the following flags in the [start.sh](http://start.sh) file

--gcmode 'archive' \
--ws --ws.port 8546 --ws.addr 0.0.0.0 --ws.origins '*' \

Start services

Run these commands on your Sentry Node:

To Start Heimdall Service

sudo service heimdalld start

To start Heimdall Rest-server

sudo service heimdalld-rest-server start

You check logs for Heimdall and rest-server here:

  • Heimdall - journalctl -u heimdalld.service -f
  • Heimdall Rest Server - journalctl -u heimdalld-rest-server.service -f

Now you need to make sure that Heimdall is synced completely and only then 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 be false

Now once Heimdall is synced, run

sudo service bor start

You can check Bor logs here:

  • Bor - journalctl -u bor.service -f
Last updated on