Set up an Archive Node Client on Polygon

Intermediate

 

Set up an Archive Node Client on Polygon

 

This tutorial provides instructions on how to set up an Archive Node client using Erigon. The tutorial includes instructions on how to install and start Erigon, as well as how to configure it to connect to a specific network and store files in a non-default location. Additionally, tips are provided on how to optimize the sync process by using a machine with high IOPS and RAM, and increasing the snapshot download and upload speed.

System Requirements

Archive Node

16-core CPU

64 GB RAM

Basically io1 or above with at least 20k+ iops and raid-0 based disk structure

Erigon Client

For an Archive node of Polygon Mainnet: 5TB

For an Archive node of Polygon Mumbai: 1TB

SSD or NVMe. Bear in mind that SSD performance deteriorates when close to capacity

RAM: >= 16GB, 64-bit architecture

Golang version >= 1.18, GCC 10+

HDD NOT RECOMMENDED

On HDDs, Erigon will always stay N blocks behind the chain tip, but will not fall behind.

Erigon Client Setup

How to Install

Run the following commands to install Erigon:

git clone --recurse-submodules -j8 https://github.com/maticnetwork/erigon.git
cd erigon
git checkout v0.0.2
make erigon

 

This should create the binary at ./build/bin/erigon

Use the tag v0.0.2 on our forked repo to have a stable version.

How to Start

To start Erigon, run:

erigon --chain=mumbai

 

Use chain=mumbai for Mumbai testnet

Use chain=bor-mainnet for Polygon Mainnet

How to Configure Erigon

If you want to store Erigon files in a non-default location, use -datadir

erigon --chain=mumbai --datadir=<your_data_dir>

 

If you are not using local heimdall, use -bor.heimdall=<your heimdall url>. By default, it will try to connect to localhost:1317.

erigon --chain=mumbai --bor.heimdall=<your heimdall url> --datadir=<your_data_dir>

 

If you want to connect to Polygon Mumbai Testnet use: https://heimdall.api.matic.today

For Polygon Mainnet: https://heimdall.api.matic.network

Tips for Faster Sync

Use the machine with high IOPS and RAM for the faster initial sync

Use the below commands to increase snapshot download/upload speed:

--torrent.upload.rate="512mb" --torrent.download.rate="512mb"

 

Replace 512 with whatever bandwidth your machine can manage.