Guide to Staking on Ethereum 2.0 (Ubuntu/Nimbus)

Acknowledgements

Disclaimer

Support

Prerequisites

Testnet to Mainnet

Requirements

Activation

Overview

Step 1 — Generate Staking Data

Download the Deposit Tool (Deposit CLI)

Run the Deposit Tool (Eth2 Deposit CLI)

./deposit new-mnemonic --num_validators <NumberOfValidators> --chain mainnet
deposit.exe new-mnemonic --num_validators <NumberOfValidators> --chain mainnet

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 update && sudo apt 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 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 deny 22/tcp
$ sudo ufw allow 30303
$ sudo ufw allow 9000
$ sudo ufw enable
$ sudo ufw status numbered

Step 5 — Configure Timekeeping

$ timedatectl
$ sudo timedatectl set-ntp on
$ ntpq -p
$ sudo apt-get remove ntp

Step 6— Set up an Ethereum (Eth1) Node

Install Go Ethereum

$ sudo add-apt-repository -y ppa:ethereum/ethereum
$ sudo apt update
$ sudo apt install geth
$ 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=Go Ethereum Client
After=network.target
Wants=network.target
[Service]
User=goeth
Group=goeth
Type=simple
Restart=always
RestartSec=5
ExecStart=geth --ws --datadir /var/lib/goethereum --cache 2048 --maxpeers 30
[Install]
WantedBy=default.target
$ sudo systemctl daemon-reload
$ sudo systemctl start geth
$ sudo systemctl status geth
$ sudo systemctl enable geth
$ sudo journalctl -fu geth.service

Check Sync Status

geth attach ws://127.0.0.1:8546
> eth.syncing

Check Connected Peers

geth attach ws://127.0.0.1:8546
> net.peerCount

Add Bootnodes (Optional)

$ sudo systemctl stop geth
$ sudo nano /etc/systemd/system/geth.service
ExecStart=geth --http --datadir /var/lib/goethereum --cache 2048 --maxpeers 30 --bootnodes "enode://d0b4a09d072b3f021e233fe55d43dc404a77eeaed32da9860cc72a5523c90d31ef9fab7f3da87967bc52c1118ca3241c0eced50290a87e0a91a271b5fac8d0a6@157.230.142.236:30303,enode://5070366042daaf15752fea340e7ffce3fd8fc576ac846034bd551c3eebac76db122a73fe8418804c5070a5e6d690fae133d9953f85d7aa00375d9a4a06741dbc@116.202.231.71:30303"
$ sudo systemctl daemon-reload
$ sudo systemctl start geth
$ sudo journalctl -fu geth.service

Step 7— Download Nimbus

$ cd ~
$ sudo apt install curl
$ curl -LO https://github.com/status-im/nimbus-eth2/releases/download/v1.0.0-rc1/nimbus-eth2_Linux_amd64_1.0.0_3594fa2a.tar.gz
$ tar xvf nimbus-eth2_Linux_amd64_1.0.0_3594fa2a.tar.gz
$ cd nimbus-eth2_Linux_amd64_1.0.0_3594fa2a
$ sudo cp build/nimbus_beacon_node /usr/local/bin
$ cd ~
$ sudo rm nimbus-eth2_Linux_amd64_1.0.0_3594fa2a.tar.gz
$ sudo rm -r nimbus-eth2_Linux_amd64_1.0.0_3594fa2a

Step 8— Import the Validator Keys

Copy the Validator Keystore Files

Import Keystore Files into the Validator Wallet

$ 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 /usr/local/bin
$ sudo nimbus_beacon_node deposits import --data-dir=/var/lib/nimbus $HOME/eth2deposit-cli/validator_keys

Step 9— Configure the Nimbus Service

Set up the Account and Directory

$ 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 Eth2 Client
Wants=network-online.target
After=network-online.target
[Service]
User=nimbus
Group=nimbus
Type=simple
Restart=always
RestartSec=5
WorkingDirectory=/var/lib/nimbus
Environment="ClientIP=$(curl -s v4.ident.me)"
ExecStart=/bin/bash -c '/usr/local/bin/nimbus_beacon_node --network=mainnet --data-dir=/var/lib/nimbus --web3-url=ws://127.0.0.1:8546 --nat=extip:${ClientIP} --graffiti="<yourgraffiti>" --log-level=INFO --log-file=/var/lib/nimbus/beacon_node.log'
[Install]
WantedBy=multi-user.target
--web3-url=ws://127.0.0.1:8546 --web3-url=wss://3rdPartyProviderURL
$ sudo systemctl daemon-reload
$ sudo systemctl start nimbus
$ sudo systemctl status nimbus
$ sudo systemctl enable nimbus
$ sudo journalctl -fu nimbus.service
NOT 2020-11-26 02:05:54.312+00:00 Starting beacon node
INF 2020-11-26 02:05:53.413+00:00 Initializing fork choice
INF 2020-11-26 02:05:53.413+00:00 Fork choice initialized
INF 2020-11-26 02:05:53.413+00:00 Loading slashing protection
WRN 2020-11-26 02:05:53.862+00:00 Validator not in registry (yet?)
NOT 2020-11-26 02:05:53.862+00:00 Local validator attached
WRN 2020-11-26 02:05:54.311+00:00 Validator not in registry (yet?)
NOT 2020-11-26 02:05:54.312+00:00 Local validator attached NOT 2020-11-26 02:05:54.312+00:00 Starting beacon node NOT 2020-11-26 02:05:54.312+00:00 Waiting for genesis INF 2020-11-26 02:05:54.312+00:00 Listening to incoming network requests

Step 10 — Fund the Validator Keys

Check the Status of Your Validator Deposits

Step 11 — Monitoring

Final Remarks and Recommended Next Steps

Further Reading

Appendix A — Updating Geth

$ sudo systemctl stop nimbus
$ 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 systemctl start nimbus
$ sudo systemctl status nimbus # <-- Check for errors
$ sudo journalctl -fu nimbus.service # <-- Monitor

Appendix B— Updating Nimbus

$ cd ~
$ sudo apt install curl
$ curl -LO https://github.com/status-im/nimbus-eth2/releases/download/v1.0.0-rc1/nimbus-eth2_Linux_amd64_1.0.0_3594fa2a.tar.gz
$ sudo systemctl stop nimbus
$ tar xvf nimbus-eth2_Linux_amd64_1.0.0_3594fa2a.tar.gz
$ cd nimbus-eth2_Linux_amd64_1.0.0_3594fa2a
$ sudo cp build/nimbus_beacon_node /usr/local/bin
$ sudo systemctl start nimbus
$ sudo systemctl status nimbus # <-- Check for errors
$ sudo journalctl -fu nimbus.service # <-- Monitor
$ cd ~
$ sudo rm nimbus-eth2_Linux_amd64_1.0.0_3594fa2a.tar.gz
$ sudo rm -r nimbus-eth2_Linux_amd64_1.0.0_3594fa2a

Appendix C — Adding a Validator

Appendix D — Pruning Geth

ethstaker@ETH-STAKER-002:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 796M 996K 795M 1% /run
/dev/hda1 155G 74G 82G 48% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/vda15 105M 5.2M 100M 5% /boot/efi
tmpfs 796M 0 796M 0% /run/user/1000
ethstaker@ETH-STAKER-002:~$

Start the Prune Operation

$ sudo systemctl stop geth
$ sudo journalctl -fu nimbus.service
$ sudo nano /etc/systemd/system/geth.service
[Unit]
Description=Go Ethereum Client
After=network.target
Wants=network.target
[Service]
User=goeth
Group=goeth
Type=simple
Restart=always
RestartSec=5
ExecStart=geth --http --datadir /var/lib/goethereum --cache 2048 --maxpeers 30 snapshot prune-state
[Install]
WantedBy=default.target
$ sudo systemctl daemon-reload
$ sudo systemctl start geth
$ sudo systemctl status geth
$ sudo systemctl stop geth
$ sudo nano /etc/systemd/system/geth.service
[Unit]
Description=Go Ethereum Client
After=network.target
Wants=network.target
[Service]
User=goeth
Group=goeth
Type=simple
Restart=always
RestartSec=5
ExecStart=geth --http --datadir /var/lib/goethereum --cache 2048 --maxpeers 30
[Install]
WantedBy=default.target
$ sudo systemctl daemon-reload
$ sudo systemctl start geth
$ sudo systemctl status geth # <-- Check for errors
$ sudo journalctl -fu geth.service # <-- Monitor
$ sudo journalctl -fu nimbus.service

Appendix E — Clear 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 F — Expanding the Logical Volume

$ sudo lvdisplay # <-- Check your logical volume size
$ sudo lvm
> lvextend -l +100%FREE /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.

More from Medium

What Will Happen After the Ethereum Merge?

Blockchain Dumbed Down

Fundamentals of Ethereum

Our Story and Journey. | by TC(C) Triple Confirmation | Apr, 2022 | Medium