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

Warnings

Disclaimer

Acknowledgements

Support

  • The EthStaker community on Reddit or Discord. Knowledgeable and friendly community passionate about staking on Ethereum.
  • The Teku 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 Teku 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 Teku Consensus Client

$ cd ~
$ curl -LO https://artifacts.consensys.net/public/teku/raw/names/teku.tar.gz/versions/22.9.0/teku-22.9.0.tar.gz
$ tar xvf teku-22.9.0.tar.gz
$ sudo cp -a teku-22.9.0 /usr/local/bin/teku
$ sudo apt install -y default-jre
$ cd ~
$ sudo rm teku-22.9.0.tar.gz
$ sudo rm -r teku-22.9.0

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 Teku

$ sudo mkdir -p /var/lib/teku
$ sudo cp -a /$HOME/staking-deposit-cli/validator_keys /var/lib/teku
$ cd /var/lib/teku/validator_keys
$ ls
$ sudo rm <DepositDataFileName>

Create the Validator Password File(s)

$ ls /var/lib/teku/validator_keys
$ sudo nano /var/lib/teku/validator_keys/<JsonFileName>.txt
$ sudo nano /var/lib/teku/validator_keys/keystore-m_12381_3600_0_0_0–165922673.txt

Step 11 — Configure the Teku Service

Set up the Account

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

Set up the Permissions

$ sudo chown -R teku:teku /var/lib/teku

Create and Configure the Service

$ sudo nano /etc/systemd/system/teku.service
[Unit]
Description=Teku Consensus Client (Goerli Test Network)
Wants=network-online.target
After=network-online.target
[Service]
User=teku
Group=teku
Type=simple
Restart=always
RestartSec=5
Environment="JAVA_OPTS=-Xmx3g"
Environment="TEKU_OPTS=-XX:-HeapDumpOnOutOfMemoryError"
ExecStart=/usr/local/bin/teku/bin/teku \
--network=goerli \
--data-path=/var/lib/teku \
--validator-keys=/var/lib/teku/validator_keys:/var/lib/teku/validator_keys \
--ee-endpoint=http://127.0.0.1:8551 \
--ee-jwt-secret-file=/var/lib/jwtsecret/jwt.hex \
--validators-proposer-default-fee-recipient=FeeRecipientAddress \
--initial-state=https://goerli.checkpoint-sync.ethdevops.io/eth/v2/debug/beacon/states/finalized \
--validators-graffiti="<yourgraffiti>" \
--metrics-enabled=true
[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl start teku
$ sudo systemctl status teku
$ sudo journalctl -fu teku
$ sudo systemctl enable teku

Step 12 — 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 13 — 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: teku
metrics_path: /metrics
static_configs:
- targets:
- localhost:8008
- 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 14 — 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 15 — 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 16 — 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 ConsenSys 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 teku # <-- 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.09.01 /usr/local/bin/erigon
$ sudo systemctl start erigon
$ sudo systemctl status erigon # <-- Check for errors
$ sudo journalctl -fu erigon <-- Monitor
$ sudo journalctl -fu teku # <-- 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.20-8f2416a8.tar.gz
$ sudo systemctl stop geth
$ tar xvf geth-linux-amd64-1.10.20-8f2416a8.tar.gz
$ cd geth-linux-amd64-1.10.20-8f2416a8
$ 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 teku # <-- Monitor
$ cd ~
$ rm geth-linux-amd64-1.10.20-8f2416a8.tar.gz
$ rm -r geth-linux-amd64-1.10.20-8f2416a8
$ 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 teku # <-- 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 teku # <-- Monitor
$ cd ~
$ rm nethermind-linux-amd64-1.14.1-1a32d45-20220907.zip
$ rm -r nethermind

Appendix E — Updating Teku

$ cd ~
$ curl -LO https://artifacts.consensys.net/public/teku/raw/names/teku.tar.gz/versions/22.9.0/teku-22.9.0.tar.gz
$ sudo systemctl stop teku
$ tar xvf teku-22.9.0.tar.gz
$ sudo rm -r /usr/local/bin/teku # <-- Remove the old files
$ sudo cp -a teku-22.9.0 /usr/local/bin/teku
$ sudo systemctl start teku
$ sudo systemctl status teku # <-- Check for errors
$ sudo journalctl -fu teku # <-- Monitor
$ cd ~
$ sudo rm teku-22.9.0.tar.gz
$ sudo rm -r teku-22.9.0

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 teku
$ sudo chown -R <yourusername>:<yourusername> /var/lib/teku
$ sudo cp -a $HOME/staking-deposit-cli/validator_keys /var/lib/teku
$ cd /var/lib/teku/validator_keys
$ ls
$ sudo rm <DepositDataFileName>

Create the Validator Password File(s)

$ ls /var/lib/teku/validator_keys
$ sudo nano /var/lib/teku/validator_keys/<JsonFileName>.txt
$ sudo nano /var/lib/teku/validator_keys/keystore-m_12381_3600_0_0_0–165922673.txt
$ sudo chown -R teku:teku /var/lib/teku
$ sudo systemctl start teku
$ sudo systemctl status teku # <-- Check errors
$ sudo journalctl -fu teku # <-- Monitor
...
INFO - Loading 4 validator keys...
...
INFO - Loaded 4 Validators: 8d7605e, 957ae4f, b477469, 898ef3d

Appendix G — Exiting Validators

$ /usr/local/bin/teku/bin/teku voluntary-exit --beacon-node-api-endpoint=http://127.0.0.1:5051 --validator-keys=/var/lib/teku/validator_keys/keystore-m_12381_3600_0_0_0-1606061625.json:/var/lib/teku/validator_keys/keystore-m_12381_3600_0_0_0-1606061625.txt
$ /usr/local/bin/teku/bin/teku voluntary-exit --beacon-node-api-endpoint=http://127.0.0.1:5051 --validator-keys=/var/lib/teku/validator_keys:/var/lib/teku/validator_keys

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

Teku

Slot Event *** Slot: 3590371, Block: 324fbc52ce24bd9c3008280f959bf2eebb5aa596225ab303ee5fb7f727d9f4f3, Justified: 112198, Finalized: 112197, Peers: 27

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.