Building an Ethereum Validator From Scratch
Ethereum has moved from proof of work to proof of stake! Most tend to think that this means the end of mining. I like to say to colleagues “PoW Mining is dead! Long live PoS mining!”. While the nature of mining has changed, the act of validating transactions on behalf of the network has not. Former Ethereum PoW miners, and many wanting to get into Ethereum’s infrastructure, are looking for ways to participate and make some revenue in the process. This guide is meant to be a simple, straightforward introduction into building a solo staking node.
Disclaimer
Staking Ethereum is not an inexpensive activity. If you buy cheap hardware, fail to take backups, or generally lack the commitment to run a validator for multiple years with little to no downtime, you should consider alternative options.
Hardware and Software Requirements
Staking, just like mining, requires hardware. While staking hardware is far more power efficient than mining hardware, there are still requirements. You will be working in terms of years (see the above disclaimer). You will not be working in hours, days, or even months. Appropriate planning for your hardware and software will be key in maintaining your validator and revenue stream. Stable internet, solid well-architected hardware, and reliable power are an absolute must.
Hardware Requirements
This section is dedicated to the hardware requirements for running a validator for years without any, or at least, minimal, downtime.
- AMD or Intel-based CPUs are preferred; 4 cores or above is required
- 16GB of RAM (32GB if you have a cheaper SSD for Linux to use for page caches)
- 2TB SSD (Use something with high write endurance. Above 1000 TBW is advised)
- Warning: Avoid splitting Geth's data into separate volumes based on 1.09. Splitting the go-ethereum ancient and levelDB, additional hardware, power usage, and failure points can lead to reduced profitability and reliability
- Stable internet connection (100MiB/s is recommended)
- A basic UPS for small intermittent power outages
- Store your mnemonic phrases and passwords in a safe place.
- A word on the term "safe place": "safe" depends on your relative comfort levels with software or physical security. Password managers like LastPass, 1Password, etc are considered "safe" to some and not to others. Please do your research on solutions for storing and managing mnemonic phrases and passwords.
Software Requirements:
Which software you use will dictate how much time you spend on your validator, its' uptime, and the mean time to recovery in the case of a failure. The Below are generally considered stable solutions with long-term support for breaking bugs, new features, and general security patching on a regular basis.
Monetary Requirements
- An Ethereum address
- 32.05 ETH (the 0.05 is to ensure you can cover the gas fees for the contract deposit)
Validator Setup Guide
This is where we will discuss the nuts and bolts of setting up a validator node on a physical computer. For users looking to accomplish this task in the cloud, you will be able to skip the operating system install steps and
Setup Your Local Computer
This process is to setup the authentication mechanism for connecting to your validator. This step is critical in securing your system for the future and is considered required for this guide. It is HIGHLY ADVISABLE for you to generate a NEW KEY for this process and to store this private key in a safe place that is recoverable only by you.
- Generate an SSH Key for remote access
ssh-keygen -t ed25519 ssh-add <generated key path>
Setup The Operating System (hardware)
Right off the bat:
!!! ALWAYS ENCRYPT YOUR HARDDRIVE(S) !!!
From here follow these steps:
-
Install the Ubuntu Operating system
- A step-by-step guide can be found here
- You will create a user here, it is highly preferable that you use only SSH keys and disable password based login.
-
Update your operating system packages to latest version
sudo apt update sudo apt upgrade
-
Ensure your computer’s clock is up to date. We suggest that you install Chrony
sudo apt install chrony -y
-
Send your SSH key to the new server
ssh-copy-id <server_username>@<server_ip_address> ssh <server_username>@<server_ip_address>
-
Create a service user
sudo useradd validator
Setup Geth
This section is about setting up geth. You will download geth, place the binary in a common Linux PATH
-
Download the Geth release that matches your CPU architecture and unpack into
/usr/local/bin
curl -O https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.25-69568c55.tar.gz tar zxvf geth-linux-amd64-1.10.25-69568c55.tar.gz sudo cp geth /usr/local/bin/
-
Create data directory for Geth
sudo mkdir -p /data/ethereum sudo chown -R validator:validator /data
-
Write a systemd file (using vim in this example)
sudo vim /etc/systemd/system/geth.service
-
Add the systemd configs
[Unit] Description=Geth [Service] Type=simple User=validator Restart=always ExecStart=/usr/local/bin/geth \ --http \ --http.api "eth,web3,txpool,net,debug,engine" \ --datadir /data/ethereum [Install] WantedBy=default.target
-
Enable the systemd service file
sudo systemctl enable geth
Setup Lighthouse Binary
Lighthouse's Binary contains two operating modes: beacon_node and validator_client. We will shorthand this to bn
and vc
respectively.
-
Create data directory for Lighthouse Beacon Node and Validation Client
sudo mkdir /data/lighthouse /data/lighthouse-vc sudo chown validator:validator /data/lighthouse /data/lighthouse-vc
-
Download the latest stable release and unpack it to
/usr/local/bin
curl -O https://github.com/sigp/lighthouse/releases/download/v3.1.2/lighthouse-v3.1.2-x86_64-unknown-linux-gnu.tar.gz tar zxvf lighthouse-v3.1.2-x86_64-unknown-linux-gnu.tar.gz sudo cp lighthouse /usr/local/bin/
Setup Lighthouse Beacon Node
-
Write a systemd file (using vim in this example)
sudo vim /etc/systemd/system/lighthouse.service
-
Add the systemd configs like so:
[Service] Type=simple Restart=on-failure RestartSec=5s User=validator ExecStart=/usr/local/bin/lighthouse bn \ --network mainnet \ --datadir /data/lighthouse \ --eth1-endpoints http://127.0.0.1:8545 \ --execution-endpoints http://127.0.0.1:8551 \ --builder http://127.0.0.1:18550 \ --http \ --http-address 127.0.0.1 \ --jwt-secrets /data/ethereum/geth/jwtsecret [Install] WantedBy=multi-user.target
-
Enable the systemd service file
sudo systemctl enable lighthouse
Setup Lighthouse Validation Node
This section is about setting up the validation client application on your validator. Inside of Lighthouse there is a validation client call.
-
Write a systemd file (using vim in this example)
sudo vim /etc/systemd/system/lighthouse-vc.service
-
Add the systemd configs like so:
[Unit] Description=lighthouse: An Ethereum Consensus Implementation Written in Go [Service] Type=simple Restart=on-failure RestartSec=5s User=validator ExecStart=/usr/local/bin/lighthouse vc \ --network mainnet \ --log-format JSON \ --builder-proposals \ --datadir /data/lighthouse-vc
-
Enable the systemd service file (insert example)
sudo systemctl enable lighthouse-vc
Setup MEV-Boost
This section is all about MEV-Boost. MEV-Boost will connect you to builders in the wider network to provide additional value to your validation income.
-
Download the release
curl -O https://github.com/flashbots/mev-boost/releases/download/v1.3.2/mev-boost_1.3.2_linux_amd64.tar.gz tar zxvf mev-boost_1.3.2_linux_amd64.tar.gz sudo cp mev-boost /usr/local/bin/
-
Write a systemd file
[Unit] Description=mev-boost: An Ethereum Builder relay Implementation Written in Go [Service] Type=simple Restart=on-failure RestartSec=5s User=validator Environment=BN_RELAY="https://0x9000009807ed12c1f08bf4e81c6da3ba8e3fc3d953898ce0102433094e5f22f21102ec057841fcb81978ed1ea0fa8246@builder-relay-mainnet.blocknative.com" Environment=FB_RELAY="https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net" ExecStart=/usr/local/bin/mev-boost \ -mainnet \ -relays $BN_RELAY,$FB_RELAY
A NOTE: Environment=BN_RELAY
in the systemd file will add Blocknative's Relay to your mev-boost configuration. Flashbots by default is also added to provide competition for your proposal slot as a validator.
- Enable the systemd service file
sudo systemctl enable mev-boost
First Start-Up
Here we are, the final stretch. You are just a few steps away from starting up your validator! It is time to start your Geth, Lighthouse beacon node, and MEV-Boost processes. This part will take some time (usually 2-3 days to complete). Run the following:
sudo systemctl start geth
sleep 10
sudo systemctl start lighthouse mev-boost
Confirming that your node is ready to validate
To confirm that your node is ready to validate you will need to ensure that both your Geth and Lighthouse nodes are fully synced and available.
Check the status of your infrastructure
-
Check Geth (should show
false
):sudo geth attach --datadir /data/ethereum --exec 'eth.syncing'
-
Check Lighthouse (should show
{"data":"Synced"}
):curl localhost:5052/lighthouse/syncing
Begin Validating
You will need to add your validator keys to Lighthouse now in order to start validating. If you DO NOT have your validator keys yet, please navigate to Ethereum's Launchpad and go through the process of getting the validator contract. Once you have a contract in place; You will need to add it to Lighthouse.
-
Add your validator contract to Lighthouse:
lighthouse --network mainnet --datadir /data/lighthouse-vc account validator import --directory <KEY_DIRECTORY>
-
Start your Lighthouse validator:
sudo systemctl start lighthouse-vc && journalctl -u lighthouse-vc -f
Next Steps
Now that you’re validating, it is important that you continue to utilize reliable hardware, maintain backups, and remain committed to running your validator with little to no downtime. This will ensure your validator remains as profitable as possible. We recommend our Ethereum staking ROI calculator to forecast potential earnings.
However, to keep those profits, it is also imperative to avoid any penalties, or worse— a slashing. If you are a current Ethereum validator or in the process of becoming a validator, we highly recommend reading our Staker's Guide to Ethereum Slashing & Other Penalties. You will find that, when compared to mild penalties such as those for inactivity, having some downtime can actually be preferable to designing a validator that may potentially trigger a slashable offense.
Looking to learn more? We recommend the following Ethereum validator communities and resources:
Observe Ethereum
Blocknative's proven & powerful enterprise-grade infrastructure makes it easy for builders and traders to work with mempool data.
Visit ethernow.xyz