DEV Community

CoinMonks
CoinMonks

Posted on • Originally published at Medium on

Installing and Running an Ethereum 2 Prysm Validator on the Mainnet

Chain started: 1st December 2020

Last tested and updated: 9th December 2020

Source code hash: ade3b2f2dffc242341dfc0793984b431a889e5b2

Ubuntu: 20.04

Technical Skills: A basic understanding of Linux

The purpose of this document is to provide a simple go to guide for a basic install and running a validator on the Prysm Ethereum 2 Mainnet. It is intended to be the minimum set of steps to get a node up and running and if you do need more details then refer to the Prysm documentation. More detailed instructions can be found on the Prysm site. There are a lot more complexities that have to be considered for running a validator such as setting up firewalls, rolling logs, etc but this is the bare minimum to get a Prysm validator running.

These are the steps for installing the Mainnet node on Ubuntu 20.04 and are likely to work on different code versions but we only tested it on the source code hash above. Attestant are constantly building nodes and updating this document, if you have any issues please let us know. These instructions were used for building a node on the date specified above on the Mainnet beacon chain launched on the 1st December 2020. The instructions below also show you how to obtain the source code hash for the current version of the software you have downloaded.

Attestant tested the install on 8th-generation 1.80 GHz Kaby Lake Intel Core i5–8250U/i7–8550U processor with 64GB and 1TB SSD.

Note: Each new command line starts with a $ and each line needs to be run separately with a return. The $ is command prompt and should not be copied.

Installing Ethereum 1 Geth Node

Ethereum 2 requires you to interact with the deposit contract on the Ethereum 1 Mainnet. So this next step is to install and run a geth Ethereum 1 node. Warning: This will take time a few days to sync and currently takes up 330GB of disk space.

Install Geth and Screen

$ sudo add-apt-repository -y ppa:ethereum/ethereum
$ sudo apt install ethereum screen -y
Enter fullscreen mode Exit fullscreen mode

Run Etheruem 1 Mainnet

Run geth, unattached to the terminal process, by using the tool “screen” which was installed above.

$ sudo mkdir -p /var/log/geth && sudo chown $USER /var/log/geth
$ screen -S Eth1Mainnet
$ geth --http &>> /var/log/geth/etheruem1Mainnet.log
$ Ctrl+a d
Enter fullscreen mode Exit fullscreen mode

Etheruem 1 is required to run and to be completely synced, so that the Prysm beacon node and validator can determine when ETH1 deposits have been made.

To view the progress of the sycn then you can tail the logs:

$ tail -f /var/log/geth/etheruem1Mainnet.log
Enter fullscreen mode Exit fullscreen mode

Install Prysm Client

The code is changing on a daily basis so be prepared pull down the code regularly.

$ sudo apt-get install cmake git -y
$ git clone [https://github.com/prysmaticlabs/prysm.git](https://github.com/prysmaticlabs/prysm.git)
$ cd prysm
Enter fullscreen mode Exit fullscreen mode

The instructions were tested with the hash at the top of this document. To get the source code hash of the current version you have pulled down then run the following:

$ git rev-parse HEAD
Enter fullscreen mode Exit fullscreen mode

Run the Beacon Chain

The following command will start up the beacon chain; with the chain data written to the beaconChain directory .eth2 and the log output to a log file in your home directory.

$ sudo mkdir -p /var/log/prysm && sudo chown $USER /var/log/prysm
% screen -S PrysmBeaconChain
$ $HOME/prysm.sh beacon-chain --http-web3provider=[http://127.0.0.1:8545/](http://127.0.0.1:8545/) --log-file=/var/log/prysm/prysmBeaconChain.log 
$ Ctrl+a d
Enter fullscreen mode Exit fullscreen mode

To get the most up-to-date version of the software you can just restart the beacon chain and validator which will automatically pull down the software, compile it and run. To re-enter the screen process then you just re-attach to that screen. Useful if you want to kill the process.

$ screen -r PrysmBeaconChain
Enter fullscreen mode Exit fullscreen mode

If you want to view the logs in real-time then you can tail the log file in /var/log/prysm/.

$ tail -f /var/log/prysm/prysmBeaconChain.log
Enter fullscreen mode Exit fullscreen mode

Create Validation and Withdrawal Keys

If you want to do this for real on the Mainnet then creating your keys via the Ethereum foundation’s launchpad. We would recommend going through the process on the Pyrmont launchpad first to familiar yourself with the entire process before depositing the Mainnet. If you use the launchpad you can skip this entire key generation process. We also don’t cover creating the deposit data for your validator and withdrawal keys and sending them to Ethereum 1, as the Launchpad covers all these steps.

In this document we will show you how to create accounts using Prysm but internally at Attestant we use ethdo and instructions can be found here for an alternative wallet.

It is good security practice to have a complex passphrase generated randomly. Use a password generator, for example pwgen, to create a 24+ mixed case alphanumeric passphrase (pwgen -B 24 -c 1). Store this passphrase somewhere safe and secure such as a password manager. Run the following to install, run and store the result in a file called password.txt:

$ sudo apt install pwgen
$ pwgen -B 24 -c 1 -y -n > password.txt
Enter fullscreen mode Exit fullscreen mode

Create a wallet with a number of accounts

In order to participate in staking you will need to create a Ethereum 2 validator and withdrawal key. For more information on the role of these keys you can see our blog and a specific blog on the withdrawal key you can be seen here.

In this next step we create a wallet which has a number of accounts generated from one set of seeds. In this context we define a wallet to be a collection of Ethereum 2 keys that are grouped under a single name and an account to be a single Ethereum 2 key.

A validator can validate multiple keys, so you can go ahead and create a number of keys. Run the following command and specify the number of accounts you want to create:

$ $HOME/prysm/prysm.sh validator wallet create --wallet-dir=$HOME/myTestWallet --keymanager-kind=derived --wallet-password-file=password.txt --skip-mnemonic-25th-word-check=false
Enter fullscreen mode Exit fullscreen mode

To list the accounts you just created:

$ $HOME/prysm/prysm.sh validator accounts list --wallet-dir=myTestWallet --wallet-password-file=password.txt
Enter fullscreen mode Exit fullscreen mode

Restore the wallet

Before you use a wallet you should make sure you can restore it from your seed words. So delete the wallet and check it can be restored by running the following, which will prompt you for your seed phrase:

$ rm -rf $HOME/myTestWallet
$ $HOME/prysm/prysm.sh validator wallet recover --wallet-password-file=password.txt --wallet-dir=$HOME/myTestWallet --skip-mnemonic-25th-word-check=false
Enter fullscreen mode Exit fullscreen mode

Running the Validator

Now that we have the beacon chain running, created validator and withdrawal keys and sent the deposit data to the Eth1 contract, we are now ready to run the validator process. Run the following commands below and the validator will wait until it sees the deposit event raised for your key on Ethereum 1 Mainnet.

$ cd prysm
$ screen -S ValidatorTestChain
$ $HOME/prysm/prysm.sh validator --wallet-dir=$HOME/myTestWallet --wallet-password-file=password.txt
$ Ctrl+a d
Enter fullscreen mode Exit fullscreen mode

If you want to view the logs in real-time then you can tail the log file in your home directory.

$ tail -f $HOME/validator.log
Enter fullscreen mode Exit fullscreen mode

Below is our validator log waiting for our validating keys to kick-in:

validator-v1.0.4-linux-amd64: OK
gpg: Signature made Mon 07 Dec 2020 17:46:35 GMT
gpg: using RSA key 0AE0051D647BA3C1A917AF4072E33E4DF1A5036E
gpg: Good signature from "Preston Van Loon <[preston@prysmaticlabs.com](mailto:preston@prysmaticlabs.com)>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 0AE0 051D 647B A3C1 A917 AF40 72E3 3E4D F1A5 036E
Verified /home/prysm/dist/validator-v1.0.4-linux-amd64 has been signed by Prysmatic Labs.
Starting Prysm validator --wallet-dir=/home/myTestWallet --wallet-password-file=password.txt
[2020-12-09 12:07:10] WARN flags: Running on ETH2 Mainnet
[2020-12-09 12:07:10] INFO node: Opened validator wallet keymanager-kind=derived wallet=/home/myTestWallet/derived
[2020-12-09 12:07:10] INFO node: Checking DB databasePath=/home/myTestWallet/derived
[2020-12-09 12:07:10] INFO node: Starting validator node version=Prysm/v1.0.4/b4437e6cecd78257d2699f42073a90a940baf716. Built at: 2020-12-07 16:42:42+00:00
[2020-12-09 12:07:10] WARN validator: You are using an insecure gRPC connection. If you are running your beacon node and validator on the same machines, you can ignore this message. If you want to know how to enable secure connections, see: [https://docs.prylabs.network/docs/prysm-usage/secure-grpc](https://docs.prylabs.network/docs/prysm-usage/secure-grpc)
[2020-12-09 12:07:10] INFO validator: Waiting for beacon chain start log from the ETH 1.0 deposit contract
[2020-12-09 12:07:10] INFO validator: Validating for public key publicKey=0x820911a11f28
[2020-12-09 12:07:10] INFO validator: Validating for public key publicKey=0xa8382c7fb4be
[2020-12-09 12:07:10] INFO validator: Validating for public key publicKey=0xa2915cc13106
[2020-12-09 12:07:10] INFO validator: Validating for public key publicKey=0x81003ebb24fb
[2020-12-09 12:07:10] INFO validator: Validating for public key publicKey=0x870e7ea5e3a8
Enter fullscreen mode Exit fullscreen mode

Useful Links

Creating Ethereum 2 withdrawal keys

Attestant Ethereum Staking Posts

Ethereum 2.0 Staking Keys

Ethereum 2.0 Withdrawal Keys

Contact

If you wish to know more about Attestant, you can contact us by email info@attestant.io or Telegram https://t.me/attestant

Also, Read

Get Best Software Deals Directly In Your Inbox


Top comments (0)