Skip to main content

Run a full node with Ansible

Full Node Deployment (Polygon mainnet)

The Ansible playbook is used to configure and manage a full node.

Pre-requisites:

  • Ansible should be installed on local machine with Python3.x. The setup will not work if you have Python2.x.
    • To install ansible with Python 3.x you can use this command pip3 install ansible. This will install Python 3 dependencies as well as ansible.
  • Check Ansible Repository for requirements.
  • You will also need to make sure that Go is not installed on your VM / Machine. Setting up your full node through ansible will run into issues if you have Go already installed, as ansible requires specific packages of Go to be installed.
  • You will also need to make sure that your VM / Machine does not have any previous setups for Polygon Validator or Heimdall or Bor. You will need to delete them as your setup will run into issues.
  • The latest version, Heimdall v.0.2.11, contains a few enhancements. The delay time between the contract events of different validators has been increased to ensure that the mempool doesn't get filled very quickly in case of a burst of events which could hamper the progress of the chain. Additionally, the data size has been restricted in state sync txs to 30Kb (when represented in bytes) and 60Kb (when represented as string). For example:

Data - "abcd1234"
Length in string format - 8
Hex Byte representation - [171 205 18 52]
Length in byte format - 4

Full Node Set Up for Polygon Mainnet

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

It should output the remote machine IP(s) you have configured

  • Set up the full node with this command:
`ansible-playbook -l sentry playbooks/network.yml --extra-var="bor_branch=v0.2.16 heimdall_branch=v0.2.11 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

  • Log in to the remote machine

  • Configure the following in ~/.heimdalld/config/config.toml:

  • Configure the following in ~/.heimdalld/config/heimdall-config.toml:

    • eth_rpc_url =<insert Infura or any full node RPC URL to Ethereum>
  • 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"
  • 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'
  • Run the full node with the following commands:

    • sudo service heimdalld start

    • sudo service heimdalld-rest-server start

      Once Heimdall is synced, run

    • sudo service bor start

  • Check logs:

    • Heimdall - journalctl -u heimdalld.service -f
    • Heimdall Rest Server - journalctl -u heimdalld-rest-server.service -f
    • Bor - 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 be false