Polygon
Consensus chain
This chain is verified by Axelar validators. Before setting up this node,
set up your Axelar validator.
Once the node is running, connect it to vald as described in Verify consensus
chains.
Check the official documentation
The node setup steps below follow Polygon's own documentation at the time of
writing and may be out of date. Check the official
documentation before you start. The Axelar-specific steps (connecting
the node to vald or ampd) are maintained here.
Set up your Polygon Mainnet or Testnet (Mumbai) node.
Prerequisites
- Setup your Axelar validator
- Minimum hardware requirements: 4-8+ core CPU , 16-32GB RAM, 2TB+ SSD free storage space.
- MacOS or Ubuntu 18.04+
- Build-essential packages
- Golang 1.17+
- Official Documentation
Install required dependencies
In order to build the polygon node, you first need to install all of the required dependencies.
1. Update and install build-essential
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y build-essential2. Install golang
Install the latest version of golang.
Install the Polygon node
Polygon node consists of 2 layers, Heimdall and Bor. Heimdall is a fork of tendermint and runs in parallel to the Ethereum network, monitoring contracts, and Bor is a fork of go-Ethereum and producing blocks shuffled by Heimdall nodes. You need to install and run both binaries in the correct order, as explained in the following steps.
Install the latest versions for the network accordingly heimdall latest release tag and bor latest release tag
# These are examples - check their docs and release page to opt for the right version
HEIMDALL_RELEASE=v1.0.5
BOR_RELEASE=v1.2.81. Install Heimdall
https://raw.githubusercontent.com/maticnetwork/install/main/heimdall.sh |
bash -s -- $HEIMDALL_RELEASE mainnet sentry https://raw.githubusercontent.com/maticnetwork/install/main/heimdall.sh |
bash -s -- $HEIMDALL_RELEASE amoy sentry 2. Install Bor
https://raw.githubusercontent.com/maticnetwork/install/main/bor.sh | bash -s
-- $BOR_RELEASE mainnet sentry https://raw.githubusercontent.com/maticnetwork/install/main/bor.sh | bash -s
-- $BOR_RELEASE amoy sentry Check Versions
heimdalld version --long
bor versionSetup and configure node
1. Configure Bor seeds
/var/lib/bor/config.toml sed -i 's|.*bootnodes =.*| bootnodes =
["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303",
"enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303"]|g'
/var/lib/bor/config.toml chown bor /var/lib/bor testnet since they’ve already been included at genesis. 2. Update service config user permission
sed -i 's/User=heimdall/User=$USER/g' /lib/systemd/system/heimdalld.service
sed -i 's/User=bor/User=$$USER/g' /lib/systemd/system/bor.service3. Open port to public
Open the /var/lib/bor/config.toml and edit host address under jsonrpc.http
[jsonrpc]
ipcpath = "/var/lib/bor/bor.ipc"
# ipcdisable = false
# gascap = 50000000
# evmtimeout = "5s"
# txfeecap = 5.0
# allow-unprotected-txs = false
# enabledeprecatedpersonal = false
[jsonrpc.http]
enabled = true
port = 8545
host = "0.0.0.0" # change this to "0.0.0.0" from "127.0.0.1"
api = ["eth", "net", "web3", "txpool", "bor"]
vhosts = ["*"]
corsdomain = ["*"]Sync from snapshot
Bor
mkdir "/var/lib/bor/chaindata"bash -s -- --network mainnet --client bor --extract-dir
/var/lib/bor/chaindata --validate-checksum true bash -s -- --network amoy --client bor --extract-dir /var/lib/bor/chaindata
--validate-checksum true Heimdall
bash -s -- --network mainnet --client heimdall --extract-dir
/var/lib/heimdall/data --validate-checksum true bash -s -- --network amoy --client heimdall --extract-dir
/var/lib/heimdall/data --validate-checksum true Start the services
sudo service heimdalld start
sudo service bor startCheck logs
journalctl -u heimdalld.service -f -n 100 -o cat
journalctl -u heimdalld-rest-server.service -f -n 100 -o cat
journalctl -u bor.service -f -n 100 -o catVerify RPC
Once your Bor node is fully synced, you can run a cURL request to see the status of your node:
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "eth_syncing", "params":[]}' localhost:8545If the node is successfully synced, the output from above will print {"jsonrpc":"2.0","id":1,"result":false}
Configure vald
In order for vald to connect to your node, your rpc_addr should be exposed in
vald's config.toml
start-with-bridge = true start-with-bridge = true