How to setup a validator on ETH2 mainnet

Become a validator and help secure eth2, a proof-of-stake blockchain. Anyone with 32 ETH can join.

🏁 0. Prerequisites

Skills for operating a eth2 validator and beacon node

As a validator for eth2, you will typically have the following abilities:

  • operational knowledge of how to set up, run and maintain a eth2 beacon node and validator continuously
  • a long term commitment to maintain your validator 24/7/365
  • basic operating system skills

Experience required to be a successful validator

Minimum Setup Requirements

  • Operating system: 64-bit Linux (i.e. Ubuntu 20.04 LTS Server or Desktop)
  • Processor: Dual core CPU, Intel Core i5–760 or AMD FX-8100 or better
  • Memory: 8GB RAM
  • Storage: 20GB SSD
  • Internet: Broadband internet connection with speeds at least 1 Mbps.
  • Power: Reliable electrical power.
  • ETH balance: at least 32 ETH and some ETH for deposit transaction fees
  • Wallet: Metamask installed

Recommended Hardware Setup

  • Operating system: 64-bit Linux (i.e. Ubuntu 20.04 LTS Server or Desktop)
  • Processor: Quad core CPU, Intel Core i7–4770 or AMD FX-8310 or better
  • Memory: 16GB RAM or more
  • Storage: 1TB SSD or more
  • Internet: Broadband internet connections with speeds at least 10 Mbps without data limit.
  • Power: Reliable electrical power with uninterruptible power supply (UPS)
  • ETH balance: at least 32 ETH and some ETH for deposit transaction fees
  • Wallet: Metamask installed

Setup Ubuntu

If you need to install Ubuntu Server, refer to ubuntu

Setup Metamask

If you need to install Metamask, refer to metamask extension

High Level Validator Node Overview

At the end of this guide, you will build a node that hosts three main components: a validator client, a beacon chain client and an eth1 node.

Validator client – Responsible for producing new blocks and attestations in the beacon chain and shard chains.

Beacon chain client – Responsible for managing the state of the beacon chain, validator shuffling, and more.

Eth1 node – Supplies incoming validator deposits from the eth1 mainnet chain to the beacon chain client.

Note: Teku and Nimbus combines both clients into one process.

1. Buy/exchange or consolidate ETH

Every 32 ETH you own allows you to make 1 validator. You can run thousands of validators with your beacon node.

Your ETH (or multiples of 32 ETH) should be consolidated into a single address accessible with Metamask.

If you need to buy/exchange or top up your ETH to a multiple of 32, check out:

2. Signup to be a validator at the Launchpad

  1. Install dependencies, the ethereum foundation deposit tool and generate your two sets of key pairs.

Each validator will have two sets of key pairs. A signing key and a withdrawal key. These keys are derived from a single mnemonic phrase. Learn more about keys.

You have the choice of downloading the pre-built ethereum foundation deposit tool or building it from source.

Install dependencies.

sudo apt update
sudo apt install python3-pip git -y

Download source code and install.

cd $HOME
git clone https://github.com/ethereum/eth2.0-deposit-cli.git eth2deposit-cli
cd eth2deposit-cli
sudo ./deposit.sh install

Make a new mnemonic.

./deposit.sh new-mnemonic --chain mainnet

Download eth2deposit-cli.

cd $HOME
wget https://github.com/ethereum/eth2.0-deposit-cli/releases/download/v1.1.0/eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz

Verify the SHA256 Checksum matches the checksum on the releases page.

echo "2107f26f954545f423530e3501ae616c222b6bf77774a4f2743effb8fe4bcbe7 *eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz" | shasum -a 256 --check

Example valid output:

> eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz: OK

Only proceed if the sha256 check passes with OK!

Extract the archive.

tar -xvf eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz
mv eth2deposit-cli-ed5a6d3-linux-amd64 eth2deposit-cli
rm eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz
cd eth2deposit-cli

Make a new mnemonic.

./deposit new-mnemonic --chain mainnet

πŸ”₯**[ Optional ] Pro Security Tip**: Run the eth2deposit-cli tool and generate your mnemonic seed for your validator keys on an air-gapped offline machine booted from usb.

Follow this ethstaker.cc exclusive for the low down on making a bootable usb.

Part 1 – Create a Ubuntu 20.04 USB Bootable Drive

Part 2 – Install Ubuntu 20.04 from the USB Drive

You can copy via USB key the pre-built eth2deposit-cli binaries from an online machine to an air-gapped offline machine booted from usb. Make sure to disconnect the ethernet cable and/or WIFI.

  1. Follow the prompts and pick a KEYSTORE password. This password encrypts your keystore files. Write down your mnemonic and keep this safe and offline.

****🚧 Caution: Only deposit the 32 ETH per validator if you are confident your ETH1 node and ETH2 validator will be fully synched and ready to perform validator duties. You can return later to launchpad with your deposit-data to finish the next steps.

  1. Follow the steps at https://launchpad.ethereum.org/ while skipping over the steps you already just completed. Study the eth2 phase 0 overview material. Understanding eth2 is the key to success!

  2. Back on the launchpad website, upload yourdeposit_data-#########.json found in the validator_keys directory.

  3. Connect to the launchpad with your Metamask wallet, review and accept terms.

  4. Confirm the transaction(s). There’s one deposit transaction of 32 ETH for each validator.

Your transaction is sending and depositing your ETH to the official ETH2 deposit contract address.

Check, double-check, triple-check that the official Eth2 deposit contract address is correct.0x00000000219ab540356cBB839Cbe05303d7705Fa

****πŸ”₯ Critical Crypto Reminder: Keep your mnemonic, keep your ETH. πŸš€

  • Write down your mnemonic seed offline. Not email. Not cloud.
  • Multiple copies are better. Best stored in a metal seed.
  • The withdrawal keys will be generated from this mnemonic in the future.
  • Make offline backups, such as to a USB key, of your validator_keys directory.

πŸ›Έ 3. Install a ETH1 node

Ethereum 2.0 requires a connection to Ethereum 1.0 in order to monitor for 32 ETH validator deposits. Hosting your own Ethereum 1.0 node is the best way to maximize decentralization and minimize dependency on third parties such as Infura.

The subsequent steps assume you have completed the best practices security guide.

πŸ›‘ Do not run your processes as ROOT user. 😱

Your choice of either OpenEthereum, Geth, Besu, Nethermind or Infura.

OpenEthereum – It’s ****goal is to be the fastest, lightest, and most secure Ethereum client using the Rust programming language. OpenEthereum is licensed under the GPLv3 and can be used for all your Ethereum needs.

βš™ Install dependencies

sudo apt-get update
sudo apt-get install curl jq unzip -y

Install OpenEthereum

Review the latest release at https://github.com/openethereum/openethereum/releases

Automatically download the latest linux release, un-zip, add execute permissions and cleanup.

mkdir $HOME/openethereum
cd $HOME/openethereum
curl -s https://api.github.com/repos/openethereum/openethereum/releases/latest | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux | xargs wget -q --show-progress
unzip -o openethereum*.zip
chmod +x openethereum
rm openethereum*.zip

​ βš™ Setup and configure systemd

Run the following to create a unit file to define your eth1.service configuration.

Simply copy/paste the following.

cat > $HOME/eth1.service < $HOME/eth1.service < $HOME/eth1.service < $HOME/eth1.service << EOF 
[Unit]
Description     = nethermind eth1 service
Wants           = network-online.target
After           = network-online.target 

[Service]
User            = $(whoami)
ExecStart       = $(echo $HOME)/nethermind/Nethermind.Runner --baseDbPath $HOME/.nethermind --Metrics.Enabled true --JsonRpc.Enabled true --Sync.DownloadBodiesInFastSync true --Sync.DownloadReceiptsInFastSync true --Sync.AncientBodiesBarrier 11052984 --Sync.AncientReceiptsBarrier 11052984
Restart         = on-failure
RestartSec      = 3

[Install]
WantedBy    = multi-user.target
EOF

Move the unit file to /etc/systemd/system and give it permissions.

sudo mv $HOME/eth1.service /etc/systemd/system/eth1.service
sudo chmod 644 /etc/systemd/system/eth1.service

Run the following to enable auto-start at boot time.

sudo systemctl daemon-reload
sudo systemctl enable eth1

β›“ Start Nethermind

sudo systemctl start eth1

Note about Metric Error messages: You will see these until prometheus pushergateway is setup in section 6. Error in MetricPusher: System.Net.Http.HttpRequestException: Connection refused

Infura is suitable for limited disk space setups. Always run your own full eth1 node when possible.

Sign up for an API access key at https://infura.io/

  1. Sign up for a free account.
  2. Confirm your email address.
  3. Visit your dashboard https://infura.io/dashboard
  4. Create a project, give it a name.
  5. Select Mainnet as the ENDPOINT
  6. Follow the specific configuration for your eth2 client found below.

Alternatively use a free Ethereum node at https://ethereumnodes.com/

Nimbus Specific Configuration

  1. When creating your systemd’s unit file, update the --web-url parameter with this endpoint.
  2. Copy the websocket endpoint. Starts with wss://
  3. Save this for step 4, configuring your eth2 node.
#example
--web3-url=

Teku Specific Configuration

  1. After creating the teku.yaml located in /etc/teku/teku.yaml, update the --eth1-endpoint parameter with this endpoint.
  2. Copy the http endpoint. Starts with http://
  3. Save this for step 4, configuring your eth2 node.
#example
eth1-endpoint: 

Lighthouse Specific Configuration

  1. When creating your beacon chain systemd unit file, add the --eth1-endpoint parameter with this endpoint.
  2. Copy the https endpoint. Starts with https://
  3. Save this for step 4, configuring your eth2 node.
#example
--eth1-endpoint=

Prysm Specific Configuration

  1. When creating your beacon chain systemd unit file, update the --http-web3provider parameter with this endpoint.
  2. Copy the https endpoint. Starts with https://
  3. Save this for step 4, configuring your eth2 node.
#example
--http-web3provider=

{% hint style="info" %} Syncing an eth1 node can take up to 1 week. On high-end machines with gigabit internet, expect syncing to take less than a day.

Your eth1 node is fully sync’d when these events occur.

  • OpenEthereum: Imported #
  • Geth: Imported new chain segment
  • Besu: Imported #
  • Nethermind: No longer syncing Old Headers

πŸ›  Helpful eth1.service commands

​​ πŸ—’ To view and follow eth1 logs

journalctl -u eth1 -f

πŸ—’ To stop eth1 service

sudo systemctl stop eth1

4. Configure a ETH2 beacon chain node and validator

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

Lighthouse is an Eth2.0 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.

βš™ 4.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

πŸ’‘ 4.2. Build Lighthouse from source

mkdir ~/git
cd ~/git
git clone https://github.com/sigp/lighthouse.git
cd lighthouse
git fetch --all && git checkout stable && git pull
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

🎩 4.3. Import validator key

When you import your keys into Lighthouse, your validator signing key(s) are stored in the $HOME/.lighthouse/mainnet/validators folder.

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

Enter your keystore password to import accounts.

lighthouse account validator import --network mainnet --directory=$HOME/eth2deposit-cli/validator_keys

Verify the accounts were imported successfully.

lighthouse account_manager validator list --network mainnet

WARNING: DO NOT USE THE ORIGINAL KEYSTORES TO VALIDATE WITH ANOTHER CLIENT, OR YOU WILL GET SLASHED.

πŸ”₯ 4.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 beacon chain requires port 9000 for tcp and udp
  • eth1 node requires port 30303 for tcp and udp

✨ Port Forwarding Tip: You’ll need to forward and open ports to your validator. Verify it’s working with https://www.yougetsignal.com/tools/open-ports/ or https://canyouseeme.org/ .

β›“ 4.5. Start the beacon chain

🍰 Benefits of using systemd for your beacon chain <a id="benefits-of-using-systemd-for-your-stake-pool"></a>

  1. Auto-start your beacon chain when the computer reboots due to maintenance, power outage, etc.
  2. Automatically restart crashed beacon chain processes.
  3. Maximize your beacon chain up-time and performance.

πŸ›  Setup Instructions for Systemd

Run the following to create a unit file to define yourbeacon-chain.service configuration. Simply copy and paste.

cat &gt; $HOME/beacon-chain.service &lt;&lt; EOF 
# The eth2 beacon chain service (part of systemd)
# file: /etc/systemd/system/beacon-chain.service 

[Unit]
Description     = eth2 beacon chain service
Wants           = network-online.target
After           = network-online.target 

[Service]
User            = $(whoami)
ExecStart       = $(which lighthouse) bn --staking --metrics --network mainnet
Restart         = on-failure

[Install]
WantedBy    = multi-user.target
EOF

****πŸ”₯ Lighthouse Pro Tip: On the ExecStart line, adding the --eth1-endpoints flag allows for redundant eth1 nodes. Separate with comma. Make sure the endpoint does not end with a trailing slash or/ Remove it.

# Example:
--eth1-endpoints http://localhost:8545,https://nodes.mewapi.io/rpc/eth,https://mainnet.eth.cloud.ava.do,https://mainnet.infura.io/v3/xxx

πŸ’Έ Find free ethereum fallback nodes at https://ethereumnodes.com/

Move the unit file to /etc/systemd/system

sudo mv $HOME/beacon-chain.service /etc/systemd/system/beacon-chain.service

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

Troubleshooting common issues:

The beacon chain couldn’t connect to the :8545 service?

  • In the beacon chain unit file under [Service], add, "ExecStartPre = /bin/sleep 30" so that it waits 30 seconds for eth1 node to startup before connecting.

CRIT Invalid eth1 chain id. Please switch to correct chain id.

  • Allow your eth1 node to fully sync to mainnet.

Nice work. Your beacon chain is now managed by the reliability and robustness of systemd. Below are some commands for using systemd.

πŸ›  Some helpful 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'

βœ… Check whether the beacon chain is active

sudo systemctl is-active beacon-chain

πŸ”Ž 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

🧬 4.6. Start the validator

πŸš€ Setup Graffiti and POAP

Setup your graffiti, a custom message included in blocks your validator successfully proposes, and earn a POAP token. Generate your POAP string by supplying an Ethereum 1.0 address here.

Run the following command to set the MY_GRAFFITI variable. Replace “ between the single quotes.

MY_GRAFFITI=''
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

Learn more about POAP – The Proof of Attendance token.

🍰 Benefits of using systemd for your validator <a id="benefits-of-using-systemd-for-your-stake-pool"></a>

  1. Auto-start your validator when the computer reboots due to maintenance, power outage, etc.
  2. Automatically restart crashed validator processes.
  3. Maximize your validator up-time and performance.

πŸ›  Setup Instructions for Systemd

Run the following to create a unit file to define yourvalidator.service configuration. Simply copy and paste.

cat &gt; $HOME/validator.service &lt;&lt; EOF 
# The eth2 validator service (part of systemd)
# file: /etc/systemd/system/validator.service 

[Unit]
Description     = eth2 validator service
Wants           = network-online.target beacon-chain.service
After           = network-online.target 

[Service]
User            = $(whoami)
ExecStart       = $(which lighthouse) vc --network mainnet --graffiti &quot;${MY_GRAFFITI}&quot; --metrics 
Restart         = on-failure

[Install]
WantedBy    = multi-user.target
EOF

Move the unit file to /etc/systemd/system

sudo mv $HOME/validator.service /etc/systemd/system/validator.service

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. Below are some commands for using systemd.

πŸ›  Some helpful systemd commands

πŸ—„ Viewing and filtering logs

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

βœ… Check whether the validator is active

sudo systemctl is-active validator

πŸ”Ž View the status of the validator

sudo systemctl status validator

πŸ”„ Restarting the validator

sudo systemctl reload-or-restart validator

πŸ›‘ Stopping the validator

sudo systemctl stop validator

Nimbus is a research project and a client implementation for Ethereum 2.0 designed to perform well on embedded systems and personal mobile devices, including older smartphones with resource-restricted hardware. The Nimbus team are from Status the company best known for their messaging app/wallet/Web3 browser by the same name. Nimbus (Apache 2) is written in Nim, a language with Python-like syntax that compiles to C.

βš™ 4.1. Build Nimbus from source

Install dependencies.

sudo apt-get update
sudo apt-get install curl build-essential git -y

Install and build Nimbus.

mkdir ~/git 
cd ~/git
git clone https://github.com/status-im/nimbus-eth2
cd nimbus-eth2
make NIMFLAGS=&quot;-d:insecure&quot; nimbus_beacon_node

The build process may take a few minutes.

Verify Nimbus was installed properly by displaying the help.

cd $HOME/git/nimbus-eth2/build
./nimbus_beacon_node --help

Copy the binary file to /usr/bin

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

🎩 4.2. Import validator key <a id="6-import-validator-key"></a>

Create a directory structure to store nimbus data.

sudo mkdir -p /var/lib/nimbus

Take ownership of this directory and set the correct permission level.

sudo chown $(whoami):$(whoami) /var/lib/nimbus
sudo chmod 700 /var/lib/nimbus

The following command will import your validator keys.

Enter your keystore password to import accounts.

cd $HOME/git/nimbus-eth2
build/nimbus_beacon_node deposits import --data-dir=/var/lib/nimbus $HOME/eth2deposit-cli/validator_keys

Now you can verify the accounts were imported successfully by doing a directory listing.

ll /var/lib/nimbus/validators

You should see a folder named for each of your validator’s pubkey.

When you import your keys into Nimbus, your validator signing key(s) are stored in the /var/lib/nimbus folder, under secrets and validators.

The secrets folder contains the common secret that gives you access to all your validator keys.

The validators folder contains your signing keystore(s) (encrypted keys). Keystores are used by validators as a method for exchanging keys.

For more on keys and keystores, see here.

WARNING: DO NOT USE THE ORIGINAL KEYSTORES TO VALIDATE WITH ANOTHER CLIENT, OR YOU WILL GET SLASHED.

πŸ”₯ 4.3. 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.

  • Nimbus beacon chain node will use port 9000 for tcp and udp
  • eth1 node requires port 30303 for tcp and udp

✨ Port Forwarding Tip: You’ll need to forward and open ports to your validator. Verify it’s working with https://www.yougetsignal.com/tools/open-ports/ or https://canyouseeme.org/ .

πŸ‚ 4.4. Start the beacon chain and validator

Nimbus combines both the beacon chain and validator into one process.

πŸš€ Setup Graffiti and POAP

Setup your graffiti, a custom message included in blocks your validator successfully proposes, and earn a POAP token. Generate your POAP string by supplying an Ethereum 1.0 address here.

Run the following command to set the MY_GRAFFITI variable. Replace “ between the single quotes.

MY_GRAFFITI=''
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

Learn more about POAP – The Proof of Attendance token.

🍰 Benefits of using systemd for your beacon chain and validator <a id="benefits-of-using-systemd-for-your-stake-pool"></a>

  1. Auto-start your beacon chain when the computer reboots due to maintenance, power outage, etc.
  2. Automatically restart crashed beacon chain processes.
  3. Maximize your beacon chain up-time and performance.

πŸ›  Setup Instructions

Run the following to create a unit file to define yourbeacon-chain.service configuration. Simply copy and paste.

cat &gt; $HOME/beacon-chain.service &lt; $HOME/validators-password.txt
sudo mv $HOME/validators-password.txt /etc/teku/validators-password.txt
sudo chmod 600 /etc/teku/validators-password.txt

πŸš€ Setup Graffiti and POAP

Setup your graffiti, a custom message included in blocks your validator successfully proposes, and earn a POAP token. Generate your POAP string by supplying an Ethereum 1.0 address here.

Run the following command to set the MY_GRAFFITI variable. Replace “ between the single quotes.

MY_GRAFFITI=''
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

Learn more about POAP – The Proof of Attendance token.

Generate your Teku Config file. Simply copy and paste.

cat &gt; $HOME/teku.yaml &lt;&lt; EOF
# network
network: &quot;mainnet&quot;

# p2p
p2p-enabled: true
p2p-port: 9000
# validators
validator-keys: &quot;/var/lib/teku/validator_keys:/var/lib/teku/validator_keys&quot;
validators-graffiti: &quot;${MY_GRAFFITI}&quot;

# Eth 1
eth1-endpoint: &quot;http://localhost:8545&quot;

# metrics
metrics-enabled: true
metrics-port: 8008

# database
data-path: &quot;$(echo $HOME)/tekudata&quot;
data-storage-mode: &quot;archive&quot;

# rest api
rest-api-port: 5051
rest-api-docs-enabled: true
rest-api-enabled: true

# logging
log-include-validator-duties-enabled: true
log-destination: CONSOLE
EOF

Move the config file to /etc/teku

sudo mv $HOME/teku.yaml /etc/teku/teku.yaml

🎩 4.4 Import validator key

When specifying directories for your validator-keys, Teku expects to find identically named keystore and password files.

For example keystore-m_12221_3600_1_0_0-11222333.json and keystore-m_12221_3600_1_0_0-11222333.txt

Create a corresponding password file for every one of your validators.

for f in /var/lib/teku/validator_keys/keystore*.json; do cp /etc/teku/validators-password.txt /var/lib/teku/validator_keys/$(basename $f .json).txt; done

Verify that your validator’s keystore and validator’s passwords are present by checking the following directory.

ll /var/lib/teku/validator_keys

🏁 4.5. Start the beacon chain and validator

Use systemd to manage starting and stopping teku.

🍰 Benefits of using systemd for your beacon chain and validator <a id="benefits-of-using-systemd-for-your-stake-pool"></a>

  1. Auto-start your beacon chain when the computer reboots due to maintenance, power outage, etc.
  2. Automatically restart crashed beacon chain processes.
  3. Maximize your beacon chain up-time and performance.

πŸ›  Setup Instructions

Run the following to create a unit file to define yourbeacon-chain.service configuration.

cat &gt; $HOME/beacon-chain.service &lt; \#Example output:
&gt;
&gt; Showing 1 validator account View the eth1 deposit transaction data for your accounts by running \`validator accounts list --show-deposit-data
&gt;
&gt; Account 0 \| pens-brother-heat   
&gt; \[validating public key\] 0x2374.....7121

**WARNING**: DO NOT USE THE ORIGINAL KEYSTORES TO VALIDATE WITH ANOTHER CLIENT, OR YOU WILL GET SLASHED.

## πŸ‚ 4.4. Start the beacon chain

#### 🍰 Benefits of using systemd for your beacon chain and validator <a id="benefits-of-using-systemd-for-your-stake-pool"></a>

1. Auto-start your beacon chain when the computer reboots due to maintenance, power outage, etc.
2. Automatically restart crashed beacon chain processes.
3. Maximize your beacon chain up-time and performance.

#### πŸ›  Setup Instructions

Run the following to create a **unit file** to define your`beacon-chain.service` configuration. Simply copy and paste.

```bash
cat &gt; $HOME/beacon-chain.service &lt;&lt; EOF 
# The eth2 beacon chain service (part of systemd)
# file: /etc/systemd/system/beacon-chain.service 

[Unit]
Description     = eth2 beacon chain service
Wants           = network-online.target
After           = network-online.target 

[Service]
Type            = simple
User            = $(whoami)
ExecStart       = $(echo $HOME)/prysm/prysm.sh beacon-chain --mainnet --p2p-max-peers=75 --http-web3provider=http://127.0.0.1:8545 --accept-terms-of-use 
Restart         = on-failure

[Install]
WantedBy    = multi-user.target
EOF

****πŸ”₯ Prysm Pro Tip: On the ExecStart line, adding the --fallback-web3provider flag allows for a backup eth1 node. May use flag multiple times. Make sure the endpoint does not end with a trailing slash or/ Remove it.

--fallback-web3provider=&lt;http:// --fallback-web3provider=&lt;http://
# Example
# --fallback-web3provider=https://nodes.mewapi.io/rpc/eth --fallback-web3provider=https://mainnet.infura.io/v3/YOUR-PROJECT-ID

πŸ’Έ Find free ethereum fallback nodes at https://ethereumnodes.com/

Move the unit file to /etc/systemd/system

sudo mv $HOME/beacon-chain.service /etc/systemd/system/beacon-chain.service

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. Below are some commands for using systemd.

πŸ›  Some helpful 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'

βœ… Check whether the beacon chain is active

sudo systemctl is-active beacon-chain

πŸ”Ž 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

🧬 4.5. Start the validator <a id="9-start-the-validator"></a>

Store your prysm-only password in a file and make it read-only. This is required so that Prysm can decrypt and load your validators.

echo 'my_password_goes_here' &gt; $HOME/.eth2validators/validators-password.txt
sudo chmod 600 $HOME/.eth2validators/validators-password.txt

πŸš€ Setup Graffiti and POAP

Setup your graffiti, a custom message included in blocks your validator successfully proposes, and earn a POAP token. Generate your POAP string by supplying an Ethereum 1.0 address here.

Run the following command to set the MY_GRAFFITI variable. Replace “ between the single quotes.

MY_GRAFFITI=''
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

Learn more about POAP – The Proof of Attendance token.

Your choice of running a validator manually from command line or automatically with systemd.

🍰 Benefits of using systemd for your validator <a id="benefits-of-using-systemd-for-your-stake-pool"></a>

  1. Auto-start your validator when the computer reboots due to maintenance, power outage, etc.
  2. Automatically restart crashed validator processes.
  3. Maximize your validator up-time and performance.

πŸ›  Setup Instructions for systemd

Run the following to create a unit file to define yourvalidator.service configuration. Simply copy and paste.

cat &gt; $HOME/validator.service &lt;= 1.22.4

Install nodejs.

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

Confirm nodejs is installed properly.

nodejs -v
# Should output version &gt;= v12.18.3

Install and build Lodestar.

mkdir ~/git
cd ~/git
git clone https://github.com/chainsafe/lodestar.git
cd lodestar
yarn install
yarn run build

This build process may take a few minutes.

Verify Lodestar was installed properly by displaying the help menu.

yarn run cli --help

πŸ”₯ 4.2. 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.

  • Lodestar beacon chain node will use port 30607 for tcp and port 9000 for udp peer discovery.
  • eth1 node requires port 30303 for tcp and udp

****✨ Port Forwarding Tip: You’ll need to forward and open ports to your validator. Verify it’s working with https://www.yougetsignal.com/tools/open-ports/ or https://canyouseeme.org/ .

🎩 4.3. Import validator key

yarn run cli account validator import \
  --network mainnet \
  --directory $HOME/eth2deposit-cli/validator_keys

Enter your keystore password to import accounts.

Confirm your keys were imported properly.

yarn run cli account validator list --network mainnet

WARNING: DO NOT USE THE ORIGINAL KEYSTORES TO VALIDATE WITH ANOTHER CLIENT, OR YOU WILL GET SLASHED.

πŸ‚ 4.4. Start the beacon chain and validator

Run the beacon chain automatically with systemd.

🍰 Benefits of using systemd for your beacon chain <a id="benefits-of-using-systemd-for-your-stake-pool"></a>

  1. Auto-start your beacon chain when the computer reboots due to maintenance, power outage, etc.
  2. Automatically restart crashed beacon chain processes.
  3. Maximize your beacon chain up-time and performance.

πŸ›  Setup Instructions

Run the following to create a unit file to define yourbeacon-chain.service configuration. Simply copy and paste.

cat &gt; $HOME/beacon-chain.service &lt;&lt; EOF 
# The eth2 beacon chain service (part of systemd)
# file: /etc/systemd/system/beacon-chain.service 

[Unit]
Description     = eth2 beacon chain service
Wants           = network-online.target
After           = network-online.target 

[Service]
User            = $(whoami)
WorkingDirectory= $(echo $HOME)/git/lodestar
ExecStart       = yarn run cli beacon --network mainnet --eth1.providerUrl http://localhost:8545 --metrics.serverPort 8008
Restart         = on-failure

[Install]
WantedBy	= multi-user.target
EOF

Move the unit file to /etc/systemd/system

sudo mv $HOME/beacon-chain.service /etc/systemd/system/beacon-chain.service

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. Below are some commands for using systemd.

πŸ›  Some helpful 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'

βœ… Check whether the beacon chain is active

sudo systemctl is-active beacon-chain

πŸ”Ž 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

🧬 4.5. Start the validator

πŸš€ Setup Graffiti and POAP

Setup your graffiti, a custom message included in blocks your validator successfully proposes, and earn a POAP token. Generate your POAP string by supplying an Ethereum 1.0 address here.

Run the following command to set the MY_GRAFFITI variable. Replace “ between the single quotes.

MY_GRAFFITI=''
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

Learn more about POAP – The Proof of Attendance token.

Run the validator automatically with systemd.

🍰 Benefits of using systemd for your validator <a id="benefits-of-using-systemd-for-your-stake-pool"></a>

  1. Auto-start your validator when the computer reboots due to maintenance, power outage, etc.
  2. Automatically restart crashed validator processes.
  3. Maximize your validator up-time and performance.

πŸ›  Setup Instructions

Run the following to create a unit file to define yourvalidator.service configuration. Simply copy and paste.

cat &gt; $HOME/validator.service &lt; grafana.list
sudo mv grafana.list /etc/apt/sources.list.d/grafana.list
sudo apt-get update &amp;&amp; sudo apt-get install -y grafana

Enable services so they start automatically.

sudo systemctl enable grafana-server.service prometheus.service prometheus-node-exporter.service

Create the prometheus.yml config file. Choose the tab for your eth2 client. Simply copy and paste.

cat &gt; $HOME/prometheus.yml &lt; $HOME/prometheus.yml &lt; $HOME/prometheus.yml &lt; $HOME/prometheus.yml &lt; $HOME/prometheus.yml &lt;&lt; EOF   
scrape_configs:
   - job_name: 'node_exporter'
     static_configs:
       - targets: ['localhost:9100']
   - job_name: 'Lodestar'
     metrics_path: /metrics    
     static_configs:
       - targets: ['localhost:8008']
EOF

Setup prometheus for your eth1 node. Start by editing prometheus.yml

nano $HOME/prometheus.yml

Append the applicable job snippet for your eth1 node to the end of prometheus.yml. Save the file.

Spacing matters. Ensure all job_name snippets are in alignment.

   - job_name: 'geth'
     scrape_interval: 15s
     scrape_timeout: 10s
     metrics_path: /debug/metrics/prometheus
     scheme: http
     static_configs:
     - targets: ['localhost:6060']
   - job_name: 'besu'
     scrape_interval: 15s
     scrape_timeout: 10s
     metrics_path: /metrics
     scheme: http
     static_configs:
     - targets:
       - localhost:9545
   - job_name: 'nethermind'
     scrape_interval: 15s
     scrape_timeout: 10s
     honor_labels: true
     static_configs:
       - targets: ['localhost:9091']

Nethermind monitoring requires Prometheus Pushgateway. Install with the following command.

sudo apt-get install -y prometheus-pushgateway

Pushgateway listens for data from Nethermind on port 9091.

Work in progress

Move it to /etc/prometheus/prometheus.yml

sudo mv $HOME/prometheus.yml /etc/prometheus/prometheus.yml

Update file permissions.

sudo chmod 644 /etc/prometheus/prometheus.yml

Finally, restart the services.

sudo systemctl restart grafana-server.service prometheus.service prometheus-node-exporter.service

Verify that the services are running properly:

sudo systemctl status grafana-server.service prometheus.service prometheus-node-exporter.service

πŸ’‘ Reminder: Ensure port 3000 is open on the firewall and/or port forwarded if you intend to view monitoring info from a different machine.

πŸ“Ά 6.2 Setting up Grafana Dashboards

  1. Open http://localhost:3000 or http://<your validator’s ip address>:3000 in your local browser.
  2. Login with admin / admin
  3. Change password
  4. Click the configuration gear icon, then Add data Source
  5. Select Prometheus
  6. Set Name to "Prometheus"
  7. Set URL to http://localhost:9090
  8. Click Save & Test
  9. Download and save your ETH2 Client’s json file. [ Lighthouse BC | Lighthouse VC | Teku | Nimbus | Prysm | Prysm > 10 Validators | Lodestar ]
  10. Download and save your ETH1 Client’s json file [ Geth | Besu | Nethermind | OpenEthereum ]
  11. Download and save a node-exporter dashboard for general system monitoring
  12. Click Create + icon > Import
  13. Add the ETH2 client dashboard via Upload JSON file
  14. If needed, select Prometheus as Data Source.
  15. Click the Import button.
  16. Repeat steps 12-15 for the ETH1 client dashboard.
  17. Repeat steps 12-15 for the node-exporter dashboard.

The dashboards do not display eth1 node data.

  • In the eth1 unit file under located at /etc/systemd/system/eth1.service, make sure your eth1 node/geth is started with the correct parameters so that reporting metrics and pprof http server are enabled.
    • Example:ExecStartPre = /usr/bin/geth --http --metrics --pprof

Example of Grafana Dashboards for each ETH2 client.

Beacon Chain dashboard by sigp

Validator Client dashboard by sigp

Credits: https://github.com/sigp/lighthouse-metrics/

Dashboard by status-im

Credits: https://github.com/status-im/nimbus-eth2/

Teku by PegaSys Engineering

Credits: https://grafana.com/grafana/dashboards/13457

Prysm dashboard by GuillaumeMiralles

Credits: https://github.com/GuillaumeMiralles/prysm-grafana-dashboard

Example of Grafana Dashboards for each ETH1 node.

Dashboard by karalabe

Credits: https://gist.github.com/karalabe/e7ca79abdec54755ceae09c08bd090cd

Credits: https://grafana.com/dashboards/10273

Credits: https://github.com/NethermindEth/metrics-infrastructure

Example of Node-Exporter Dashboard

General system monitoring

Includes: CPU, memory, disk IO, network, temperature and other monitoring metrics。

Credits: starsliao

⚠ 6.3 Setup Alert Notifications

Setup alerts to get notified if your validators go offline.

Get notified of problems with your validators. Choose between email, telegram, discord or slack.

  1. Visit https://beaconcha.in/

  2. Sign up for an account.

  3. Verify your email

  4. Search for your validator’s public address

  5. Add validators to your watchlist by clicking the bookmark symbol.

  6. On the menu of Grafana, select Notification channels under the bell icon.

  7. Click on Add channel.

  8. Give the notification channel a name.

  9. Select Telegram from the Type list.

  10. To complete the Telegram API settings, a Telegram channel and bot are required. For instructions on setting up a bot with @Botfather, see this section of the Telegram documentation. You need to create a BOT API token.

  11. Create a new telegram group.

  12. Invite the bot to your new group.

  13. Type at least 1 message into the group to initialize it.

  14. Visit https://api.telegram.org/botXXX:YYY/getUpdates where XXX:YYY is your BOT API Token.

  15. In the JSON response, find and copy the Chat ID. Find it between chat and title. Example of Chat ID: -1123123123

    &quot;chat&quot;:{&quot;id&quot;:-123123123,&quot;title&quot;:
    
  16. Paste the Chat ID into the corresponding field in Grafana.

  17. Save and test the notification channel for your alerts.

  18. Now you can create custom alerts from your dashboards. Visit here to learn how to create alerts.

  19. On the menu of Grafana, select Notification channels under the bell icon.

  20. Click on Add channel.

  21. Add a name to the notification channel.

  22. Select Discord from the Type list.

  23. To complete the set up, a Discord server (and a text channel available) as well as a Webhook URL are required. For instructions on setting up a Discord’s Webhooks, see this section of their documentation.

  24. Enter the Webhook URL in the Discord notification settings panel.

  25. Click Send Test, which will push a confirmation message to the Discord channel.

  26. On the menu of Grafana, select Notification channels under the bell icon.

  27. Click on Add channel.

  28. Add a name to the notification channel.

  29. Select Slack from the Type list.

  30. For instructions on setting up a Slack’s Incoming Webhooks, see this section of their documentation.

  31. Enter the Slack Incoming Webhook URL in the URL field.

  32. Click Send Test, which will push a confirmation message to the Slack channel.

🌊 6.4 Monitoring with Uptime Check by Google Cloud

Who watches the watcher? With an external 3rd party tool like Uptime Check, you can have greater reassurance your validator is functioning in case of disasters such as power failure, hardware failure or internet outage. In these scenarios, the previously mentioned monitoring by Prometheus and Grafana would likely cease to function as well.

Credits to Mohamed Mansour for inspiring this how-to guide.

Here’s how to setup a no-cost monitoring service called Uptime Check by Google.

For a video demo, watch MohamedMansour’s eth2 education videos. Please support his GITCOIN grant. πŸ™

  1. Visit cloud.google.com
  2. Search for Monitoring in the search field.
  3. Click Select a Project to Start Monitoring.
  4. Click New Project.
  5. Name your project and click Create.
  6. From the notifications menu, select your new project.
  7. On the right column, there’s a Monitoring Card. Click Go to Monitoring.
  8. On the left menu, click Uptime checks and then CREATE UPTIME CHECK.
  9. Type in a title i.e. Geth node
  10. Select protocol as TCP
  11. Enter your public IP address and port number. i.e. ip=7.55.6.3 and port=30303
  12. Select your desired frequency to check i.e. 5 minutes.
  13. Choose the region closest to you to check from. Click Next.
  14. Create a Notification Channel. Click Manage Notification Channels.
  15. Choose your desired settings. Pick from any or all of Slack, Webhook, Email or SMS.
  16. Go back to Create Uptime Check window.
  17. Within the notifications field, click the refresh button to load your new notification channels.
  18. Select desired notifications.
  19. Click TEST to verify your notifications are setup correctly.
  20. Click CREATE to finish.

Once your beacon chain is sync’d, 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://beaconcha.in/ to create alerts and track your validator’s performance.

Be sure to review the Checklist | How to confirm a healthy functional ETH2 validator.

πŸŽ‰Congrats on setting up your validator! You’re good to go on eth2.0.

Did you find our guide useful? Send us a signal with a tip and we’ll keep updating it.

Use cointr.ee to find our donation addresses. πŸ™

Any feedback and all pull requests much appreciated. πŸŒ›

Hang out and chat with fellow stakers on Discord @

https://discord.gg/w8Bx8W2HPW πŸ˜ƒ

πŸ§™β™‚7. Update a ETH2 client

When a new release is cut, you will want to update to the latest stable release. The following shows you how to update your eth2 beacon chain and validator.

Always review the git logs with commandgit log or release notes before updating. There may be changes requiring your attention.

****πŸ”₯ Pro tip: Plan your update to overlap with the longest attestation gap. Learn how here.

Select your ETH2 client.

Review release notes and check for breaking changes/features.

https://github.com/sigp/lighthouse/releases

Pull the latest source and build it.

cd $HOME/git/lighthouse
git fetch --all &amp;&amp; git checkout stable &amp;&amp; git pull
make

Verify the build completed by checking the new version number.

lighthouse --version

Restart beacon chain and validator as per normal operating procedures.

sudo systemctl reload-or-restart beacon-chain validator

Review release notes and check for breaking changes/features.

https://github.com/status-im/nimbus-eth2/releases

Pull the latest source and build it.

cd $HOME/git/nimbus-eth2
git pull &amp;&amp; make update
make NIMFLAGS=&quot;-d:insecure&quot; nimbus_beacon_node

Verify the build completed by checking the new version number.

cd $HOME/git/nimbus-eth2/build
./nimbus_beacon_node --version

Stop, copy new binary, and restart beacon chain and validator as per normal operating procedures.

sudo systemctl stop beacon-chain
sudo rm /usr/bin/nimbus_beacon_node
sudo cp $HOME/git/nimbus-eth2/build/nimbus_beacon_node /usr/bin
sudo systemctl reload-or-restart beacon-chain

Review release notes and check for breaking changes/features.

https://github.com/ConsenSys/teku/releases

Pull the latest source and build it.

cd $HOME/git/teku
git pull
./gradlew distTar installDist

Verify the build completed by checking the new version number.

cd $HOME/git/teku/build/install/teku/bin
./teku --version

Restart beacon chain and validator as per normal operating procedures.

sudo systemctl stop beacon-chain
sudo rm -rf /usr/bin/teku
sudo cp -r $HOME/git/teku/build/install/teku /usr/bin/teku
sudo systemctl reload-or-restart beacon-chain

Review release notes and check for breaking changes/features. https://github.com/prysmaticlabs/prysm/releases

#Simply restart the processes
sudo systemctl reload-or-restart beacon-chain validator

Review release notes and check for breaking changes/features.

https://github.com/ChainSafe/lodestar/releases

Pull the latest source and build it.

cd $HOME/git/lodestar
git pull
yarn install
yarn run build

Verify the build completed by checking the new version number.

yarn run cli --version

Restart beacon chain and validator as per normal operating procedures.

sudo systemctl reload-or-restart beacon-chain validator

Check the logs to verify the services are working properly and ensure there are no errors.

sudo systemctl status beacon-chain validator
sudo systemctl status beacon-chain

πŸ”₯8. Additional Useful Tips

πŸ›‘ 8.1 Voluntary exit a validator

Use this command to signal your intentions to stop validating with your validator. This means you no longer want to stake with your validator and want to turn off your node.

  • Voluntary exiting takes a minimum of 2048 epochs (or ~9days). There is a queue to exit and a delay before your validator is finally exited.
  • Once a validator is exited in phase 0, this is non-reversible and you can no longer restart validating again.
  • Your funds will not be available for withdrawal until phase 1.5 or later.
  • After your validator leaves the exit queue and is truely exited, it is safe to turn off your beacon node and validator.
lighthouse account validator exit \
--keystore $HOME/.lighthouse/mainnet/validators \
--beacon-node http://localhost:5052 \
--network mainnet
teku voluntary-exit \
--epoch= \
--beacon-node-api-endpoint=http://127.0.0.1:5051 \
--validator-keys=:
build/nimbus_beacon_node deposits exit --validator= --data-dir=/var/lib/nimbus
$HOME/prysm/prysm.sh validator accounts voluntary-exit
#TO BE DETERMINED

πŸ— 8.2 Verify your mnemonic phrase

Using the eth2deposit-cli tool, ensure you can regenerate the same eth2 key pairs by restoring your validator_keys

cd $HOME/eth2deposit-cli 
./deposit.sh existing-mnemonic --chain mainnet

When the pubkey in both keystore files are identical, this means your mnemonic phrase is veritably correct. Other fields will be different because of salting.

πŸ€–8.3 Add additional validators

Backup and move your existing validator_key directory and append the date to the end.

# Adjust your eth2deposit-cli directory accordingly
cd $HOME/eth2deposit-cli
# Renames and append the date to the existing validator_key directory
mv validator_key validator_key_$(date +"%Y%d%m-%H%M%S")
# Optional: you can also delete this folder since it can be regenerated.

Using the eth2deposit-cli tool, you can add more validators by creating a new deposit

  1. For example, in case we originally created 3 validators but now wish to add 5 more validators, we could use the following command. Select the tab depending on how you acquired eth2deposit tool.

Security recommendation reminder: For best security practices, key management and other activities where you type your 24 word mnemonic seed should be completed on an air-gapped offline cold machine booted from USB drive.

Reminder to use the same keystore password.

# Generate from an existing mnemonic 5 more validators when 3 were previously already made
./deposit.sh existing-mnemonic --validator_start_index 3 --num_validators 5 --chain mainnet
# Generate from an existing mnemonic 5 more validators when 3 were previously already made
./deposit existing-mnemonic --validator_start_index 3 --num_validators 5 --chain mainnet

πŸ”₯Pro Security Tip: Run the eth2deposit-cli tool and generate your mnemonic seed for your validator keys on an air-gapped offline machine booted from usb.

Follow this ethstaker.cc exclusive for the low down on making a bootable usb.

Part 1 – Create a Ubuntu 20.04 USB Bootable Drive

Part 2 – Install Ubuntu 20.04 from the USB Drive

You can copy via USB key the pre-built eth2deposit-cli binaries from an online machine to an air-gapped offline machine booted from usb. Make sure to disconnect the ethernet cable and/or WIFI.

Run the existing-mnemonic command in the previous tabs.

  1. Complete the steps of uploading the deposit_data-#########.json to the official Eth2 launch pad site and making your corresponding 32 ETH deposit transactions.

  2. Finish by stopping your validator, importing the new validator key(s), restarting your validator and verifying the logs ensuring everything still works without error. Review steps 2 and onward of the main guide if you need a refresher.

  3. Finally, verify your existing validator’s attestations are working with public block explorer such as

https://beaconcha.in/ or https://beaconscan.com/

Enter your validator’s pubkey to view its status.

Your additional validators are now in the activation queue waiting their turn. Check your estimated activation time at https://eth2-validator-queue.web.app/

πŸ’Έ 8.4 Switch / migrate Eth2 clients with slash protection

The key takeaway in this process is to avoid running two eth2 clients simultaneously. You want to avoid being punished by a slashing penalty, which causes a loss of ether.

πŸ›‘ 8.4.1 Stop old beacon chain and old validator.

In order to export the slashing database, the validator needs to be stopped.

sudo systemctl stop beacon-chain validator
sudo systemctl stop beacon-chain

πŸ’½ 8.4.2 Export slashing database (Optional)

EIP-3076 implements a standard to safety migrate validator keys between eth2 clients. This is the exported contents of the slashing database.

Update the export .json file location and name.

lighthouse account validator slashing-protection export 
teku slashing-protection export --to=

🚧 8.4.3 Setup and install new validator / beacon chain

Now you need to setup/install your new validator but do not start running the systemd processes. Be sure to thoroughly follow your new validator’s Section 4. Configure a ETH2 beacon chain and validator. You will need to build/install the client, configure port forwarding/firewalls, and new systemd unit files.

****✨ Pro Tip: During the process of re-importing validator keys, wait at least 13 minutes or two epochs to prevent slashing penalties. You must avoid running two eth2 clients with same validator keys at the same time.

πŸ›‘ Critical Step: Do not start any systemd processes until either you have imported the slashing database or you have waited at least 13 minutes or two epochs.

πŸ“‚ 8.4.4 Import slashing database (Optional)

Using your new eth2 client, run the following command and update the relevant path to import your slashing database from 2 steps ago.

lighthouse account validator slashing-protection import 
teku slashing-protection import --from=

🌠 8.4.5 Start new validator and new beacon chain

sudo systemctl start beacon-chain validator
sudo systemctl start beacon-chain

πŸ”₯ 8.4.6 Verify functionality

Check the logs to verify the services are working properly and ensure there are no errors.

sudo systemctl status beacon-chain validator
sudo systemctl status beacon-chain

Finally, verify your validator’s attestations are working with public block explorer such as

https://beaconcha.in/

Enter your validator’s pubkey to view its status.

🧯 8.4.7 Update Monitoring with Prometheus and Grafana

Review section 6 and change your prometheus.yml. Ensure prometheus is connected to your new eth2 client’s metrics port. You will also want to import your new eth2 client’s dashboard.

πŸ–₯ 8.5 Use all available LVM disk space

During installation of Ubuntu Server, a common issue arises where your hard drive’s space is not fully available for use.

# View your disk drives
sudo -s lvm

# Change the logical volume filesystem path if required
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

#exit lvextend
exit

# Resize file system to use the new available space in the logical volume
resize2fs /dev/ubuntu-vg/ubuntu-lv

## Verify new available space
df -h

# Example output of a 2TB drive where 25% is used
# Filesystem                         Size   Used Avail Use% Mounted on
# /dev/ubuntu-vg/ubuntu-lv           2000G  500G  1500G  25% /

Source reference:

🚦 8.6 Reduce network bandwidth usage

Hosting your own ETH1 node can consume hundreds of gigabytes of data per day. Because data plans can be limited or costly, you might desire to slow down data usage but still maintain good connectivity to the network.

Edit your eth1.service unit file.

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

Add the following flag to limit the number of peers on the ExecStart line.

--maxpeers 10
# Example
# ExecStart       = /usr/bin/geth --maxpeers 10 --http --ws
--max-peers 10
# Example
# ExecStart       = /openethereum/openethereum --max-peers 10
--max-peers 10
# Example
# ExecStart       = /besu/bin/besu --max-peers 10 --rpc-http-enabled
--Network.ActivePeersMaxCount 10
# Example
# ExecStart       = /nethermind/Nethermind.Runner --Network.ActivePeersMaxCount 10 --JsonRpc.Enabled true

Finally, reload the new unit file and restart the eth1 node.

sudo systemctl daemon-reload
sudo systemctl restart eth1

πŸ“‚ 8.7 Important directory locations

In case you need to locate your validator keys, database directories or other important files.

Eth2 Client files and locations

# Validator Keys
~/.lighthouse/mainnet/validators

# Beacon Chain Data
~/.lighthouse/mainnet/beacon

# List of all validators and passwords
~/.lighthouse/mainnet/validators/validator_definitions.yml

#Slash protection db
~/.lighthouse/mainnet/validators/slashing_protection.sqlite
# Validator Keys
/var/lib/nimbus/validators

# Beacon Chain Data
/var/lib/nimbus/db

#Slash protection db
/var/lib/nimbus/validators/slashing_protection.sqlite3

#Logs
/var/lib/nimbus/beacon.log
# Validator Keys
/var/lib/teku

# Beacon Chain Data
~/tekudata/beacon

#Slash protection db
~/tekudata/validator/slashprotection
# Validator Keys
~/.eth2validators/prysm-wallet-v2/direct

# Beacon Chain Data
~/.eth2/beaconchaindata

Eth1 node files and locations

# database location
$HOME/.ethereum
# database location
$HOME/.local/share/openethereum
# database location
$HOME/.besu/database
#database location
$HOME/.nethermind/nethermind_db/mainnet

🌏 8.8 Hosting ETH1 node on a different machine

Hosting your own ETH1 node on a different machine than where your beacon-chain and validator resides, can allow some extra modularity and flexibility.

On the eth1 node machine, edit your eth1.service unit file.

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

Add the following flag to allow remote incoming http and or websocket api requests on the ExecStart line.

If not using websockets, there’s no need to include ws parameters. Only Nimbus requires websockets.

--http.addr 0.0.0.0 --ws.addr 0.0.0.0
# Example
# ExecStart       = /usr/bin/geth --http.addr 0.0.0.0 --ws.addr 0.0.0.0 --http --ws
--jsonrpc-interface=all --ws-interface=all
# Example
# ExecStart       = /openethereum/openethereum --jsonrpc-interface=all --ws-interface=all
--rpc-http-host=0.0.0.0 --rpc-ws-enabled --rpc-ws-host=0.0.0.0
# Example
# ExecStart       = /besu/bin/besu --rpc-http-host=0.0.0.0 --rpc-ws-enabled --rpc-ws-host=0.0.0.0 --rpc-http-enabled
--JsonRpc.Host 0.0.0.0 --WebSocketsEnabled
# Example
# ExecStart       = /nethermind/Nethermind.Runner --JsonRpc.Host 0.0.0.0 --WebSocketsEnabled --JsonRpc.Enabled true

Reload the new unit file and restart the eth1 node.

sudo systemctl daemon-reload
sudo systemctl restart eth1

On the separate machine hosting the beacon-chain, update the beacon-chain unit file with the eth1 node’s IP address.

# edit beacon-chain unit file
nano /etc/systemd/system/beacon-chain.service
# add the --eth1-endpoint parameter
# example
# --eth1-endpoint=http://192.168.10.22
# edit beacon chain unit file
nano /etc/systemd/system/beacon-chain.service
# modify the --web-url parameter
# example
# --web3-url=ws://192.168.10.22
# edit teku.yaml
nano /etc/teku/teku.yaml
# change the eth1-endpoint
# example
# eth1-endpoint: "http://192.168.10.20:8545"
# edit beacon-chain unit file
nano /etc/systemd/system/beacon-chain.service
# add the --http-web3provider parameter
# example
# --http-web3provider=http://192.168.10.20:8545

Reload the updated unit file and restart the beacon-chain.

sudo systemctl daemon-reload
sudo systemctl restart beacon-chain

🎊 8.9 Add or change POAP graffiti flag

Setup your graffiti, a custom message included in blocks your validator successfully proposes, and earn an early beacon chain validator POAP token. Generate your POAP string by supplying an Ethereum 1.0 address here.

Run the following command to set the MY_GRAFFITI variable. Replace “ between the single quotes.

MY_GRAFFITI=''
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

Learn more about POAP – The Proof of Attendance token.

Run the following to re-create a unit file to define yourvalidator.service configuration. Simply copy and paste.

cat &gt; $HOME/validator.service &lt; $HOME/beacon-chain.service &lt; $HOME/teku.yaml &lt; $HOME/validator.service &lt; $HOME/validator.service &lt; Example: 
&gt;
&gt; wget -O besu.tar.gz [https://dl.bintray.com/hyperledger-org/besu-repo/besu-20.10.1.tar.gz](https://dl.bintray.com/hyperledger-org/besu-repo/besu-20.10.1.tar.gz)

```bash
cd $HOME
# backup previous besu version in case of rollback
mv besu besu_backup_$(date +"%Y%d%m-%H%M%S")
# download latest besu
wget -O besu.tar.gz 
# untar
tar -xvf besu.tar.gz
# cleanup
rm besu.tar.gz
# rename besu to standard folder location
mv besu* besu

Review the latest release at https://github.com/NethermindEth/nethermind/releases

Automatically download the latest linux release, un-zip and cleanup.

cd $HOME
# backup previous nethermind version in case of rollback
mv nethermind nethermind_backup_$(date +"%Y%d%m-%H%M%S")
# store new version in nethermind directory
mkdir nethermind &amp;&amp; cd nethermind 
# download latest version
curl -s https://api.github.com/repos/NethermindEth/nethermind/releases/latest | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux  | xargs wget -q --show-progress
# unzip
unzip -o nethermind*.zip
# cleanup
rm nethermind*linux*.zip

Start your eth1 node process.

sudo systemctl start eth1

Check the logs to verify the services are working properly and ensure there are no errors.

sudo systemctl status eth1 status beacon-chain validator
sudo systemctl status eth1 beacon-chain

Finally, verify your validator’s attestations are working with public block explorer such as

https://beaconcha.in/

Enter your validator’s pubkey to view its status.

✨ 8.11 How to improve validator attestation effectiveness

Learn about attestation effectiveness from Attestant.io

πŸ‘¨πŸ‘©πŸ‘§πŸ‘§ Strategy #1: Increase eth2 beacon chain peer count

This change will result in increased bandwidth and memory usage. Tweak and tailor appropriately for your hardware.

Kudos to RΓ©my Roy for this strat.

Edit your beacon-chain.service unit file (except for Teku).

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

Add the following flag to increase peers on the ExecStart line.

--target-peers 100
# Example
# lighthouse bn --target-peers 100 --staking --metrics --network mainnet
--max-peers=100
# Example
# /usr/bin/nimbus_beacon_node --network=mainnet --max-peers=100
# Edit teku.yaml
sudo nano /etc/teku/teku.yaml

# add the following line to teku.yaml and save the file
p2p-peer-upper-bound: 100
--p2p-max-peers=100
# Example
# prysm.sh beacon-chain --mainnet --p2p-max-peers=100 --http-web3provider=http://127.0.0.1:8545 --accept-terms-of-use 
--network.maxPeers 100
# Example
# yarn run cli beacon --network.maxPeers 100 --network mainnet

Reload the updated unit file and restart the beacon-chain process to complete this change.

sudo systemctl daemon-reload
sudo systemctl restart beacon-chain

πŸ‘¨πŸ’» Strategy #2: Increase eth1 uptime by using a failover eth1 node

Especially useful during eth1 upgrades, when your primary node is temporarily unavailable.

Edit your beacon-chain.service unit file.

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

Add the following flag on the ExecStart line.

--eth1-endpoints 
# Example, separate endpoints with commas.
# --eth1-endpoints http://localhost:8545,https://nodes.mewapi.io/rpc/eth,https://mainnet.eth.cloud.ava.do,https://mainnet.infura.io/v3/xxx
--fallback-web3provider=&lt;http:// --fallback-web3provider=&lt;http://
# Example, repeat flag for multiple eth1 providers
# --fallback-web3provider=https://nodes.mewapi.io/rpc/eth --fallback-web3provider=https://mainnet.infura.io/v3/YOUR-PROJECT-ID

πŸ’Έ Find free ethereum fallback nodes at https://ethereumnodes.com/

Reload the updated unit file and restart the beacon-chain process to complete this change.

sudo systemctl daemon-reload
sudo systemctl restart beacon-chain

πŸŒ‡ 9. Join the community on Reddit

🌍 Reddit r/ethStaker

🧩10. Reference Material

Appreciate the hard work done by the fine folks at the following links which served as a foundation for creating this guide.

πŸŽ‰11. Bonus links

🧱 ETH2 Block Explorers

πŸ—’ Latest Eth2 Info

πŸ‘¨πŸ‘©πŸ‘§πŸ‘¦ Additional ETH2 Community Guides

Hardware Staking Guide https://www.reddit.com/r/ethstaker/comments/j3mlup/a_slightly_updated_look_at_hardware_for_staking/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s