Erigon

Installing Erigon for Archive Nodes or disk-efficient storage.

Erigon

Erigon is an implementation of Ethereum focused on storage efficiency and speed. It uses a different database architecture (MDBX) that allows it to store a full Archive Node (all historical states) in a fraction of the space required by Geth.

🛡️ Role: Erigon is the specialist's choice. It is primarily used by indexers, block explorers, and analytics providers who need deep historical data.

Note: Erigon syncs differently. It downloads all block headers first, then block bodies, and finally executes them. It may appear "stuck" at 100% header sync for a long time—this is normal.


1. Install Dependencies

Erigon is distributed as a single binary. We only need basic tools to download and extract it.

Bash

# Update repositories
sudo apt update

# Install utilities
sudo apt install -y curl tar

2. Download & Install

We will download the latest pre-built binary from the official repository.

A. Create the Application Directory

Bash

# Create a folder for the binary
sudo mkdir -p /usr/local/lib/erigon

# Define the version (Check https://github.com/erigontech/erigon/releases for the latest)
# Example for v2.60.1
ERIGON_VERSION="2.60.1"

# Download the specific release
sudo wget https://github.com/erigontech/erigon/releases/download/v${ERIGON_VERSION}/erigon_${ERIGON_VERSION}_linux_amd64.tar.gz -O erigon.tar.gz

# Extract the archive
sudo tar -xvzf erigon.tar.gz -C /usr/local/lib/erigon

# Cleanup
rm erigon.tar.gz

B. Set Permissions Ensure the ethereum user owns the directory and the binary is executable.

Bash

sudo chown -R ethereum:ethereum /usr/local/lib/erigon
sudo chmod +x /usr/local/lib/erigon/erigon

3. Configure Systemd Service

We will configure Erigon to run as a background service.

💾 Storage Mode:

  • Archive Node (Recommended for Erigon): Retains all historical data. Add --prune.mode=archive.

  • Full Node: Prunes old data to save space. Add --prune.mode=full.

Create the service file:

Bash

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

Paste the following configuration:

Ini, TOML

[Unit]
Description=Erigon Execution Client
After=network.target

[Service]
User=ethereum
Group=ethereum
Type=simple
Restart=always
RestartSec=5

# Execution Command
ExecStart=/usr/local/lib/erigon/erigon \
  --chain=mainnet \
  --datadir=/home/ethereum/execution \
  --prune.mode=archive \
  --authrpc.jwtsecret=/home/ethereum/jwt/jwt.hex \
  --authrpc.addr=127.0.0.1 \
  --authrpc.port=8551 \
  --authrpc.vhosts=localhost \
  --http \
  --http.addr=0.0.0.0 \
  --http.port=8545 \
  --http.api=eth,erigon,web3,net,debug,trace,txpool \
  --http.corsdomain="*"

# Resource Limits
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

🔍 Flag Explanation:

  • --prune.mode=archive: Tells Erigon to keep all historical state. (Change to full if you have <2TB storage).

  • --http.api: Notice we added erigon and trace namespaces. These are powerful tools unique to Erigon for debugging transactions.

  • --authrpc.jwtsecret: The standard Engine API authentication.


4. Start the Service

Reload the systemd daemon and start the node.

Bash

# Reload systemd configuration
sudo systemctl daemon-reload

# Enable Erigon to start on boot
sudo systemctl enable erigon

# Start the service
sudo systemctl start erigon

5. Verify Status

Check the logs to track the unique Erigon sync stages.

Bash

sudo journalctl -fu erigon

Expected Output (The Stages): Erigon does not sync like Geth. You will see it move through strict "Stages":

  1. Stage 1: Downloading headers (Fast)

  2. Stage 2: Downloading bodies (Fast)

  3. Stage 3: Executing blocks (Slow - This is where it rebuilds the state)

  4. Waiting: Finally, it will wait for the Consensus Client to follow the chain head.

Last updated