Guide to Staking on Ethereum (Ubuntu/Goerli/Lodestar)

Warnings

Disclaimer

Acknowledgements

Support

  • The EthStaker community on Reddit or Discord. Knowledgeable and friendly community passionate about staking on Ethereum.
  • The Lodestar Consensus Client team Discord.
  • The Besu / Erigon / Geth / Nethermind Execution Client team Discord.

Prerequisites

  • Ubuntu server v20.04 (LTS) amd64 installed and running on a local computer or in the cloud. A locally running computer is encouraged for greater decentralization.
  • MetaMask crypto wallet web browser extension installed and configured on a computer with a desktop (Mac, Windows, Linux, etc.) and a web browser (Brave, Safari, FireFox, etc.).

Requirements

  • A relatively modern multi-core CPU
  • 8GB RAM (16GB is better, and required in some cases)
  • An SSD (NVMe is better) of at least 1TB (2TB is recommended)
  • A stable internet connection with sufficient download speed and monthly data allowance

Overview

  • Generate the staking Validator Keys and Staking Deposit Data
  • Prepare the Ubuntu Server (updates, firewall, security, etc.)
  • Set up an Execution Client node and sync it with the Ethereum Blockchain (Goerli test network)
  • Configure the Lodestar Consensus Client and sync it with other Beacon Nodes
  • Deposit Goerli test network ETH to activate staking Validator Keys
  • Set up server monitoring via Prometheus metrics and a Grafana dashboard

Step 1 — Generate Staking Data

Download the Deposit Tool (Staking Deposit CLI)

$ cd ~
$ curl -LO https://github.com/ethereum/staking-deposit-cli/releases/download/v2.3.0/staking_deposit-cli-76ed782-linux-amd64.tar.gz
$ sudo tar xvf staking_deposit-cli-76ed782-linux-amd64.tar.gz
$ cd staking_deposit-cli-76ed782-linux-amd64

Prepare to Run the Deposit Tool (Staking Deposit CLI)

Run the Deposit Tool (Staking Deposit CLI)

$ sudo ./deposit new-mnemonic --num_validators 2 --chain goerli
deposit.exe new-mnemonic --num_validators 2 --chain goerli
  • The deposit_data-[timestamp].json file contains the public key(s) for the validator(s) and information about the staking deposit. This file will be used to complete the Goerli test network ETH staking deposit process later in this guide.
  • The keystore-[..].json files contain the encrypted validator signing key. There is one keystore file per validator that you are funding. These will be imported into the Consensus Client validator wallet for use during validation operations.
  • You will copy the files over to your Ubuntu server (if not already there) later in this guide.
  • If you lose or accidentally delete the files it is possible to regenerate them using the Staking Deposit Tool and your mnemonic via the existing-mnemonic command. More information here.

Final Steps

Step 2 — Connect to the Server

# adduser <yourusername>
# usermod -aG sudo <yourusername>
# rsync --archive --chown=<yourusername>:<yourusername> ~/.ssh /home/<yourusername>

Step 3 — Update the Server

$ sudo apt -y update && sudo apt -y upgrade
$ sudo apt dist-upgrade && sudo apt autoremove
$ sudo reboot

Step 4 — Secure the Server

Modify the Default SSH Port

$ sudo ss -tulpn | grep ':YourSSHPortNumber'
$ sudo ss -tulpn | grep ':6673'
$ sudo nano /etc/ssh/sshd_config
Port YourSSHPortNumber
$ sudo systemctl restart ssh

Configure the Firewall

$ sudo apt install ufw
$ sudo ufw default deny incoming
$ sudo ufw default allow outgoing
$ sudo ufw allow YourSSHPortNumber/tcp
$ sudo ufw allow 6673/tcp
$ sudo ufw deny 22/tcp
$ sudo ufw allow 30303
$ sudo ufw allow 9000
$ sudo ufw allow 3000/tcp

Enable the Firewall

$ sudo ufw enable
$ sudo ufw status numbered

Step 5 — Create a Swap Space

$ free -h
RAM     Swap Size
8GB 3GB
12GB 3GB
16GB 4GB
24GB 5GB
32GB 6GB
64GB 8GB
128GB 11GB
$ df -h
$ sudo fallocate -l 3G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ free -h
$ sudo cp /etc/fstab /etc/fstab.bak
$ echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
$ sudo sysctl vm.swappiness=10
$ sudo sysctl vm.vfs_cache_pressure=50
$ sudo nano /etc/sysctl.conf
vm.swappiness=10
vm.vfs_cache_pressure = 50

Step 6 — Configure Timekeeping

$ timedatectl
$ sudo timedatectl set-ntp on

Step 7 — Generate Client Authentication Secret

$ sudo mkdir -p /var/lib/jwtsecret
$ openssl rand -hex 32 | sudo tee /var/lib/jwtsecret/jwt.hex > /dev/null
$ sudo nano /var/lib/jwtsecret/jwt.hex

Step 8 — Configure the Execution Client

Install the Execution Client — Besu

$ cd ~
$ curl -LO https://hyperledger.jfrog.io/artifactory/besu-binaries/besu/22.7.2/besu-22.7.2.tar.gz
$ tar xvf besu-22.7.2.tar.gz
$ sudo cp -a besu-22.7.2 /usr/local/bin/besu
$ rm besu-22.7.2.tar.gz
$ rm -r besu-22.7.2
$ sudo apt -y install default-jre
$ sudo apt install -y libjemalloc-dev
$ sudo useradd --no-create-home --shell /bin/false besu
$ sudo mkdir -p /var/lib/besu
$ sudo chown -R besu:besu /var/lib/besu
$ sudo nano /etc/systemd/system/besu.service
[Unit]
Description=Besu Execution Client (Goerli Test Network)
Wants=network-online.target
After=network-online.target
[Service]
User=besu
Group=besu
Type=simple
Restart=always
RestartSec=5
Environment="JAVA_OPTS=-Xmx3g"
ExecStart=/usr/local/bin/besu/bin/besu \
--network=goerli \
--sync-mode=X_SNAP \
--data-path=/var/lib/besu \
--data-storage-format=BONSAI \
--engine-jwt-secret=/var/lib/jwtsecret/jwt.hex \
--metrics-enabled=true
[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl start besu
$ sudo systemctl status besu
$ sudo journalctl -fu besu
$ sudo systemctl enable besu

Install the Execution Client — Erigon

$ cd ~
$ curl -LO https://go.dev/dl/go1.19.linux-amd64.tar.gz
$ sudo rm -rf /usr/local/go
$ sudo tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
$ export PATH=$PATH:/usr/local/go/bin
$ source $HOME/.profile
$ rm go1.19.linux-amd64.tar.gz
$ sudo apt-get install -y build-essential
$ cd ~
$ curl -LO https://github.com/ledgerwatch/erigon/archive/refs/tags/v2022.09.01.tar.gz
$ tar xvf v2022.09.01.tar.gz
$ cd erigon-2022.09.01
$ make erigon
$ cd ~
$ sudo cp -a erigon-2022.09.01 /usr/local/bin/erigon
$ rm v2022.09.01.tar.gz
$ rm -r erigon-2022.09.01
$ sudo useradd --no-create-home --shell /bin/false erigon
$ sudo mkdir -p /var/lib/erigon
$ sudo chown -R erigon:erigon /var/lib/erigon
$ sudo nano /etc/systemd/system/erigon.service
[Unit]
Description=Erigon Execution Client (Goerli Test Network)
After=network.target
Wants=network.target
[Service]
User=erigon
Group=erigon
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/erigon/build/bin/erigon \
--chain=goerli \
--datadir=/var/lib/erigon \
--http.api=engine,eth,net \
--authrpc.jwtsecret=/var/lib/jwtsecret/jwt.hex \
--private.api.addr= \
--metrics \
--prune.r.before=4367322 \
--prune htc
[Install]
WantedBy=default.target
$ /usr/local/bin/erigon/build/bin/./erigon --help
$ sudo systemctl daemon-reload
$ sudo systemctl start erigon
$ sudo systemctl status erigon
$ sudo journalctl -fu erigon
$ sudo systemctl enable erigon
$ cd ~
$ curl -LO https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.23-d901d853.tar.gz
$ tar xvf geth-linux-amd64-1.10.23-d901d853.tar.gz
$ cd geth-linux-amd64-1.10.23-d901d853
$ sudo cp geth /usr/local/bin
$ cd ~
$ rm geth-linux-amd64-1.10.23-d901d853.tar.gz
$ rm -r geth-linux-amd64-1.10.23-d901d853
$ sudo useradd --no-create-home --shell /bin/false geth
$ sudo mkdir -p /var/lib/geth
$ sudo chown -R geth:geth /var/lib/geth
$ sudo nano /etc/systemd/system/geth.service
[Unit]
Description=Geth Execution Client (Goerli Test Network)
After=network.target
Wants=network.target
[Service]
User=geth
Group=geth
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/geth \
--goerli \
--datadir /var/lib/geth \
--authrpc.jwtsecret /var/lib/jwtsecret/jwt.hex \
--metrics \
--metrics.addr 127.0.0.1
[Install]
WantedBy=default.target
$ sudo systemctl daemon-reload
$ sudo systemctl start geth
$ sudo systemctl status geth
$ sudo journalctl -fu geth
$ sudo systemctl enable geth

Install the Execution Client — Nethermind

$ cd ~
$ curl -LO https://github.com/NethermindEth/nethermind/releases/download/1.14.1/nethermind-linux-amd64-1.14.1-1a32d45-20220907.zip
$ sudo apt-get install -y unzip
$ unzip nethermind-linux-amd64-1.14.1-1a32d45-20220907.zip -d nethermind
$ sudo cp -a nethermind /usr/local/bin/nethermind
$ rm nethermind-linux-amd64-1.14.1-1a32d45-20220907.zip
$ rm -r nethermind
$ sudo apt-get update
$ sudo apt-get install libsnappy-dev libc6-dev libc6 unzip -y
$ sudo useradd --no-create-home --shell /bin/false nethermind
$ sudo mkdir -p /var/lib/nethermind
$ sudo chown -R nethermind:nethermind /var/lib/nethermind
$ sudo nano /etc/systemd/system/nethermind.service
[Unit]
Description=Nethermind Execution Client (Goerli Test Network)
After=network.target
Wants=network.target
[Service]
User=nethermind
Group=nethermind
Type=simple
Restart=always
RestartSec=5
WorkingDirectory=/var/lib/nethermind
Environment="DOTNET_BUNDLE_EXTRACT_BASE_DIR=/var/lib/nethermind"
ExecStart=/usr/local/bin/nethermind/Nethermind.Runner \
--config goerli \
--datadir /var/lib/nethermind \
--Sync.SnapSync true \
--Sync.AncientBodiesBarrier 4367322 \
--Sync.AncientReceiptsBarrier 4367322 \
--JsonRpc.JwtSecretFile /var/lib/jwtsecret/jwt.hex \
--Metrics.Enabled true
[Install]
WantedBy=default.target
$ sudo systemctl daemon-reload
$ sudo systemctl start nethermind
$ sudo systemctl status nethermind
$ sudo journalctl -fu nethermind
$ sudo systemctl enable nethermind

Step 9 — Install the Lodestar Consensus Client

$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt update -y && sudo apt install yarn -y
$ curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ sudo apt-get install build-essential -y
$ git clone https://github.com/chainsafe/lodestar.git
$ cd lodestar
$ yarn install --ignore-optional
$ yarn run build
$ cd ~
$ sudo cp -a lodestar /usr/local/bin
$ sudo rm -r lodestar

Step 10 — Import the Validator Keys

Copy the Validator Keystore Files to the Server

$ sudo mkdir -p $HOME/staking-deposit-cli/validator_keys
$ sudo chown -R <yourusername>:<yourusername> $HOME/staking-deposit-cli/validator_keys

Import the Validator Keystore Files into Lodestar

$ sudo mkdir -p /var/lib/lodestar/validators
$ sudo chown -R <yourusername>:<yourusername> /var/lib/lodestar/validators
$ cd /usr/local/bin/lodestar
$ ./lodestar validator import --network goerli --dataDir /var/lib/lodestar/validators --importKeystores $HOME/staking-deposit-cli/validator_keys

Step 11 — Configure the Beacon Node Service

Set up the Account

$ sudo useradd --no-create-home --shell /bin/false lodestarbeacon

Create the Directory and Set up the Permissions

$ sudo mkdir -p /var/lib/lodestar/beacon
$ sudo chown -R lodestarbeacon:lodestarbeacon /var/lib/lodestar/beacon

Create and Configure the Service

$ sudo nano /etc/systemd/system/lodestarbeacon.service
[Unit]
Description=Lodestar Consensus Beacon Client (Goerli Test Network)
Wants=network-online.target
After=network-online.target
[Service]
User=lodestarbeacon
Group=lodestarbeacon
Type=simple
Restart=always
RestartSec=5
WorkingDirectory=/usr/local/bin/lodestar
ExecStart=/usr/local/bin/lodestar/lodestar beacon \
--network goerli \
--dataDir /var/lib/lodestar/beacon \
--execution.urls http://127.0.0.1:8551 \
--jwt-secret /var/lib/jwtsecret/jwt.hex \
--suggestedFeeRecipient FeeRecipientAddress \
--checkpointSyncUrl https://goerli-sync.invis.tools \
--metrics
[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl start lodestarbeacon
$ sudo systemctl status lodestarbeacon
$ sudo journalctl -fu lodestarbeacon
$ sudo systemctl enable lodestarbeacon

Step 12 — Configure the Validator Service

Set up the Validator Node Account and Directory

$ sudo useradd --no-create-home --shell /bin/false lodestarvalidator
$ sudo chown -R lodestarvalidator:lodestarvalidator /var/lib/lodestar/validators

Create and Configure the Service

$ sudo nano /etc/systemd/system/lodestarvalidator.service
[Unit]
Description=Lodestar Consensus Validator Client (Goerli Test Network)
Wants=network-online.target
After=network-online.target
[Service]
User=lodestarvalidator
Group=lodestarvalidator
Type=simple
Restart=always
RestartSec=5
WorkingDirectory=/usr/local/bin/lodestar
ExecStart=/usr/local/bin/lodestar/lodestar validator \
--network goerli \
--dataDir /var/lib/lodestar/validators \
--suggestedFeeRecipient FeeRecipientAddress \
--graffiti "<yourgraffiti>" \
--metrics
[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl start lodestarvalidator
$ sudo systemctl status lodestarvalidator
$ sudo journalctl -fu lodestarvalidator
$ sudo systemctl enable lodestarvalidator

Step 13 — Fund the Validator Keys

Get Goerli Test Network ETH

Perform the Deposit

Check the Status of Your Validators

  1. Copy your MetaMask wallet address (the same one you used to make the deposit).
  2. Go here: https://goerli.beaconcha.in/
  3. Search for your key(s) using your wallet address.

Step 14 — Monitoring: Install Prometheus

$ cd ~
$ curl -LO https://github.com/prometheus/prometheus/releases/download/v2.37.0/prometheus-2.37.0.linux-amd64.tar.gz
$ tar xvf prometheus-2.37.0.linux-amd64.tar.gz
$ sudo cp prometheus-2.37.0.linux-amd64/prometheus /usr/local/bin/
$ sudo cp prometheus-2.37.0.linux-amd64/promtool /usr/local/bin/
$ sudo cp -r prometheus-2.37.0.linux-amd64/consoles /etc/prometheus
$ sudo cp -r prometheus-2.37.0.linux-amd64/console_libraries /etc/prometheus
$ rm prometheus-2.37.0.linux-amd64.tar.gz
$ rm -r prometheus-2.37.0.linux-amd64
$ sudo useradd --no-create-home --shell /bin/false prometheus
$ sudo mkdir -p /var/lib/prometheus
$ sudo nano /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
- job_name: node_exporter
static_configs:
- targets:
- localhost:9100
- job_name: lodestarbeacon
metrics_path: /metrics
static_configs:
- targets:
- localhost:8008
- job_name: lodestarvalidator
metrics_path: /metrics
static_configs:
- targets:
- localhost:5064
- job_name: besu
metrics_path: /metrics
static_configs:
- targets:
- localhost:9545
- job_name: erigon
metrics_path: /debug/metrics/prometheus
static_configs:
- targets:
- localhost:6060
- job_name: geth
metrics_path: /debug/metrics/prometheus
static_configs:
- targets:
- localhost:6060
- job_name: nethermind
static_configs:
- targets:
- localhost:9091
$ sudo chown -R prometheus:prometheus /etc/prometheus
$ sudo chown -R prometheus:prometheus /var/lib/prometheus
$ sudo nano /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=prometheus
Group=prometheus
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl start prometheus
$ sudo systemctl status prometheus
$ sudo journalctl -fu prometheus
$ sudo systemctl enable prometheus

Step 15 — Monitoring: Install Node Exporter

$ cd ~
$ curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
$ tar xvf node_exporter-1.3.1.linux-amd64.tar.gz
$ sudo cp node_exporter-1.3.1.linux-amd64/node_exporter /usr/local/bin
$ rm node_exporter-1.3.1.linux-amd64.tar.gz
$ rm -r node_exporter-1.3.1.linux-amd64
$ sudo useradd --no-create-home --shell /bin/false node_exporter
$ sudo nano /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl start node_exporter
$ sudo systemctl status node_exporter
$ sudo journalctl -fu node_exporter
$ sudo systemctl enable node_exporter

Step 16 — Monitoring: Install Grafana

$ wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
$ sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
$ sudo apt update
$ apt-cache policy grafana
grafana:
Installed: (none)
Candidate: 9.0.5
Version table:
9.0.5 500
500 https://packages.grafana.com/oss/deb stable/main amd64
Packages
9.0.4 500
500 https://packages.grafana.com/oss/deb stable/main amd64
...
$ sudo apt install -y grafana
$ sudo systemctl start grafana-server
$ sudo systemctl status grafana-server
$ sudo journalctl -fu grafana-server
$ sudo systemctl enable grafana-server

Configure Grafana Login

Configure the Grafana Data Source

Add data source screen.
Data source configuration.

Step 17 — Monitoring: Add Grafana Dashboards

Execution Client Dashboard

Consensus Client Dashboard

Final Remarks and Recommended Next Steps

Next steps

  • Reboot your machine and make sure all services come back up
  • Understand how to update the client and server software
  • Use htop / df -h / ncdu / to monitor resources on the local machine
  • Review Appendix J — Manage Systemd Journal Logs to manage log size
  • Get familiar with beaconcha.in so you can monitor your validators
  • Use the beaconcha.in mobile app to monitor your validators
  • Join the Ethstaker and Lodestar Discord for important notifications
  • Share feedback on Discord (Somer#0753), Twitter, or Reddit
  • Help others with their setup on the Ethstaker Discord
  • Share this guide with your friends!
  • Tips appreciated: somer.eth or Gitcoin Grants

Further Reading

Appendix A — Updating Besu

$ cd ~
$ curl -LO https://hyperledger.jfrog.io/artifactory/besu-binaries/besu/22.7.2/besu-22.7.2.tar.gz
$ sudo systemctl stop besu
$ tar xvf besu-22.7.2.tar.gz
$ sudo rm -r /usr/local/bin/besu # <-- Remove the old files
$ sudo cp -a besu-22.7.2 /usr/local/bin/besu
$ sudo systemctl start besu
$ sudo systemctl status besu # <-- Check for errors
$ sudo journalctl -fu besu # <-- Monitor
$ sudo journalctl -fu lodestarbeacon # <-- Monitor
$ cd ~
$ rm besu-22.7.2.tar.gz
$ rm -r besu-22.7.2

Appendix B — Updating Erigon

$ cd ~
$ curl -LO https://github.com/ledgerwatch/erigon/archive/refs/tags/v2022.09.01.tar.gz
$ tar xvf v2022.09.01.tar.gz
$ cd erigon-2022.09.01
$ make erigon
$ export PATH=$PATH:/usr/local/go/bin
$ source $HOME/.profile
$ sudo systemctl stop erigon
$ cd ~
$ sudo rm -r /usr/local/bin/erigon # <-- Remove the old files
$ sudo cp -a erigon-2022.08.01 /usr/local/bin/erigon
$ sudo systemctl start erigon
$ sudo systemctl status erigon # <-- Check for errors
$ sudo journalctl -fu erigon <-- Monitor
$ sudo journalctl -fu lodestarbeacon # <-- Monitor
$ rm v2022.09.01.tar.gz
$ rm -r erigon-2022.09.01

Appendix C — Updating Geth

$ cd ~
$ curl -LO https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.23-d901d853.tar.gz
$ sudo systemctl stop geth
$ tar xvf geth-linux-amd64-1.10.23-d901d853.tar.gz
$ cd geth-linux-amd64-1.10.23-d901d853
$ sudo cp geth /usr/local/bin
$ sudo systemctl start geth
$ sudo systemctl status geth # <-- Check for errors
$ sudo journalctl -fu geth # <-- Monitor
$ sudo journalctl -fu lodestarbeacon # <-- Monitor
$ cd ~
$ rm geth-linux-amd64-1.10.23-d901d853.tar.gz
$ rm -r geth-linux-amd64-1.10.23-d901d853
$ sudo systemctl stop geth
$ sudo apt update && sudo apt upgrade
$ sudo systemctl start geth
$ sudo systemctl status geth # <-- Check for errors
$ sudo journalctl -fu geth # <-- Monitor
$ sudo journalctl -fu lodestarbeacon # <-- Monitor

Appendix D — Updating Nethermind

$ cd ~
$ curl -LO https://github.com/NethermindEth/nethermind/releases/download/1.14.1/nethermind-linux-amd64-1.14.1-1a32d45-20220907.zip
$ sudo systemctl stop nethermind
$ unzip nethermind-linux-amd64-1.14.1-1a32d45-20220907.zip -d nethermind
$ sudo rm -r /usr/local/bin/nethermind # <-- Remove the old files
$ sudo cp -a nethermind /usr/local/bin/nethermind
$ sudo systemctl start nethermind
$ sudo systemctl status nethermind # <-- Check for errors
$ sudo journalctl -fu nethermind # <-- Monitor
$ sudo journalctl -fu lodestarbeacon # <-- Monitor
$ cd ~
$ rm nethermind-linux-amd64-1.14.1-1a32d45-20220907.zip
$ rm -r nethermind

Appendix E — Updating Lodestar

$ cd ~
$ sudo rm -r lodestar # <-- Remove the old clone
$ git clone https://github.com/chainsafe/lodestar.git
$ cd lodestar
$ yarn install --ignore-optional
$ yarn run build
$ sudo systemctl stop lodestarvalidator
$ sudo systemctl stop lodestarbeacon
$ cd ~
$ sudo rm -r /usr/local/bin/lodestar # <-- Remove the old version
$ sudo cp -a lodestar /usr/local/bin
$ sudo systemctl start lodestarbeacon
$ sudo systemctl status lodestarbeacon # <-- Check for errors
$ sudo journalctl -fu lodestarbeacon # <-- Monitor
$ sudo systemctl start lodestarvalidator
$ sudo systemctl status lodestarvalidator # <-- Check for errors
$ sudo journalctl -fu lodestarvalidator # <-- Monitor
$ sudo rm -r lodestar

Appendix F — Adding Validators

Generate Deposit Data

$ sudo ./deposit existing-mnemonic --validator_start_index <ValidatorStartIndex> --num_validators <NumberOfValidators> --chain goerli
deposit.exe existing-mnemonic --validator_start_index <ValidatorStartIndex> --num_validators <NumberOfValidators> --chain goerli
  • The newer deposit_data-[timestamp].json file contains the public key(s) for the newly added validator(s) and information about the staking deposit. This file will be used to complete the Goerli test network ETH staking deposit process later in this guide.
  • The newly created keystore-[..].json files contain the encrypted validator signing key. There is one keystore file per additional validator that you are funding. These will be imported into the Consensus Client validator wallet for use during validation operations.
  • You will copy the files over to your Ubuntu server (if not already there) later in this step.
  • If you lose or accidentally delete the files it is possible to regenerate them using the Staking Deposit Tool and your mnemonic via the existing-mnemonic command. More information here.

Copy the Validator Keystore Files to the Server

$ sudo systemctl stop lodestarvalidator
$ sudo chown -R <yourusername>:<yourusername> /var/lib/lodestar/validators
$ cd /usr/local/bin/lodestar
$ ./lodestar validator import --network goerli --dataDir /var/lib/lodestar/validators --importKeystores $HOME/staking-deposit-cli/validator_keys
$ ./lodestar validator list --dataDir /var/lib/lodestar/validators
$ sudo chown -R lodestarvalidator:lodestarvalidator /var/lib/lodestar/validators
$ sudo systemctl start lodestarvalidator
$ sudo systemctl status lodestarvalidator # <-- Check for errors
$ sudo journalctl -fu lodestarvalidator # <-- Monitor
info: 3 local keystores

Appendix G — Exiting Validators

$ sudo systemctl stop lodestarvalidator
$ sudo chown -R <yourusername>:<yourusername> /var/lib/lodestar/validators
$ cd ~
$ cd /usr/local/bin/lodestar
$ ./lodestar validator voluntary-exit --network goerli --dataDir /var/lib/lodestar/validators --pubkeys <ValidatorPublicKey>
$ cd ~
$ cd /usr/local/bin/lodestar
$ ./lodestar validator voluntary-exit --network goerli --dataDir /var/lib/lodestar/validators
$ sudo chown -R lodestarvalidator:lodestarvalidator /var/lib/lodestar/validators
$ sudo systemctl start lodestarvalidator
$ sudo systemctl status lodestarvalidator # <-- Check for errors
$ sudo journalctl -fu lodestarvalidator # <-- Monitor

Appendix H — Install Prometheus Pushgateway

$ cd ~
$ curl -LO https://github.com/prometheus/pushgateway/releases/download/v1.4.3/pushgateway-1.4.3.linux-amd64.tar.gz
$ tar xvf pushgateway-1.4.3.linux-amd64.tar.gz
$ cd pushgateway-1.4.3.linux-amd64
$ sudo cp pushgateway /usr/local/bin
$ cd ~
$ rm pushgateway-1.4.3.linux-amd64.tar.gz
$ rm -r pushgateway-1.4.3.linux-amd64
$ sudo useradd --no-create-home --shell /bin/false pushgateway
$ sudo nano /etc/systemd/system/pushgateway.service
[Unit]
Description=Prometheus Pushgateway
After=network.target
Wants=network.target
[Service]
User=pushgateway
Group=pushgateway
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/pushgateway
[Install]
WantedBy=default.target
$ sudo systemctl daemon-reload
$ sudo systemctl start pushgateway
$ sudo systemctl status pushgateway
$ sudo journalctl -fu pushgateway
$ sudo systemctl enable pushgateway

Appendix I — Synced Client Output

Lodestar Beacon Node

info: Synced - slot: 3860618 - head: 3860618 0x4ba3…4a38 - execution: valid(0x28a9…b31a) - finalized: 0xd7e0…0f4d:120642 - peers: 27

Lodestar Validator Node

info: Lodestar network=goerli, version=v1.0.0/65b38ee, commit=65b38eeb2c523a32c396c6d636ea07e855241b92
info: 3 local keystores
info: 0x87...bd6
info: 0x87...18e
info: 0x8a...65e
info: Starting metrics HTTP server port=5064, address=127.0.0.1
info: Genesis available
info: Verified node and validator have same config
info: Verified node and validator have same genesisValidatorRoot
info: Discovered new validators count=3

Besu

Imported #7,343,901 / 32 tx / 0 om / 8,832,559 (29.4%) gas / (0xe82d4fa5a84af12d2b970bd483f782

Erigon

Commit cycle in=115.123585ms
RPC Daemon notified of new headers from=7363893 to=7363894 header
[1/16 Headers] Waiting for headers... from=7363894
Estimated to reaching TTD blocks=26399
[snapshots] Dumping txs block num=7136054 alloc=2.9GB sys=5.7GB
Estimated to reaching TTD blocks=13198
[1/16 Headers] Processed highest inserted=7363895 age=0
[6/16 Execution] Completed on block=7363895
Timings (slower than 50ms) Headers=14.53s
Tables PlainState=10.8GB AccountChangeSet=115.1MB...

Geth

Imported new chain segment blocks=1 txs=18 mgas=5.275 elapsed=34.679ms mgasps=152.100 number=7,343,916 hash=d7aa16..e6504c dirty=146.31MiB

Nethermind

Discovered new block 7343910 06:24:41 (0xcb3ecb...27c836), tx count: 18 sealer Infura, sent by [Peer|eth66|7343910|3.88.155.27:30303]Processed 7343910 | 595ms of 16,050ms, mgasps 40.56 total 18.83, tps 30.24 total 33.95, bps 1.68 total 1.41, recv queue 0, proc queue 0

Appendix J — Manage Systemd Journal Logs

$ sudo journalctl --disk-usage
$ sudo journalctl --flush --rotate 
$ sudo journalctl --vacuum-time=3days
$ sudo journalctl --verify

Automatically Limit Log Size

$ sudo nano /etc/systemd/journald.conf
$ sudo systemctl restart systemd-journald

Appendix K — Expanding the Logical Volume

$ sudo lvdisplay # <-- Check your logical volume size
$ sudo lvm
> lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
> lvextend -l +100%FREE -r /dev/ubuntu-vg/ubuntu-lv
> exit
$ sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
$ df -h # <-- Check results

Full Disclaimer

--

--

Passionate about Ethereum and decentralized technology.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Somer Esat

Somer Esat

Passionate about Ethereum and decentralized technology.