Guide to Staking on Ethereum 2.0 (Ubuntu/Pyrmont/Nimbus)

  • Configure a newly running Ubuntu server instance
  • Configure and run an Ethereum 1.0 node as a service
  • Generate and fund Pyrmont validator account keys
  • Import Pyrmont validator account keys to Nimbus
  • Compile and configure the Nimbus client software for Ethereum 2.0, Phase 0 (Pyrmont testnet) and run as a service.
  • Install and configure Prometheus metrics and set up a Grafana dashboard.

Warnings

Acknowledgements and Disclaimer

Support

  • EthStaker community on Reddit or Discord. Knowledgeable and friendly community passionate about staking on Ethereum 2.0.
  • Nimbus client team Discord. The client software engineering team. Experts on Nimbus and its usage.

Prerequisites

  • Ubuntu server v20.04 (LTS) amd64 or newer, installed and running on a local computer or in the cloud (AWS, Digital Ocean, Microsoft Azure, etc.). A local computer is encouraged for greater decentralization — if the cloud provider goes down then all nodes hosted with that provider go down.
  • MetaMask crypto wallet browser extension, installed and configured. A computer with a desktop (Mac, Windows, Linux) and a browser (Safari, Brave, FireFox, etc.) is required.

Note for Raspberry Pi Users

Requirements

  • Ubuntu server instance. I used v20.04 (LTS) amd64 server VM.
  • MetaMask crypto wallet browser extension, installed and configured.
  • Hardware requirements is a broad topic. In general a relatively modern CPU, 8GB RAM (16GB is better), a SSD of at least 1TB, and a stable internet connection with sufficient download speed and monthly data allowance are likely required for good staking performance on mainnet.

Overview

  • Set up a Eth1 Node and sync it with the Eth1 Blockchain (Göerli Testnet)
  • Generate the Validator Keys and Deposit Data
  • Configure the Nimbus client and sync it with the Eth1 Node
  • Deposit 32 Göerli Testnet ETH to activate the Validator Keys

Step 0 — Connect to the Server

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

Step 1 — Update the Server

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

Step 2 — Secure the Server

Configure the firewall

$ sudo ss -tulpn | grep ':<yourSSHportnumber>'
$ sudo ufw allow <yourSSHportnumber>/tcp
$ sudo nano /etc/ssh/sshd_config
$ sudo systemctl restart ssh
$ sudo ufw deny 22/tcp
$ sudo ufw allow 30303
$ sudo ufw allow 9000
$ sudo ufw allow 3000/tcp
$ sudo ufw allow 9090/tcp
$ sudo ufw enable
$ sudo ufw status numbered

Step 3 — Configure Timekeeping

$ timedatectl
$ sudo timedatectl set-ntp on

Step 4 — Install and Run Go Ethereum Node

Install Go Ethereum

$ sudo add-apt-repository -y ppa:ethereum/ethereum
$ sudo apt update
$ sudo apt install geth

Run Go Ethereum as a Background Service

$ sudo useradd --no-create-home --shell /bin/false goeth
$ sudo mkdir -p /var/lib/goethereum
$ sudo chown -R goeth:goeth /var/lib/goethereum
$ sudo nano /etc/systemd/system/geth.service
[Unit]
Description=Ethereum go client
After=network.target
Wants=network.target
[Service]
User=goeth
Group=goeth
Type=simple
Restart=always
RestartSec=5
ExecStart=geth --goerli --ws --datadir /var/lib/goethereum
[Install]
WantedBy=default.target
$ sudo systemctl daemon-reload
$ sudo systemctl start geth
$ sudo systemctl status geth
$ sudo systemctl enable geth
$ sudo journalctl -f -u geth.service
$ sudo systemctl stop geth
$ sudo nano /etc/systemd/system/geth.service
ExecStart=geth --goerli --http --datadir /var/lib/goethereum --bootnodes "enode://46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291@94.237.54.114:30313,enode://119f66b04772e8d2e9d352b81a15aa49d565590bfc9a80fe732706919f8ccd00a471cf8433e398c55c4862aadb4aadf3a010201483b87e8358951698aa0b6f07@13.250.50.139:30303"
$ sudo systemctl daemon-reload
$ sudo systemctl start geth
$ sudo journalctl -f -u geth.service

Step 5 — Generate Validator Keys and Deposit Data

  • Get Göerli ETH
  • Generate the validator keys. Each key is a validator account
  • Fund the validator account(s) (32 Göerli ETH per account)
  • Wait for your validator account(s) to become active

Get Goerli ETH

  1. Go to a computer with the MetaMask browser extension installed.
  2. Click on MetaMask and log in.
  3. Using the dropdown at the top, select the Göerli Test Network.
  4. Click on the account name to copy your Göerli ETH wallet address.
  5. Using your address, get Göerli ETH from the authenticated faucet or via the #request-goerli-eth channel on the ethstaker Discord using the bot command: !goerliEth <yourwalletaddress>.

Generate Validator Keys

$ cd ~
$ sudo apt install curl
$ curl -LO https://github.com/ethereum/eth2.0-deposit-cli/releases/download/v1.1.0/eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz
$ sudo tar xvf eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz
$ cd eth2deposit-cli-ed5a6d3-linux-amd64
$ sudo ./deposit new-mnemonic --num_validators <numberofvalidators> --mnemonic_language=english --chain pyrmont
$ cd ~
$ rm -rf eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz

Step 6— Install Nimbus Dependencies

$ sudo apt-get install build-essential git

Step 7— Clone and Build Nimbus

$ cd ~
$ git clone https://github.com/status-im/nimbus-eth2
$ cd nimbus-eth2
$ make NIMFLAGS="-d:insecure" nimbus_beacon_node

Step 8 — Copy the Nimbus Binary

$ sudo cp /$HOME/nimbus-eth2/build/nimbus_beacon_node /usr/local/bin

Step 9 — Import Validator Keys

$ sudo mkdir -p /var/lib/nimbus
$ sudo chown -R <yourusername>:<yourusername> /var/lib/nimbus
$ sudo chmod 700 /var/lib/nimbus
$ ls -dl /var/lib/nimbus
$ cd ~
$ cd nimbus-eth2
$ build/nimbus_beacon_node deposits import --data-dir=/var/lib/nimbus $HOME/eth2deposit-cli-ed5a6d3-linux-amd64/validator_keys

Step 10 — Configure the Beacon Node and Validator

Setup Accounts and Directories

$ sudo useradd --no-create-home --shell /bin/false nimbus
$ sudo chown -R nimbus:nimbus /var/lib/nimbus
$ ls -dl /var/lib/nimbus

Create and Configure the Service

$ sudo nano /etc/systemd/system/nimbus.service
[Unit]
Description=Nimbus Beacon Node
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=nimbus
Group=nimbus
Restart=always
WorkingDirectory=/var/lib/nimbus
Environment="ClientIP=$(curl -s v4.ident.me)"
ExecStart=/bin/bash -c '/usr/local/bin/nimbus_beacon_node --network=pyrmont --data-dir=/var/lib/nimbus --web3-url=ws://127.0.0.1:8546 --metrics --metrics-port=8008 --rpc --rpc-port=9091 --nat=extip:${ClientIP} --validators-dir=/var/lib/nimbus/validators --secrets-dir=/var/lib/nimbus/secrets --log-level=INFO --log-file=/var/lib/nimbus/beacon_node.log'
[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl start nimbus
$ sudo systemctl status nimbus
$ sudo systemctl enable nimbus
$ sudo journalctl -fu nimbus.service
Nov 24 22:25:56 ETH-STAKER-001 bash[65560]: INF 2020-11-24 22:25:31.197+00:00 Slot start                                 topics="beacnde" tid=65560 file=nimbus_beacon_node.nim:473 lastSlot=46326 scheduledSlot=46327 beaconTime=6d10h25m24s197ms907us264ns peers=1 head=1e6df25a:242 headEpoch=7 finalized=542c17b2:128 finalizedEpoch=4
Nov 24 22:25:56 ETH-STAKER-001 bash[65560]: NOT 2020-11-24 22:25:31.203+00:00 Syncing in progress; skipping validator duties for now topics="beacval" tid=65560 file=validator_duties.nim:519 slot=46327 headSlot=242
Nov 24 22:25:56 ETH-STAKER-001 bash[65560]: INF 2020-11-24 22:25:31.203+00:00 Slot end topics="beacnde" tid=65560 file=nimbus_beacon_node.nim:559 slot=46327 nextSlot=46328 head=1e6df25a:242 headEpoch=7 finalizedHead=542c17b2:128 finalizedEpoch=4
Nov 24 22:25:56 ETH-STAKER-001 bash[65560]: NOT 2020-11-24 22:25:34.396+00:00 Reached new finalization checkpoint topics="chaindag" tid=65560 file=chain_dag.nim:910 finalizedHead=6ad92bbe:189@192 heads=1 newHead=23e933aa:256

Step 11— Fund the Validator Keys

Check the Status of Your Validators

  1. Copy your Göerli Test Network MetaMask wallet address.
  2. Go here: https://pyrmont.beaconcha.in/
  3. Search for your key(s) using your wallet address.

Step 12 — Install Prometheus

Create User Accounts

$ sudo useradd --no-create-home --shell /bin/false prometheus
$ sudo useradd --no-create-home --shell /bin/false node_exporter

Create Directories

$ sudo mkdir /etc/prometheus
$ sudo mkdir /var/lib/prometheus
$ sudo chown -R prometheus:prometheus /etc/prometheus
$ sudo chown -R prometheus:prometheus /var/lib/prometheus

Download Prometheus software

$ cd ~
$ curl -LO https://github.com/prometheus/prometheus/releases/download/v2.22.2/prometheus-2.22.2.linux-amd64.tar.gz
$ tar xvf prometheus-2.22.2.linux-amd64.tar.gz
$ sudo cp prometheus-2.22.2.linux-amd64/prometheus /usr/local/bin/
$ sudo cp prometheus-2.22.2.linux-amd64/promtool /usr/local/bin/
$ sudo chown -R prometheus:prometheus /usr/local/bin/prometheus
$ sudo chown -R prometheus:prometheus /usr/local/bin/promtool
$ sudo cp -r prometheus-2.22.2.linux-amd64/consoles /etc/prometheus
$ sudo cp -r prometheus-2.22.2.linux-amd64/console_libraries /etc/prometheus
$ sudo chown -R prometheus:prometheus /etc/prometheus/consoles
$ sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
$ rm -rf prometheus-2.22.2.linux-amd64.tar.gz prometheus-2.22.2.linux-amd64

Edit the Configuration File

$ sudo nano /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'nimbus'
static_configs:
- targets: ['localhost:8008']
- job_name: 'node_exporter'
static_configs:
- targets: ['localhost:9100']
$ sudo chown -R prometheus:prometheus /etc/prometheus/prometheus.yml
$ sudo -u prometheus /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
level=info ts=2020-09-12T22:16:21.179Z caller=web.go:524 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2020-09-12T22:16:21.181Z caller=main.go:700 fs_type=EXT4_SUPER_MAGIC
level=info ts=2020-09-12T22:16:21.181Z caller=main.go:701 msg="TSDB started"
level=info ts=2020-09-12T22:16:21.182Z caller=main.go:805 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2020-09-12T22:16:21.182Z caller=main.go:833 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2020-09-12T22:16:21.183Z caller=main.go:652 msg="Server is ready to receive web requests."

Set Prometheus to Auto-Start as a Service

$ 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 systemctl enable prometheus

Step 11 — Install Node Exporter

$ cd ~
$ curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz
$ tar xvf node_exporter-1.0.1.linux-amd64.tar.gz
$ sudo cp node_exporter-1.0.1.linux-amd64/node_exporter /usr/local/bin
$ sudo chown -R node_exporter:node_exporter /usr/local/bin/node_exporter
$ rm -rf node_exporter-1.0.1.linux-amd64.tar.gz node_exporter-1.0.1.linux-amd64

Set Node Exporter to Auto-Start as a Service

$ 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
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 systemctl enable node_exporter

Test Prometheus and Node Exporter (Optional)

http://<yourserverip>:9090/new/graph?g0.expr=node_memory_MemFree_bytes&g0.tab=1&g0.stacked=0&g0.range_input=1h

Step 12 — 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: 7.3.3
Version table:
7.3.3 500
500 https://packages.grafana.com/oss/deb stable/main amd64 Packages
7.3.2 500
500 https://packages.grafana.com/oss/deb stable/main amd64 Packages
7.3.1 500
500 https://packages.grafana.com/oss/deb stable/main amd64
...
$ sudo apt install grafana
$ sudo systemctl start grafana-server
$ sudo systemctl status grafana-server
$ sudo systemctl enable grafana-server

Configure Grafana Login

Configure the Grafana Data Source

Import a Grafana Dashboard

Final Remarks

  • If you have feedback you can reach me on Twitter or Reddit.
  • If you liked this guide and think others would benefit from it then please share it using the friends link!
  • Tips appreciated: somer.eth

Appendix — Updating Nimbus

$ cd ~
$ cd nimbus-eth2
$ git pull
$ make update
$ make NIMFLAGS="-d:insecure" nimbus_beacon_node
$ sudo systemctl stop nimbus
$ sudo cp /$HOME/nimbus-eth2/build/nimbus_beacon_node /usr/local/bin
$ sudo systemctl start nimbus
$ sudo systemctl status nimbus # <-- Check for errors
$ sudo journalctl -fu nimbus.service # <-- Monitor

Appendix — Updating Geth

$ sudo systemctl stop geth
$ sudo systemctl stop nimbus
$ sudo apt update && upgrade
$ sudo systemctl start geth
$ sudo systemctl status geth # <-- Check for errors
$ sudo journalctl -f -u geth # <-- Monitor
$ sudo systemctl start nimbus
$ sudo systemctl status nimbus # <-- Check for errors
$ sudo journalctl -f -u nimbus.service # <-- Monitor

Unlisted

--

--

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.