💻Baremetal

Authors: [man4ela | catapulta.eth]

System Requirements

CPU
OS
RAM
DISK

16+ cores CPU

Debian 12/Ubuntu 22.04

=> 16 GB RAM

=3.5TB

(SSD or NVMe)

The Ethereum Mainnet archive node has a size of 3.1TB on September 11th, 2024

Setup production Erigon

This guide covers the installation ofErigon, an implementation of Ethereum (execution layer), on the efficiency frontier, Archive Node by default, and Lighthouse(with historical blobs required for most L2 chains), as a Consensus Layer.

Pre-Requisites

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

sudo apt install -y libgtest-dev libomp-dev libgmp-dev git make wget aria2 gcc pkg-config libusb-1.0-0-dev libudev-dev jq g++ curl libssl-dev screen apache2-utils build-essential

Setting up Firewall

Set explicit default UFW rules

sudo ufw default deny incoming
sudo ufw default allow outgoing

Allow SSH and peers

sudo ufw allow 22/tcp
sudo ufw allow 30303

Allow remote RPC connections with Blast Node

sudo ufw allow from ${REMOTE.HOST.IP} to any port 8545
sudo ufw allow from ${REMOTE.HOST.IP} to any port 5052

Not advised to allow all or unknown IP address to RPC port

Enable Firewall

sudo ufw enable

To check the status of UFW and see the current rules

sudo ufw status verbose

Install GO

Go version 1.21+ is required

sudo wget https://go.dev/dl/go1.21.6.linux-amd64.tar.gz && sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.6.linux-amd64.tar.gz && rm go1.21.6.linux-amd64.tar.gz

echo 'export PATH=$PATH:/usr/local/go/bin:/root/.local/bin' >> /root/.bashrc

source /root/.bashrc

#verify Go installation
go version

Build Erigon RPC Node

git clone --recurse-submodules https://github.com/ledgerwatch/erigon.git

cd erigon 

git checkout v2.60.6

make erigon

Create Data directory and jwt secret file

cd ..

mkdir erigon_data && cd erigon_data

sudo openssl rand -hex -out /root/erigon_data/jwtsecret 32

Create Systemd service for Erigon

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

Paste the configs and save by entering ctrl+X and Y+ENTER:

[Unit]
Description=Erigon Service
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/erigon/build/bin/
ExecStart=/root/erigon/build/bin/erigon \
    --chain=mainnet \
    --port=30303 \
    --http.port=8545 \
    --torrent.port=42069 \
    --torrent.download.rate=1024mb \
    --private.api.addr=127.0.0.1:9090 \
    --http \
    --ws \
    --http.api=eth,debug,net,trace,web3,erigon \
    --http.addr=0.0.0.0 \
    --http.corsdomain='*' \
    --metrics \
    --metrics.port=6060 \
    --metrics.addr=0.0.0.0 \
    --authrpc.jwtsecret=/root/erigon_data/jwt.hex \
    --datadir=/root/erigon_data \
    --rpc.gascap=5000000000 \
    --rpc.returndata.limit=1100000 \
    --pprof \
    --pprof.addr=0.0.0.0 \
    --pprof.port=6070

[Install]
WantedBy=multi-user.target

Launch Erigon

sudo systemctl daemon-reload #refresh systemd configuration when changes made

sudo systemctl enable erigon.service #enable erigon service at system startup

sudo systemctl start erigon.service #start erigon

sudo nano /etc/systemd/system/erigon.service #make changes in erigon.service file

Build Lighthouse

Go to the Releases page and select the latest release:

cd /root/

mkdir lighthouse_data

mkdir lighthouse && cd lighthouse

wget https://github.com/sigp/lighthouse/releases/download/v5.3.0/lighthouse-v5.3.0-x86_64-unknown-linux-gnu.tar.gz

tar -xzf lighthouse-v5.3.0-x86_64-unknown-linux-gnu.tar.gz #Extract the tar.gz archive

chmod +x /root/lighthouse/ #Grant execute permissions to the files in the directory

Create systemd file for Lighthouse

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

Paste the configs and save by entering ctrl+X and Y+ENTER:

[Unit]
Description=Lighthouse Beacon Node
After=network.target

[Service]
User=root
WorkingDirectory=/root/lighthouse/
ExecStart=/root/lighthouse/lighthouse beacon_node \
    --network mainnet \
    --datadir /root/lighthouse_data \
    --http \
    --http-address 0.0.0.0 \
    --http-port 5052 \
    --execution-endpoint http://127.0.0.1:8551 \
    --checkpoint-sync-url https://sync-mainnet.beaconcha.in \
    --execution-jwt /root/erigon_data/jwt.hex \
    --disable-deposit-contract-sync \
    --prune-blobs false
Restart=on-failure
LimitNOFILE=1000000

[Install]
WantedBy=default.target

Launch Lighthouse

sudo systemctl daemon-reload #refresh systemd configuration when changes made

sudo systemctl enable lighthouse.service #enable Lighthouse service at system startup

sudo systemctl start lighthouse.service #start Lighthouse

sudo nano /etc/systemd/system/lighthouse.service #make changes in lighthouse.service file

Monitor the logs for errors

journalctl -u erigon.service -f -n 100 #follow logs of erigon.service

journalctl -u lighthouse -f -n 100 #follow logs of lighthouse.service

During the synchonization, you are expected to get following log messages fromerigon:

[INFO] [09-06|02:52:15.496] [4/12 Execution] Executed blocks         number=9421994 blk/s=112.3 tx/s=9589.1 Mgas/s=906.5 gasState=0.38 batch=246.4MB alloc=6.4GB sys=16.7GB
[INFO] [09-06|02:52:29.871] [] Flushed buffer file                   name=erigon-sortable-buf-4268134305
[INFO] [09-06|02:52:30.358] [] Flushed buffer file                   name=erigon-sortable-buf-140271917
[INFO] [09-06|02:52:30.405] [] Flushed buffer file                   name=erigon-sortable-buf-3356874711
[INFO] [09-06|02:52:43.500] Committed State                          gas reached=221060403580 gasTarget=549755813888 block=9423228 time=16.113674309s committedToDb=true
[INFO] [09-06|02:52:45.488] [4/12 Execution] Executed blocks         number=9423456 blk/s=48.7 tx/s=5474.7 Mgas/s=412.4 gasState=0.00 batch=3.1MB alloc=5.7GB sys=16.7GB

And Lighthouse:

Sep 06 01:05:36.659 INFO New block received                      root: 0x9bf6a56781caf6b6e57cb6a0cead5e9ada0c417a36d4dd3d6924d07e5993935b, slot: 9896726
Sep 06 01:05:41.000 WARN Head is optimistic                      execution_block_hash: 0x613050be274505439dda4867d07840bd2e2e6e9ba0cddd96aada49449861bbb2, info: chain not fully verified, block and attestation production disabled until execution engine syncs, service: slot_notifier

Run curl command in the terminal to check the status of your node

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

Expected output during synchronization:

{"jsonrpc":"2.0","id":1,"result":{"currentBlock":"0x0","highestBlock":"0x137477f","stages":[{"stage_name":"Snapshots","block_number":"0x137477f"},{"stage_name":"Headers","block_number":"0x137477f"},{"stage_name":"BorHeimdall","block_number":"0x0"},{"stage_name":"BlockHashes","block_number":"0x137477f"},{"stage_name":"Bodies","block_number":"0x137477f"},{"stage_name":"Senders","block_number":"0x137477f"},{"stage_name":"Execution","block_number":"0x90b383"},{"stage_name":"Translation","block_number":"0x0"},{"stage_name":"HashState","block_number":"0x0"},{"stage_name":"IntermediateHashes","block_number":"0x0"},{"stage_name":"AccountHistoryIndex","block_number":"0x0"},{"stage_name":"StorageHistoryIndex","block_number":"0x0"},{"stage_name":"LogIndex","block_number":"0x0"},{"stage_name":"CallTraces","block_number":"0x0"},{"stage_name":"TxLookup","block_number":"0x0"},{"stage_name":"Finish","block_number":"0x0"}]}}

When it returns false then your node is fully synchronized with the network

References

Last updated