Full Node Binaries
- Polygon-Mainnet
- Mumbai-Testnet
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 needed.
build-essential
installed on the Full Node machine.- To install:
sudo apt-get install build-essential
- Go 1.18 installed on both the Full Node machine.
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 machines.
- 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
sudo apt-get install build-essential
Install GO
wget https://gist.githubusercontent.com/ssandeep/a6c7197811c83c71e5fead841bab396c/raw/go-install.sh
bash go-install.sh
sudo ln -nfs ~/.go/bin/go /usr/bin/go
Note: Go version 1.18 is recommended
RabbitMq
RabbitMQ is a message-queueing software also known as a message broker or queue manager. Simply said; it is software where queues are defined, to which applications connect in order to transfer a message or messages.
A helper service called bridge
which is embedded into Heimdall codebase requires rabbit-mq
to queue transactions to multiple networks. Installing it should be pretty straightforward.
Checkout the download instructions here: https://www.rabbitmq.com/download.html
To start a RabbitMQ node, run:
rabbitmq-server
Install Binaries
Heimdall
Next, install the latest version of Heimdall. Make sure you git checkout the correct release version.
cd ~/
git clone https://github.com/maticnetwork/heimdall
cd heimdall
# Checkout to a proper version
# For eg: git checkout v0.2.1-mumbai
git checkout <TAG OR BRANCH>
make install
That will install the heimdalld
and heimdallcli
binaries. Verify that everything is OK:
heimdalld version --long
Bor
Next, install the latest version of Bor. Make sure you git checkout the correct released version
cd ~/
git clone https://github.com/maticnetwork/bor
cd bor
# Checkout to a proper version
# For eg: git checkout v0.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
Set up node files
Fetch launch repo
cd ~/
git clone https://github.com/maticnetwork/launch
Set up launch directory
To set up the network directory, network name and type of node are required.
Available networks: mainnet-v1
and testnet-v4
Node types: sentry
and validator
cd ~/
mkdir -p node
cp -rf launch/<network-name>/sentry/<node-type>/* ~/node
# To setup sentry node for mumbai (testnet-v4) testnet
# cp -rf launch/testnet-v4/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 mumbai (testnet-v4) testnet
# wget https://raw.githubusercontent.com/maticnetwork/launch/master/testnet-v4/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 Configuration Files
For Mumbai Testnet
- Configure the following in
~/.heimdalld/config/config.toml
:moniker=<enter unique identifier>
seeds="[email protected]:26656,[email protected]:26656"
Configure the following in
vi ~/.heimdalld/config/heimdall-config.toml
:eth_rpc_url =<insert Infura or any full node RPC URL to Goerli>
Add the following flag in
vi ~/node/bor/start.sh
to thebor
start params:
--bootnodes "enode://320553cda00dfc003f499a3ce9598029f364fbb3ed1222fdc20a94d97dcc4d8ba[email protected]54.147.31.250:30303"
Start services
Run the full Heimdall node with the following commands:
sudo service heimdalld start
sudo service heimdalld-rest-server start
Once Heimdall is synced, start Bor:
sudo service bor start
Logs
Logs are managed by journalctl
linux tool. Here is a link for advanced usage: https://www.digitalocean.com/community/tutorials/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
To check if Heimdall is synced
- On the remote machine/VM, run
curl localhost:26657/status
- In the output,
catching_up
value should befalse
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.
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:
- 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
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 theconfig.toml
file, run the following commandvi ~/.heimdalld/config/config.toml
Now in the config file you will have to change
Moniker
and addseeds
informationmoniker=<enter unique identifier> For example, moniker=my-sentry-node
seeds="[email protected]:26656,[email protected]:26656"
Change the value of Pex to
true
Change the value of Prometheus to
true
Set the
max_open_connections
value to100
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 invi ~/node/bor/start.sh
to thebor
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 befalse
- On the remote machine/VM, run
Now once Heimdall is synced, run
sudo service bor start
You can check Bor logs here:
- Bor -
journalctl -u bor.service -f