Skip to main content

Full Node Binaries

This section guides you through starting and running a full node on a binary.

For the system requirements, see Minimum Technical Requirements.

note

Steps in this guide involve waiting for the Heimdall and Bor services to fully sync. This process takes several days to complete.

Alternatively, you can use a maintained snapshot, which will reduce the sync time to a few hours. For detailed instructions, see Snapshot Instructions for Heimdall and Bor.

For snapshot download links, see Polygon Chains Snapshots.

Prerequisites

  • One machine is required.
  • build-essential installed on the Full Node machine.
  • To install:
sudo apt-get install build-essential
- Go 1.17 installed.

## Overview

- Have the machine prepared.
- Install the Heimdall and Bor binaries on the Full Node machine.
- Set up the Heimdall and Bor services on the Full Node machine.
- Configure the Full node.
- Start the Full node.
- Check node health with the community.

:::note
You have to follow the exact outlined sequence of actions, otherwise you will run into issues.
:::

### Install build essentials

***This is required for your full node***

```bash
sudo apt-get install build-essential

Install GO

This is required for your full node

wget https://raw.githubusercontent.com/maticnetwork/node-ansible/master/go-install.sh
bash go-install.sh
sudo ln -nfs ~/.go/bin/go /usr/bin/go

Note: Go version 1.18 is recommended

Install Binaries

Heimdall

This is required for your full node

Next, install the latest version of Heimdall and services. Make sure you checkout the correct released version on Git. Note that the latest version, Heimdall v.0.2.9, contains a few enhancements such as:

  1. Restricting data size in state sync txs to:
    • 30Kb when represented in bytes
    • 60Kb when represented as string.
  2. 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

Run the command:

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

# Checkout to a proper version
# For eg: git checkout v0.2.9-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 your full 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 0.2.16

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

Configure Node Files

Fetch launch repo

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

Configure launch directory

To set up the network directory, the 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

Configure network directories

Heimdall data setup

cd ~/node/heimdall
bash setup.sh

Bor data setup

cd ~/node/bor
bash setup.sh

Configure 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/

Set up config files

  • Log in 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
    • 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 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 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