Full Node Deployment

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.

Full Node Deployment (Polygon mainnet)

We have created simple Ansible playbooks to setup a full node.

Prerequisites

  • Two machines — one local machine on which you will run the Ansible playbook; one remote machine — for Full Node.
  • On the local machine, Ansible installed.
  • On the local machine, Python 3.x installed.
  • On the remote machine, make sure Go is not installed.
  • On the remote machine, your local machine's SSH public key is on the remote machine to let Ansible connect to them.

Overview

  • To get to a running full node, do the following:
  • Have the two machines prepared.
  • Set up a Full Node through Ansible.
  • 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.

Setup full node for Polygon mainnet

  • Ensure you have access to the remote machine or VM that the full node is being setup on. Refer https://github.com/maticnetwork/node-ansible#setup for more details.

  • Clone the https://github.com/maticnetwork/node-ansible repo

  • cd node-ansible
  • Edit the inventory.yml file and insert your IP(s) in the sentry->hosts section. Refer https://github.com/maticnetwork/node-ansible#inventory for more details.

  • Check if remote machine is reachable by running ansible sentry -m ping

  • For a test run to confirm if the correct remote machine / VM is configured, run the following command:

    ansible-playbook -l sentry playbooks/network.yml --extra-var="bor_branch=v0.2.10 heimdall_branch=v0.2.4 network_version=mainnet-v1 node_type=sentry/sentry heimdall_network=mainnet" --list-hosts

    This will be the output

    playbook: playbooks/network.yml
    pattern: ['all']
    host (1):
    xx.xxx.x.xxx
  • Setup the full node with this command:

    ansible-playbook -l sentry playbooks/network.yml --extra-var="bor_branch=v0.2.10 heimdall_branch=v0.2.4 network_version=mainnet-v1 node_type=sentry/sentry heimdall_network=mainnet"
  • In case you run into any issues, delete and clean the whole setup using

    ansible-playbook -l sentry playbooks/clean.yml
  • Login to the remote machine

  • Open for editing vi ~/.heimdalld/config/config.toml:

    moniker=<enter unique identifier>
  • Open for editing vi ~/.heimdalld/config/heimdall-config.toml.

    In heimdall-config.toml, change the following:

    • eth_rpc_url — an RPC endpoint for a fully synced Ethereum mainnet node, i.e Infura. eth_rpc_url =<insert Infura or any full node RPC URL to Ethereum>

      Example: eth_rpc_url = "https://nd-123-456-789.p2pify.com/60f2a23810ba11c827d3da642802412a"

      Save the changes in heimdall-config.toml.

  • Add the following flag in ~/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"
note

In case you want to turn trace on for Bor, add the following flag to the bor start params in ~/node/bor/start.sh:

- `--gcmode 'archive'`

Start the Heimdall Service

  • Run the full node with the following commands:

    • To Start Heimdall:

      sudo service heimdalld start
    • To start Heimdall Rest Server you can run the following command:

      sudo service heimdalld-rest-server start

      Once Heimdall is synced, run the following command:

      sudo service bor start
  • Check logs:

    • Check Heimdall logs:

      journalctl -u heimdalld.service -f
    • Check Heimdall Rest Server logs

      journalctl -u heimdalld-rest-server.service -f
    • Check Bor logs

      journalctl -u bor.service -f
  • Ports / Firewall configuration

    • Open ports 22, 26656 and 30303 to world (0.0.0.0/0) on node firewall. All other ports should be closed.
Last updated on