đź’» Hardware Requirements
Disk space At least 7TB NVME disks (it’s not possible to keep up to chain head with SATA SSDs).
• Heimdall: ~250 GB
• Erigon: ~5.5 TB
RAM: 64 GB minimum
Time to sync the node 3–6 weeks if synced from scratch with the Erigon built-in torrent snapshots.
ℹ️ Erigon https://github.com/ledgerwatch/erigon is the recommended client to run a Polygon archive node. The Polygon team has forked Erigon https://github.com/maticnetwork/erigon and will be maintaining this new version.
To sync an archive node, Erigon must be connected to a Heimdall node, the validator layer. The Polygon network has also an additional client called Bor, which is essentially a fork of Geth and is the recommended client for operators wanting to run a full node (not the case for Graph Indexers). You can read more about Heimdall, Bor and Polygon’s architecture here https://medium.com/the-polygon-blog/heimdall-and-bor-1f8f881cd6a4.
Clone Erigon and install
git clone -b v2.35.2 --recurse-submodules https://github.com/ledgerwatch/erigon
cd erigon
make
Clone Heimdall and install
git clone -b v0.3.0 <https://github.com/maticnetwork/heimdall>
cd heimdall
make build network=mainnet
Configure heimdall
/root/heimdall/build/heimdalld init --home /root/.local/share/heimdall/
wget -O /root/.local/share/heimdall/config/genesis.json <https://raw.githubusercontent.com/maticnetwork/launch/master/mainnet-v1/without-sentry/heimdall/config/genesis.json>
sed -i '/^seeds/c\\seeds = "f4f605d60b8ffaaf15240564e58a81103510631c@159.203.9.164:26656,4fb1bc820088764a564d4f66bba1963d47d82329@44.232.55.71:26656,2eadba4be3ce47ac8db0a3538cb923b57b41c927@35.199.4.13:26656,3b23b20017a6f348d329c102ddc0088f0a10a444@35.221.13.28:26656,25f5f65a09c56e9f1d2d90618aa70cd358aa68da@35.230.116.151:26656"' /root/.local/share/heimdall/config/config.toml
sed -i "s#^cors_allowed_origins.*#cors_allowed_origins = [\\"*\\"]#" /root/.local/share/heimdall/config/config.toml
Create systemd files for Erigon, Heimdalld and Heimdallr
#erigon service file
[Unit]
Description=Erigon Polygon Service
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=3
[Service]
Type=simple
Restart=on-failure
RestartSec=5
TimeoutSec=900
User=root
Nice=0
LimitNOFILE=200000
WorkingDirectory=/root/.local/share/erigon/
ExecStart=/root/erigon/build/bin/erigon --chain="bor-mainnet" --datadir="/root/.local/share/erigon/datadir" --ethash.dagdir="/root/.local/share/erigon/datadir/ethash" --snapshots="true" --bor.heimdall="<http://localhost:1317>" --http --http.addr="0.0.0.0" --http.port="8545" --http.compression --http.vhosts="*" --http.corsdomain="*" --http.api="eth,debug,net,trace,web3,erigon,bor" --ws --ws.compression --rpc.gascap="300000000" --metrics --metrics.addr="0.0.0.0" --metrics.port="6969"
KillSignal=SIGHUP
[Install]
WantedBy=multi-user.target
#heimdalld service file
[Unit]
Description=Heimdalld
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=3
[Service]
Type=simple
Restart=on-failure
RestartSec=5
TimeoutSec=900
User=root
Nice=0
LimitNOFILE=200000
WorkingDirectory=/root/.local/share/heimdall/
ExecStart=/root/heimdall/build/heimdalld --home /root/.local/share/heimdall/ start
KillSignal=SIGHUP
[Install]
WantedBy=multi-user.target
#heimdallr service file
[Unit]
Description=Heimdallr
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=3
[Service]
Type=simple
Restart=on-failure
RestartSec=5
TimeoutSec=900
User=root
Nice=0
LimitNOFILE=200000
WorkingDirectory=/root/.local/share/heimdall/
ExecStart=/root/heimdall/build/heimdalld --home /root/.local/share/heimdall/ rest-server --chain-id=137
KillSignal=SIGHUP
[Install]
WantedBy=multi-user.target
Start heimdalld and heimdallr services:
sudo systemctl daemon-reload
sudo systemctl enable heimdalld
sudo systemctl enable heimdallr
sudo systemctl start heimdalld heimdallr
Checking if Heimdall is catching up:
sudo journalctl -fu heimdalld
#for logs
curl <http://localhost:26657/status>
#You should see "network": "heimdall-137" in the output, if you don’t something went wrong with the init and replacing the genesis.json file… anyway wait for it to say "catching_up": false
Starting Erigon:
#ONLY AFTER heildall caught up to the chainhead
sudo systemctl enable erigon
sudo systemctl start erigon
sudo journalctl -fu erigon
Serve subgraphs on Ethereum mainnet:
QuickSwap V3 Farming Polygon [MIPs](https://thegraph.com/explorer/subgraphs/QAMtqKsAjZo8jXS5wnZVR4MQ1tNPDWU5Br1bvqnPA3W?view=Overview&chain=mainnet) QmenqeksEYLXBUAmMSyTq6qw2j1M15Xpu8N48kWbTyhZdy
Adding a rule for subgraphs
graph indexer rules set QmenqeksEYLXBUAmMSyTq6qw2j1M15Xpu8N48kWbTyhZdy decisionBasis always allocationAmount 10000