Setting Up Your Node:
The following tutorial is done on an Ubuntu Linux 20.04 (LTS) x64 instance machine.
Node Installation:
This guide shows how to install and run an Polygon full node.
How to install Polygon from source:
Before you start, you might want to ensure your system is updated. You can also install a utility named jq
to read and navigate in JSON files and outputs (other utilities could be installed too).
Copy sudo apt update && sudo apt upgrade -y && sudo apt install -y build-essential curl wget jq
To install Heimdall , run the below commands:
Copy curl -L https://raw.githubusercontent.com/maticnetwork/install/main/heimdall.sh | bash -s -- <heimdall_version> <network_type> <node_type>
That will install the heimdalld
and heimdallcli
binaries. Verify the installation by checking the Heimdall version on your machine:
Copy heimdalld version --long
Open the P2P port (26656 by default)
To install Erigon , run the below commands:
Copy git clone https://github.com/ledgerwatch/erigon.git
git checkout v2.60.8
make erigon
That will install the Erigon
binary. Verify the installation by checking the Erigon version on your machine:
Open the port (30303 by default)
Create a new erigon service file
Copy sudo nano /lib/systemd/system/erigon.service
Copy [Unit]
Description=erigon
StartLimitIntervalSec=500
StartLimitBurst=5
[Service]
Restart=on-failure
RestartSec=5s
#WorkingDirectory=$HOME
ExecStart=/bin/bash /home/node/erigon-start.sh
Type=simple
User=node
KillSignal=SIGINT
TimeoutStopSec=120
[Install]
WantedBy=multi-user.target
The configuration below assumes that you are running it on amoy
Copy sudo nano config.yaml
Copy chain: "amoy"
bor.heimdall: "http://127.0.0.1:1317"
datadir: "/var/lib/erigon/data"
#ethstats: ""
http.api: [ "eth,net,web3,erigon,txpool,bor" ]
http.port: 8545
snapshots: true
bodies.cache: 21474836480
db.pagesize: "16kb"
db.size.limit: "32TB"
#mine: true
miner.gaslimit: 30000000
#miner.etherbase: ""
#miner.sigfile: ""
#miner.recommit: "125s"
txpool.accountslots: 16
txpool.globalslots: 32768
txpool.accountqueue: 16
txpool.globalqueue: 32768
maxpeers: 50
port: 30303
#bootnodes: [ ""]
#trustedpeers: [ "" ]
Run erigon using configs provided in the config.toml
Copy sudo nano erigon-start.sh
Copy #!/usr/bin/env sh
set -x #echo on
/home/node/erigon/build/bin/erigon --config=/home/node/config.yaml
Start Heimdall Service.
Copy sudo service heimdalld start
Copy journalctl -u heimdalld.service -f
To verify that the heimdall node is synced before proceeding.
Copy curl -s localhost:26657/status | jq .result | jq .sync_info
Make sure that you have "catching_up": false
, otherwise leave it running until it is in sync.
Now once Heimdall is synced, run.
Start Erigon.
Copy sudo service erigon start
You can check Erigon logs here:
Copy journalctl -u erigon.service -f