Skip to main content
This guide runs a full Polygon Chain node using official Docker images. The same steps can be adapted for sentry nodes and validators.

Initial setup

To get started, you’ll need to have shell access with root privileges to a linux machine. img

Install Docker

It is likely that your operating system won’t have Docker installed by default. Please follow the instructions for your particular distribution found here: https://docs.docker.com/engine/install/ We’re following the instructions for Ubuntu. The steps are included below, but please refer to the official instructions in case they’ve been updated.
At this point you should have Docker installed. In order to verify, you should be able to run the following command successfully:
img In many cases, it’s inconvenient to run docker as root user so we’ll follow the post install steps here in order to interact with docker without needing to be root:
Now you should be able to logout and log back in, and run docker commands without sudo.

Disk setup

The exact steps required here may vary a lot based on your needs. Most likely you’ll have a root partition running your operating system on one device. You’ll probably want one or more devices for actually holding the blockchain data. For the rest of the walkthrough, we’re going to have that additional device mounted at /mnt/data. In this example, we have a device with 4 TB of available space located at /dev/nvme1n1. We are going to mount that using the steps below:
We use df -h to make sure the mount looks good. img Once we’ve verified that successfully, we might as well create the home directories on this mount for Bor and Heimdall.
Depending on your use case and operating system, you’ll likely want to create an entry in /etc/fstab in order to make sure your device is mounted when the system reboots. In our case we’re following some steps like this:
At this point you should be able to reboot and confirm that the system loads your mount properly.

Heimdall setup

At this point, we have a host with docker running on it and we have ample mounted storage to run our Polygon node software. So let’s get Heimdall configured and running. First let’s make sure we can run Heimdall with docker. Run the following command:
If this is the first time you’ve run Heimdall with docker, it should pull the required image automatically and output the version information. img If you’d like to check the details of the Heimdall image or find a different tag, you can take a look at the repository on Docker Hub: https://hub.docker.com/repository/docker/0xpolygon/heimdall-v2 At this point, let’s run the Heimdall init command to set up our home directory. Set --chain-id to heimdallv2-80002 for Amoy or heimdallv2-137 for mainnet.
After running the init command, your /mnt/data/heimdall directory should have some structure. Now we need to make a few updates before starting Heimdall. Download the genesis file and place it under HEIMDALL_HOME/config/genesis.json (replacing the one potentially already present there)
where BUCKET_URL is https://storage.googleapis.com/amoy-heimdallv2-genesis/migrated_dump-genesis.json for amoyand https://storage.googleapis.com/mainnet-heimdallv2-genesis/migrated_dump-genesis.json for mainnet Replace HEIMDALL_HOME with the actual path to your Heimdall home directory. Please note that the genesis file size is around 50MB for amoy and 3GB for mainnet.
Hence, the download might take a while, and it’s recommended to use a stable and fast connection.
Then, you can customize the configs under HEIMDALL_HOME/config (app.toml, client.toml, config.toml), based on your setup. Templates for each supported network are available here Make sure to configure your Ethereum and Bor connection parameters based on your infrastructure.

(Optional) Start Heimdall from snapshot

In case you want to start Heimdall from a snapshot,
you can download it, and extract in the data folder. Examples of snapshots can be found here https://all4nodes.io/Polygon, and they are managed by the community.
e.g.:

Starting Heimdall

Before we start Heimdall, we’re going to create a docker network so that the containers can easily network with each other based on names.
In order to create the network, run the following command:
Now we’re going to start Heimdall. Run the following command:
Check container status and logs:
At this point, Heimdall should start syncing. When you look at the logs, you should see a log of information being spit out that looks like this:
If you’re not seeing any information like this, your node might not be finding enough peers. The other useful command at this point is an RPC call to check the status of Heimdall syncing:
This will return a response like:
In this initial setup phase, it’s important to pay attention to the catching_up field.
If catching_up is true, it means that Heimdall is not fully synced.

Starting Bor

At this point, you should have a node that’s successfully running Heimdall. You should be ready now to run Bor. Before we get started with Bor, we need to run the Heimdall rest server. This command will start a REST API that Bor uses to retrieve information from Heimdall. The command to start the server is:
If this command runs successfully, when you run docker ps, you should see two containers running. Verify the REST server is responding:
Bor will rely on this interface. So if you don’t see JSON output, there is something wrong! Now let’s download the genesis file for Bor specifically:
Let’s verify the sha256 sum again for this file:
Generate a default Bor config file, then edit it. Only the changed lines are shown below. Full image details: https://hub.docker.com/repository/docker/0xpolygon/bor.
At this point, we should be ready to start Bor. We’re going to use this command:
If everything goes well, you should see log entries that look like this:
There are a few ways to check the sync state of Bor. The simplest is using curl:
When you run this command, you’ll see an output like this:
This will indicate the currentBlock that’s been synced and also the highestBlock that we’re aware of. If the node is already synced, we should get false.

Seeds and Bootnodes

The latest bor and heimdall seeds can be found here. Using them will ensure that bor/heimdall is able to connect to peers quickly.