Docs
  • InfraDAO Overview
  • ⌨️Indexing 101
    • Linux and Ethereum Clients
      • Introduction to Linux
      • Getting started with Ethereum Clients
      • Lab 1: Sync a Gnosis blockchain node
  • ⌨️Archive Nodes 101
    • Overview
    • ⏫Arbitrum
      • 💻Baremetal
      • 🐳Docker
    • 🔼Arbitrum Sepolia
      • 💻Baremetal
    • 🏔️Avalanche
      • 🐳Docker
    • 🔵Base
      • Erigon
        • 💻Baremetal
      • GETH
        • 💻Baremetal
        • 🐳Docker
    • 🫐Base Sepolia
      • 💻Baremetal
      • 🐋Docker
        • 🐋Op-Reth
    • 🔔Binance
      • Erigon
        • 💻Baremetal
    • 💥Blast
      • 💻Baremetal
    • 🧋Boba
      • 💻Baremetal
      • 🐳Docker
    • 🫖BobaBNB
      • 💻Baremetal
      • 🐳Docker
    • 🟨Celo
      • 🐳Docker
    • 🔷Ethereum
      • 🦦Erigon
        • 💻Baremetal
        • 🐳Docker
      • 🦀Reth
        • 💻Baremetal
        • 🐳Docker
    • 🦄Ethereum Sepolia
      • 🐉Erigon
        • 💻Baremetal
      • 🦥Geth
        • 🐳Docker
    • 👻Fantom
      • 🐳Docker
    • ♻️Fuse
      • 💻Baremetal
    • 🦉Gnosis
      • 🦦Erigon
        • 💻Baremetal
    • 📍Iotex
      • 💻Baremetal
    • 🔲Linea
      • 💻Baremetal
      • 🐳Docker
    • Ⓜ️Mode
      • 💻Baremetal
      • 🐳Docker
    • 🌌Moonbeam
      • 💻Baremetal
      • 🐳Docker
    • 🌛Moonriver
      • 💻Baremetal
      • 🐳Docker
    • 🔴Optimism
      • GETH
        • 🖥️Baremetal
        • 🐳Docker
      • Erigon
        • 💻Baremetal
    • 🍎Optimism Sepolia
      • 🐳Docker
      • 💻Baremetal
    • ♾️Polygon
      • 🐳Docker
    • 👾Polygon zkEVM
      • 🐉Erigon
        • 💻Baremetal
        • 🐳Docker
    • 🛡️Ronin
      • 🐳Docker
      • 💻Baremetal
    • 🫚Rootstock
      • 🐳Docker
      • 💻Baremetal
    • 📜Scroll
      • 🐳Docker
      • 💻Baremetal
    • 🦔Sonic
      • 🐳Docker
      • 💻Baremetal
    • 🌟Starknet
      • 🪶Pathfinder
        • 🐳Docker
      • 🧑‍🚒Firehose
        • 💻Baremetal
        • 🐳Docker
      • 🏵️Juno
        • 🐳Docker
    • ✖️X Layer
      • 🐳Docker
      • 💻Baremetal
        • 🦥Erigon
        • 👽ZK-Node
    • 💤zkSync Era
      • 💻Baremetal
      • 🐳Docker
    • ⚡Zora
      • 🐳Docker
      • 💻Baremetal
Powered by GitBook
On this page
  • System Requirements
  • Pre-Requisites
  • Update System
  • Set up Firewall
  • Install GO
  • Set up Polygon zkEVM with Erigon
  • Clone the Polygon Hermez Repo for Erigon and Build Erigon
  • Create Directory for DB
  • Create YAML Configuration
  • Launch Erigon Node
  • Create Systemd Service
  • Start CDK-Erigon
  • View Logs for Debugging
  • Query Polygon zkEVM Node
  • References

Was this helpful?

Edit on GitHub
  1. Archive Nodes 101
  2. Polygon zkEVM
  3. Erigon

Baremetal

Author: [ jLeopoldA ]

System Requirements

CPU

OS

RAM

DISK

4 Core

Ubunutu 24.04.1 LTS

16GB

128GB

The Polygon zkEVM archive node has a size of 103GB as of 1/15/2025

Pre-Requisites

CDK-Erigon requires the installation of Go.

Update System

sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -ye

Set up Firewall

Set Explicit Default Firewall Rules

sudo ufw default deny incoming
sudo ufw default allow outgoing

Allow SSH

sudo ufw allow 22/tcp

Allow Remote RPC Connections with Polygon Zkevm

sudo ufw allow 8545

Allow P2P Connections

sudo ufw allow 30303/tcp && sudo ufw allow 30303/udp

Enable Firewall

sudo ufw enable

Check Status / Current Rules of UFW

sudo ufw status verbose

Install GO

Check for Latest Version of GO

# This will return the latest version of GO
curl -s https://go.dev/VERSION?m=text

# Example response
go1.23.3
time 2024-11-06T18:46:45Z

Download the Latest GO Tarball

# Downloading using the above example response
wget https://go.dev/d1/go1.23.3.linux-amd64.tar.gz

# Example command if the above version is different
wget https://go.dev/d1/VERSION.linux-amd64.tar.gz

Extract and Install GO

sudo tar -C /usr/local -xzf go.1.23.3.linux-amd64.tar.gz

Set Environment Variables

echo "export PATH=\$PATH:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc

Check Installation

go version

# Example response
go version go1.23.3 linux/amd64

Set up Polygon zkEVM with Erigon

Clone the Polygon Hermez Repo for Erigon and Build Erigon

cd /root
git clone https://github.com/0xPolygonHermez/cdk-erigon
cd cdk-erigon/cmd/cdk-erigon
go build -o erigon

Create Directory for DB

mkdir -p /var/lib/zkevm/db/

Create YAML Configuration

Create Configuration Directory

mkdir /root/config/
nano /root/config/config.yaml

Paste and modify parameters. Save by entering ctrl+X and Y+ENTER

datadir: /var/lib/zkevm/db/
chain: hermez-mainnet
http: true
private.api.addr: localhost:9091
zkevm.l2-chain-id: 1101
zkevm.l2-sequencer-rpc-url: https://zkevm-rpc.com
zkevm.l2-datastreamer-url: stream.zkevm-rpc.com:6900
zkevm.l1-chain-id: 1
zkevm.l1-rpc-url: {YOUR_L1_RPC_URL_HERE}

zkevm.address-sequencer: "0x148Ee7dAF16574cD020aFa34CC658f8F3fbd2800"
zkevm.address-zkevm: "0x519E42c24163192Dca44CD3fBDCEBF6be9130987"
zkevm.address-rollup: "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2"
zkevm.address-ger-manager: "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb"

zkevm.default-gas-price: 1000000000
zkevm.max-gas-price: 0
zkevm.gas-price-factor: 0.0375

zkevm.l1-rollup-id: 1
zkevm.l1-block-range: 20000
zkevm.l1-query-delay: 6000
zkevm.l1-first-block: 16896700
zkevm.datastream-version: 2

# debug.timers: true # Uncomment to enable timers

externalcl: true
http.port: 8545
http.api: [eth, debug, net, trace, web3, erigon, zkevm]
http.addr: 0.0.0.0
http.vhosts: any
http.corsdomain: any
ws: true

Launch Erigon Node

Create Systemd Service

sudo nano /etc/systemd/system/erigon.service

Paste the below configuration and save by entering ctrl+X and Y+ENTER

[Unit]
Description=Zkevm Node
After=network.target
StartLimitIntervalSec=200
StartLimitBurst=5

[Service]
Type=simple
Restart=on-failure
RestartSec=5
TimeoutSec=900
User=root
Nice=0
LimitNOFILE=200000
WorkingDirectory=/root/cdk-erigon/
ExecStart=/root/cdk-erigon/cmd/cdk-erigon/erigon \
	--config="/root/config/config.yaml"
KillSignal=SIGTERM
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

Start CDK-Erigon

sudo systemctl daemon-reload # Refresh after systemd configuration changes
sudo systemctl enable erigon.service # Enable erigon.service at start up
sudo systemctl start erigon.service # Starts erigon.service
sudo systemctl stop erigon.service # Stops erigon.service
sudo systemctl restart erigon.service # Restarts erigon.service

View Logs for Debugging

journalctl -fu erigon.service -xe

Alternatively, you can view logs minus server name and time and receive the below

journalctl -fu erigon.service -o cat

Query Polygon zkEVM Node

CDK-Erigon does take time to process blocks before you can fully query it.

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545

# Example response
{"jsonrpc":"2.0","id":1,"result":"0x40e2d5"}

References

PreviousErigonNextDocker

Last updated 3 months ago

Was this helpful?

⌨️
👾
🐉
💻
LogoGitHub - 0xPolygonHermez/cdk-erigon: Ethereum implementation on the efficiency frontierGitHub