Guide | 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.

As of March 29 2021, this guide is updated for mainnet. 😁

β€‹βœ¨ For the PYRMONT testnet guide, please click here. Always test on testnet.

β€‹πŸŽŠ 2020-12 Update: Thanks to all Gitcoin contributors, where you can contribute via quadratic funding and make a big impact. Funding complete! Thank you!πŸ™

ETH2 Staking Guides by CoinCashew | Grants
"Far and away the best guide I've ever used for anything" - Mr F. Yes, Legend says Mr. F was first here honing his fateful Prysm validator to forge the genesis block. Provably verifiable if you know where to gaze. Our guides help on-board ambitious and passionate eth2 validators. Our goal is to unmask the mystery of making eth2 staking in an easy to follow and understand approach. "Your journey to build an eth2 validator shouldn't be as hard as finding Satoshi.” – Pseudonymous Ben Edgington of What's New in Eth2 characterizes them as super-detailed guides for each client. It’s in choose your own adventure format! Featured on Bankless as a highly recommended resource for eth2 staking. Ethereum's network of nodes is bolstered because our Validator's Security Best Practice Guide was spotlighted in Week in Ethereum Newsletter. r/Ethstakers love CoinCashew eth2 Guides. Prominently featured in subreddit sticky. WHY SUPPORT THIS GRANT? Over 11k pageviews served so far. Countless eth1 nodes and validators built. Everything you need to excel at eth2 staking in literally 1 page. Inspiring beginners to build their own validator since Onyx testnet. Pro-decentralization by promoting eth1 nodes and eth2 client diversity. Supporting the home-staker to fully maximize their ROS With our guide, you can spin up a eth2 validator in less than 10 minutes (sync time not included). Build your own validator today! Click here to view the guide. WHAT IS COINCASHEW ABOUT? Passionate about making awesome guides and decentralizing all the things, especially Ethereum. Thanks for your support and it's awesome pushing the the limits of ETH staking with you. WHAT WILL YOU DO WITH THIS FUNDING? We aim to 10x our reach in 2021. We aim to translate the guide into more languages to further accelerate eth2's decentralization and support the non-English communities.
gitcoin.co

β€‹πŸ 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: 128GB 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

  • 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

β€‹βœ¨ Pro Validator Tip: Highly recommend you begin with a brand new instance of an OS, VM, and/or machine. Avoid headaches by NOT reusing testnet keys, wallets, or databases for your validator.

If you need ideas or a reminder on how to secure your validator, refer to

β€‹πŸ›  Setup Ubuntu

If you need to install Ubuntu Server, refer to

Or Ubuntu Desktop,

β€‹πŸŽ­ Setup Metamask

If you need to install Metamask, refer to

β€‹πŸ§© 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.

How eth2 fits together featuring Leslie the eth2 Rhino, the mascot named after American computer scientist Leslie Lamport

β€‹πŸŒ± 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.

Build from source code
Pre-built eth2deposit-cli
Advanced - Most Secure
Build from source code

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
Pre-built eth2deposit-cli

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
Advanced - Most Secure

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

2. 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.

3. 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!

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

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

6. 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 (Parity)
Geth
Besu
Nethermind
Minimum Hardware Setup (Infura)
OpenEthereum (Parity)

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 << EOF
[Unit]
Description = openethereum eth1 service
Wants = network-online.target
After = network-online.target
​
[Service]
User = $(whoami)
ExecStart = $(echo $HOME)/openethereum/openethereum --metrics --metrics-port=6060
Restart = on-failure
RestartSec = 3
​
[Install]
WantedBy = multi-user.target
EOF

Nimbus Specific Configuration: Add the following flag to the ExecStart line.

--ws-origins=all

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 OpenEthereum

sudo systemctl start eth1
Geth

Geth - Go Ethereum is one of the three original implementations (along with C++ and Python) of the Ethereum protocol. It is written in Go, fully open source and licensed under the GNU LGPL v3.

Review the latest release notes at https://github.com/ethereum/go-ethereum/releases​

β€‹πŸ§¬ Install from the repository

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

β€‹βš™ 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 << EOF
[Unit]
Description = geth eth1 service
Wants = network-online.target
After = network-online.target
​
[Service]
User = $(whoami)
ExecStart = /usr/bin/geth --http --metrics --pprof
Restart = on-failure
RestartSec = 3
TimeoutSec = 300
​
[Install]
WantedBy = multi-user.target
EOF

Nimbus Specific Configuration: Add the following flag to the ExecStart line.

--ws

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 geth

sudo systemctl start eth1

Geth Tip: When is my geth node synched?

  1. Attach to the geth console with:geth attach http://127.0.0.1:8545​

  2. Type the following:eth.syncing

  3. If it returns false, your geth node is synched.

Besu

Hyperledger Besu is an open-source Ethereum client designed for demanding enterprise applications requiring secure, high-performance transaction processing in a private network. It's developed under the Apache 2.0 license and written in Java.

β€‹πŸ§¬ Install java dependency

sudo apt update
sudo apt install openjdk-11-jdk -y

β€‹πŸŒœ Download and unzip Besu

Review the latest release at https://github.com/hyperledger/besu/releases​

File can be downloaded from https://dl.bintray.com/hyperledger-org/besu-repo​

cd
wget -O besu.tar.gz https://dl.bintray.com/hyperledger-org/besu-repo/besu-20.10.1.tar.gz
tar -xvf besu.tar.gz
rm besu.tar.gz
mv besu* besu

β€‹βš™ 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 << EOF
[Unit]
Description = besu eth1 service
Wants = network-online.target
After = network-online.target
​
[Service]
User = $(whoami)
ExecStart = $(echo $HOME)/besu/bin/besu --metrics-enabled --rpc-http-enabled --data-path="$HOME/.besu"
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 besu

sudo systemctl start eth1
Nethermind

Nethermind is a flagship Ethereum client all about performance and flexibility. Built on .NET core, a widespread, enterprise-friendly platform, Nethermind makes integration with existing infrastructures simple, without losing sight of stability, reliability, data integrity, and security.

β€‹βš™ Install dependencies

sudo apt-get update
sudo apt-get install curl libsnappy-dev libc6-dev jq libc6 unzip -y

β€‹πŸŒœ Download and unzip Nethermind

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

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

mkdir $HOME/nethermind
chmod 775 $HOME/nethermind
cd $HOME/nethermind
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 -o nethermind*.zip
rm nethermind*linux*.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 << 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

Minimum Hardware Setup (Infura)

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 such as Chainstack 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=<your wss:// infura endpoint>

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: <your https:// infura 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=<your https:// infura 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=<your https:// infura endpoint>

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 #<block number>

  • Geth: Imported new chain segment

  • Besu: Imported #<block number>

  • 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
Nimbus
Teku
Prysm
Lodestar
Lighthouse

​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

  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 > $HOME/beacon-chain.service << 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 --validator-monitor-auto --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 <my POAP string or message> between the single quotes.

MY_GRAFFITI='<my POAP string or message>'
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

β€‹πŸ° Benefits of using systemd for your validator

  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 > $HOME/validator.service << 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 "${MY_GRAFFITI}" --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

​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="-d:insecure" 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

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 <my POAP string or message> between the single quotes.

MY_GRAFFITI='<my POAP string or message>'
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

🍰 Benefits of using systemd for your beacon chain and validator

  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 > $HOME/beacon-chain.service << 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)
WorkingDirectory= /var/lib/nimbus
ExecStart = /bin/bash -c '/usr/bin/nimbus_beacon_node --network=mainnet --graffiti="${MY_GRAFFITI}" --data-dir=/var/lib/nimbus --web3-url=ws://127.0.0.1:8546 --metrics --metrics-port=8008 --rpc --rpc-port=9091 --validators-dir=/var/lib/nimbus/validators --secrets-dir=/var/lib/nimbus/secrets --log-file=/var/lib/nimbus/beacon.log'
Restart = on-failure
​
[Install]
WantedBy = multi-user.target
EOF

Nimbus only supports websocket connections ("ws://" and "wss://") for the ETH1 node. Geth, OpenEthereum and Infura ETH1 nodes are verified compatible.

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
Teku

​PegaSys Teku (formerly known as Artemis) is a Java-based Ethereum 2.0 client designed & built to meet institutional needs and security requirements. PegaSys is an arm of ConsenSys dedicated to building enterprise-ready clients and tools for interacting with the core Ethereum platform. Teku is Apache 2 licensed and written in Java, a language notable for its materity & ubiquity.

β€‹βš™ 4.1 Build Teku from source

Install git.

sudo apt-get install git -y

Install Java 11.

For Ubuntu 20.x, use the following

sudo apt update
sudo apt install openjdk-11-jdk -y

For Ubuntu 18.x, use the following

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java11-set-default -y

Verify Java 11+ is installed.

java --version

Install and build Teku.

mkdir ~/git
cd ~/git
git clone https://github.com/ConsenSys/teku.git
cd teku
./gradlew distTar installDist

This build process may take a few minutes.

Verify Teku was installed properly by displaying the version.

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

Copy the teku binary file to /usr/bin/teku

sudo cp -r $HOME/git/teku/build/install/teku /usr/bin/teku

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

  • Teku 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.3. Configure the beacon chain and validator

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

Setup a directory structure for Teku.

sudo mkdir -p /var/lib/teku
sudo mkdir -p /etc/teku
sudo chown $(whoami):$(whoami) /var/lib/teku

Copy your validator_files directory to the data directory we created above and remove the extra deposit_data file.

cp -r $HOME/eth2deposit-cli/validator_keys /var/lib/teku
rm /var/lib/teku/validator_keys/deposit_data*

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

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

Update your keystore password between the quotation marks after echo.

echo 'my_password_goes_here' > $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 <my POAP string or message> between the single quotes.

MY_GRAFFITI='<my POAP string or message>'
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

Generate your Teku Config file. Simply copy and paste.

cat > $HOME/teku.yaml << EOF
# network
network: "mainnet"
​
# p2p
p2p-enabled: true
p2p-port: 9000
# validators
validator-keys: "/var/lib/teku/validator_keys:/var/lib/teku/validator_keys"
validators-graffiti: "${MY_GRAFFITI}"
​
# Eth 1
eth1-endpoint: "http://localhost:8545"
​
# metrics
metrics-enabled: true
metrics-port: 8008
​
# database
data-path: "$(echo $HOME)/tekudata"
data-storage-mode: "archive"
​
# 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

  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 > $HOME/beacon-chain.service << 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 = /usr/bin/teku/bin/teku -c /etc/teku/teku.yaml
Restart = on-failure
Environment = JAVA_OPTS=-Xmx5g
​
[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
Prysm

​Prysm is a Go implementation of Ethereum 2.0 protocol with a focus on usability, security, and reliability. Prysm is developed by Prysmatic Labs, a company with the sole focus on the development of their client. Prysm is written in Go and released under a GPL-3.0 license.

β€‹βš™ 4.1. Install Prysm

mkdir ~/prysm && cd ~/prysm
curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh && chmod +x prysm.sh

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

  • Prysm beacon chain node will use port 12000 for udp and port 13000 for tcp

  • 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

Accept terms of use, accept default wallet location, enter a new prysm-only password to encrypt your local prysm wallet files and enter the keystore password for your imported accounts.

If you wish, you can use the same password for the keystore and prysm.

$HOME/prysm/prysm.sh validator accounts import --mainnet --keys-dir=$HOME/eth2deposit-cli/validator_keys

Verify your validators imported successfully.

$HOME/prysm/prysm.sh validator accounts list --mainnet

Confirm your validator's pubkeys are listed.

#Example output:

Showing 1 validator account View the eth1 deposit transaction data for your accounts by running `validator accounts list --show-deposit-data

Account 0 | pens-brother-heat [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

  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 > $HOME/beacon-chain.service << 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=45 --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=<http://<alternate eth1 provider one> --fallback-web3provider=<http://<alternate eth1 provider two>
# 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

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' > $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 <my POAP string or message> between the single quotes.

MY_GRAFFITI='<my POAP string or message>'
# Examples
# MY_GRAFFITI='poapAAAAACGatUA1bLuDnL4FMD13BfoD'
# MY_GRAFFITI='eth2 rulez!'

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

β€‹πŸ° Benefits of using systemd for your validator

  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 > $HOME/validator.service << 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 = $(echo $HOME)/prysm/prysm.sh validator --mainnet --graffiti "${MY_GRAFFITI}" --accept-terms-of-use --wallet-password-file $(echo $HOME)/.eth2validators/validators-password.txt
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

β€‹πŸ›  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

Verify that your validator public key appears in the logs.

journalctl --unit=validator --since=today
# Example below
# INFO Enabled validator voting_pubkey: 0x2374.....7121
Lodestar

​Lodestar is a Typescript implementation of the official Ethereum 2.0 specification by the ChainSafe.io team. In addition to the beacon chain client, the team is also working on 22 packages and libraries. A complete list can be found here. Finally, the Lodestar team is leading the Eth2 space in light client research and development and has received funding from the EF and Moloch DAO for this purpose.

β€‹βš™ 4.1 Build Lodestar from source

Install curl and git.

sudo apt-get install gcc g++ make git curl -y

Install yarn.

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn -y

Confirm yarn is installed properly.

yarn --version
# Should output version >= 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 >= v12.18.3

Install and build Lodestar.

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

This build process may take a few minutes.

Verify Lodestar was installed properly by displaying the help menu.

./lodestar --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

./lodestar account validator import \
--network mainnet \
--directory $HOME/eth2deposit-cli/validator_keys

Enter your keystore password to import accounts.

Confirm your keys were imported properly.

./lodestar 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

  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 > $HOME/beacon-chain.service << 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 = $(echo $HOME)/git/lodestar/lodestar beacon --network mainnet --eth1.providerUrl http://localhost:8545 --metrics.enabled true --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

​