Step 5: Installing consensus client

Pick a consensus client

To strengthen Ethereum's resilience against potential attacks or consensus bugs, it's best practice to run a minority client in order to increase client diversity. Find the latest distribution of consensus clients here: https://clientdiversity.org

🛡️ Recommendation 🛡️: Lodestar

Your choice of Lighthouse, Nimbus, Teku, Prysm or Lodestar.

Reminder: Ensure you are logged in and execute all steps in this guide as non-root user, ethereum ,created during Step 2: Configuring Node.

Lighthouse is an Eth client with a heavy focus on speed and security. The team behind it, Sigma Prime, is an information security and software engineering firm who have funded Lighthouse along with the Ethereum Foundation, Consensys, and private individuals. Lighthouse is built in Rust and offered under an Apache 2.0 License.

⚙️ 5.1. Install rust dependency

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Enter '1' to proceed with the default install.

Update your environment variables.

echo export PATH="$HOME/.cargo/bin:$PATH" >> ~/.bashrc
source ~/.bashrc

Install rust dependencies.

sudo apt-get update
sudo apt install -y git gcc g++ make cmake pkg-config libssl-dev libclang-dev clang protobuf-compiler

💡 5.2. Build Lighthouse from source

mkdir ~/git
cd ~/git
git clone -b stable https://github.com/sigp/lighthouse.git
cd lighthouse
make

In case of compilation errors, run the following sequence.

rustup update
cargo clean
make

This build process may take a few minutes.

Verify lighthouse was installed properly by checking the version number.

lighthouse --version

🎩 5.3. Import validator key

Run the following command to import your validator keys from the staking-deposit-cli tool directory.

Enter your keystore password to import accounts.

lighthouse account validator import --network goerli --reuse-password --directory=$HOME/staking-deposit-cli/validator_keys

Verify the accounts were imported successfully.

lighthouse account_manager validator list --network goerli

WARNING: Do not import your validator keys into multiple validator clients and run them at the same time, or you might get slashed. If moving validators to a new setup or different validator client, ensure deletion of the previous validator keys before continuing.

🔥 5.4. Configure port forwarding and/or firewall

Specific to your networking setup or cloud provider settings, ensure your validator's firewall ports are open and reachable.

  • Lighthouse consensus client requires port 9000 for tcp and udp

  • Execution client requires port 30303 for tcp and udp

⛓️ 5.5. Start the beacon chain

Create a systemd unit file to define yourbeacon-chain.service configuration.

sudo nano /etc/systemd/system/beacon-chain.service

Paste the following configuration into the file.

# The eth beacon chain service (part of systemd)
# file: /etc/systemd/system/beacon-chain.service

[Unit]
Description=eth beacon chain service
Wants=network-online.target
After=network-online.target
Documentation=https://www.coincashew.com

[Service]
Type=simple
User=ethereum
Restart=on-failure
ExecStart=/home/ethereum/.cargo/bin/lighthouse bn \
  --network goerli \
  --staking \
  --validator-monitor-auto \
  --metrics \
  --checkpoint-sync-url=https://goerli.beaconstate.info \
  --execution-endpoint http://127.0.0.1:8551 \
  --execution-jwt /secrets/jwtsecret

[Install]
WantedBy=multi-user.target

To exit and save, press Ctrl + X, then Y, thenEnter.

Update file permissions.

sudo chmod 644 /etc/systemd/system/beacon-chain.service

Run the following to enable auto-start at boot time and then start your beacon node service.

sudo systemctl daemon-reload
sudo systemctl enable beacon-chain
sudo systemctl start beacon-chain

Nice work. Your beacon chain is now managed by the reliability and robustness of systemd.

🧬 5.6. Start the validator

Create a systemd unit file to define your validator.service configuration.

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

Paste the following configuration into the file.

# The eth validator service (part of systemd)
# file: /etc/systemd/system/validator.service

[Unit]
Description=eth validator service
Wants=network-online.target beacon-chain.service
After=network-online.target
Documentation=https://www.coincashew.com

[Service]
Type=simple
User=<USER>
Restart=on-failure
ExecStart=<HOME>/.cargo/bin/lighthouse vc \
 --network goerli \
 --metrics \
 --suggested-fee-recipient 0x_CHANGE_THIS_TO_MY_ETH_FEE_RECIPIENT_ADDRESS

[Install]
WantedBy=multi-user.target
  • Replace**0x_CHANGE_THIS_TO_MY_ETH_FEE_RECIPIENT_ADDRESS** with your own Ethereum address that you control. Tips are sent to this address and are immediately spendable, unlike the validator's attestation and block proposal rewards.

To exit and save, press Ctrl + X, then Y, thenEnter.

Update the configuration file with your current user's home path and user name.

sudo sed -i /etc/systemd/system/validator.service -e "s:<HOME>:${HOME}:g"
sudo sed -i /etc/systemd/system/validator.service -e "s:<USER>:${USER}:g"

Update file permissions.

sudo chmod 644 /etc/systemd/system/validator.service

Run the following to enable auto-start at boot time and then start your validator.

sudo systemctl daemon-reload
sudo systemctl enable validator
sudo systemctl start validator

Nice work. Your validator is now managed by the reliability and robustness of systemd.

🛠️ Helpful Consensus Client systemd commands

🗄 Viewing and filtering logs

#view and follow the log
journalctl --unit=beacon-chain -f
#view log since yesterday
journalctl --unit=beacon-chain --since=yesterday
#view log since today
journalctl --unit=beacon-chain --since=today
#view log between a date
journalctl --unit=beacon-chain --since='2020-12-01 00:00:00' --until='2020-12-02 12:00:00'

🔎 View the status of the beacon chain

sudo systemctl status beacon-chain

🔄 Restarting the beacon chain

sudo systemctl reload-or-restart beacon-chain

🛑 Stopping the beacon chain

sudo systemctl stop beacon-chain

⏭️ Next Steps

Syncing the consensus client is instantaneous with checkpoint sync but the execution client can take up to a day. On nodes with fast NVME drives and gigabit internet, expect your node to be fully synced in a few hours.

Patience required: If you're checking the logs and see any warnings or errors, please be patient as these will normally resolve once both your execution and consensus clients are fully synced to the Ethereum network.\

How do I know I'm fully synced?

  • Check your execution client's logs and compare the block number against the most recent block on https://goerli.etherscan.io/

    • Check EL logs: journalctl -fu eth1

  • Check your consensus client's logs and compare the slot number against the most recent slot on https://goerli.beaconcha.in

    • Check CL logs: journalctl -fu beacon-chain

Once your beacon chain is synced, validator up and running, you just wait for activation. This process can take 24+ hours. Only 900 new validators can join per day. When you're assigned, your validator will begin creating and voting on blocks while earning staking rewards.

Use https://goerli.beaconcha.in to create alerts and track your validator's performance.

🎉 Congrats! You've finished the primary steps of setting up your validator. You're now an Ethereum staker!

  • Subscribe to your Execution Client and Consensus Client's Github repository to be notified of new releases. Hit the Notifications button.

  • Join the community on Discord and Reddit to discuss all things staking related.

  • Familiarize yourself with Part II - Maintenance section, as you'll need to keep your staking node running at its best.

  • Up your staking understanding with the EthStaker Knowledge Base

  • Finished testing? Before decommissioning your validator, it's good practice to properly exit your validator as this improves staking network health.

🏁 Optional Steps

☎️ Need extra live support?

💟 Like these guides?

Ready for mainnet staking? Mainnet guide available here.

Last Words

I stand upon the shoulders of giants and as such, invite you to stand upon mine. Use my work with or without attribution; I make no claim of "intellectual property." My ideas are the result of countless millenia of evolution - they belong to humanity.

This is Leslie, the official mascot of Eth Staking

Last updated