For this guide, I chose erigon client, so this guide will follow the installation of erigon as the execution layer as well as beacond for the consensus layer.
Berachain node requires erigon v1.26.x for mainnet. With Rust and the dependencies installed, you're ready to build Erigon. First, clone the repository:
git clone https://github.com/erigontech/erigon.git
cd erigon/
git checkout v2.61.1
make erigon
Install Beacond Consensus Layer Note: Beacond requires go version 1.17.x - 1.23.x
Install Beacond
git clone https://github.com/berachain/beacon-kit.git
make install
make build
Edit Env.sh The file env.sh contains environment variables used in the other scripts. fetch-berachain-params.sh obtains copies of the genesis file and other configuration files. Then we have setup- and run- scripts for various execution clients and beacond.
#!/bin/bash
# CHANGE THESE VALUES
export CHAIN_SPEC=mainnet # "mainnet" or "testnet"
export MONIKER_NAME=anyname
export WALLET_ADDRESS_FEE_RECIPIENT=0x9BcaA41DC32627776b1A4D714Eef627E640b3EF5
export EL_ARCHIVE_NODE=true # set to true if you want to run an archive node on CL and EL
export MY_IP=`curl -s ipv4.canhazip.com`
########
# VALUES YOU MIGHT WANT TO CHANGE
export LOG_DIR=/root/erigon-beranode/scripts/logs
export BEACOND_BIN=/root/erigon-beranode/beacon-kit/build/bin/beacond
export BEACOND_DATA=/root/erigon-beranode/scripts/var/beacond
export BEACOND_CONFIG=$BEACOND_DATA/config # can't change this. sorry.
export JWT_PATH=$BEACOND_CONFIG/jwt.hex
# need at least one of these
#export RETH_BIN=$(command -v reth || echo $(pwd)/reth)
#export GETH_BIN=$(command -v geth || echo $(pwd)/geth)
#export NETHERMIND_BIN=$(command -v Nethermind.Runner || echo $(pwd)/Nethermind.Runner)
export ERIGON_BIN=/root/erigon-beranode/erigon/build/bin/erigon
You need to set these constants:
CHAIN_SPEC: Set to testnet or mainnet.
MONIKER_NAME: Should be a name of your choice for your node.
WALLET_ADDRESS_FEE_RECIPIENT: This is the address that will receive the priority fees for blocks sealed by your node. If your node will not be a validator, this won't matter.
EL_ARCHIVE_NODE: Set to true if you want the execution client to be a full archive node.
MY_IP: This is used to set the IP address your chain clients advertise to other peers on the network. If you leave it blank, geth and reth will discover the address with UPnP (if you are behind a NAT gateway) or assign the node's ethernet IP (which is OK if your computer is directly on the internet and has a public IP). In a cloud environment such as AWS or GCP where you are behind a NAT gateway, you must specify this address or allow the default curl canhazip.com to auto-detect it, if connections to that address lead back to your instance.
You should verify these constants:
LOG_DIR: This directory stores log files.
BEACOND_BIN: Set this to the full path where you installed beacond. The expression provided finds it in your $PATH.
BEACOND_DATA: Set this to where the consensus data and config should be kept. BEACOND_CONFIG must be under BEACOND_PATH as shown. Don't change it.
ERIGON_BIN or other chain client: Set this to the full path where you installed erigon. The expression provided finds it in your $PATH.
The script setup-beacond.sh invokes beacond init and beacond jwt generate. This script:
Runs beacond init to create the file var/beacond/config/priv_validator_key.json. This contains your node's private key, and especially if you intend to become a validator, this file should be kept safe. It cannot be regenerated, and losing it means you will not be able to participate in the consensus process.
Runs beacond jwt generate to create the file jwt.hex. This contains a secret shared between the consensus client and execution client so they can securely communicate. Protect this file. If you suspect it has been leaked, generate a new one with beacond jwt generate -o $JWT_PATH.
Rewrites the beacond configuration files to reflect settings chosen in env.sh.
Places the mainnet parameters fetched above where Beacon-Kit expects them, and shows you an important hash from the genesis file.
# ./setup-beacond.sh
BEACOND_DATA: /root/erigon-beranode/scripts/var/beacond
BEACOND_BIN: /root/erigon-beranode/beacon-kit/build/bin/beacond
Version: v1.2.0.rc2-28-gcbb6cfac3
✓ Private validator key generated in /root/erigon-beranode/scripts/var/beacond/config/priv_validator_key.json
✓ JWT secret generated at /root/erigon-beranode/scripts/var/beacond/config/jwt.hex
✓ Config files in /root/erigon-beranode/scripts/var/beacond/config updated
Genesis validator root: 0xdf609e3b062842c6425ff716aec2d2092c46455d9b2e1a2c9e32c6ba63ff0bda
✓ Beacon-Kit set up. Confirm genesis root is correct.
The provided scripts setup-reth, setup-geth and setup-nether create a runtime directory and configuration for those respective chain clients. The node is configured with pruning settings according to the EL_ARCHIVE_NODE setting in config.sh.
Here's an example of setup-erigon:
# ./setup-erigon.sh
ERIGON_DATA: /root/erigon-beranode/scripts/var/erigon
ERIGON_BIN: /root/erigon-beranode/erigon/build/bin/erigon
Version: erigon version 2.61.1-b3129c00
INFO[05-14|21:51:19.609] logging to file system log dir=/root/erigon-beranode/scripts/var/erigon/logs file prefix=erigon log level=info json=false
INFO[05-14|21:51:21.246] Starting Erigon on Ethereum mainnet...
INFO[05-14|21:51:21.247] Maximum peer count ETH=100 total=100
INFO[05-14|21:51:21.247] starting HTTP APIs port=8545 APIs=eth,erigon,engine
INFO[05-14|21:51:21.247] Opening Database label=chaindata path=/root/erigon-beranode/scripts/var/erigon/chaindata
INFO[05-14|21:51:21.248] [db] open label=chaindata sizeLimit=12TB pageSize=8192
INFO[05-14|21:51:21.249] Re-Opening DB in exclusive mode to apply migrations
INFO[05-14|21:51:21.250] [db] open label=chaindata sizeLimit=12TB pageSize=8192
INFO[05-14|21:51:21.251] Apply migration name=db_schema_version5
INFO[05-14|21:51:21.251] Applied migration name=db_schema_version5
INFO[05-14|21:51:21.251] Apply migration name=txs_begin_end
INFO[05-14|21:51:21.251] Applied migration name=txs_begin_end
INFO[05-14|21:51:21.251] Apply migration name=txs_v3
INFO[05-14|21:51:21.251] Applied migration name=txs_v3
INFO[05-14|21:51:21.251] Apply migration name=prohibit_new_downloads_lock
INFO[05-14|21:51:21.251] Applied migration name=prohibit_new_downloads_lock
INFO[05-14|21:51:21.251] Apply migration name=prohibit_new_downloads_lock2
INFO[05-14|21:51:21.251] Applied migration name=prohibit_new_downloads_lock2
INFO[05-14|21:51:21.252] Updated DB schema to version=6.1.0
INFO[05-14|21:51:21.253] [db] open label=chaindata sizeLimit=12TB pageSize=8192
INFO[05-14|21:51:27.874] Writing custom genesis block hash=0xd57819422128da1c44339fc7956662378c17e2213e669b427ac91cd11dfcfb38
INFO[05-14|21:51:27.981] Successfully wrote genesis state hash=0xd57819422128da1c44339fc7956662378c17e2213e669b427ac91cd11dfcfb38
✓ Erigon set up.