Chain started: Onyx 15th June 2020

Last tested and updated: 8th July 2020

Last change: Updated for new Onyx testnet

Source code hash: af4dfd4c36149444426a350642de0f3ebf6c8dee

Ubuntu: 18.04.3 ubuntu-18.04.3-desktop-amd64.iso

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 testnet. 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. These instructions are for building from source and not using docker. More detailed instructions can be found on the Prysm site.

These are the steps for installing the testnet node from source on a fresh Ubuntu 18.4 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 testnet beacon chain launched on the 10th June 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. Approximate times are given, where appropriate and the full install took around 15 minutes.

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.

Install Bazel (approx 1 minute)

First step is to install the Bazel tool which is an open source build and test tool. Bazel takes care of all the dependencies making the install very simple.



$ curl

$ echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list

$ sudo apt update && sudo apt install bazel -y

$ bazel version $ sudo apt install curl -y$ curl https://bazel.build/bazel-release.pub.gpg |sudo apt-key add -$ echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list$ sudo apt update && sudo apt install bazel -y$ bazel version

If it has been installed correctly you should see something like this:

Build label: 3.2.0

Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar

Build time: Wed May 27 17:54:00 2020 (1590602040)

Build timestamp: 1590602040

Build timestamp as int: 1590602040

Install Prysm Client (approx 2 minutes)

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



$ git clone

$ cd prysm $ sudo apt-get install cmake git -y$ git clone https://github.com/prysmaticlabs/prysm.git $ cd prysm

To get the source code hash of the current version you have pulled down then run the following:

$ git rev-parse HEAD

The instructions were tested with the above hash but expect the code to change frequently at this stage of the development process.

Run the Beacon Chain (first time approx 10 minutes)

If you want to run the node and validating processes in their own process not attached to a terminal process then install screen.

$ sudo apt install screen -y

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

$ screen -S BeaconTestChain

$ cd prysm

$ bazel run //beacon-chain -- --log-file $HOME/beaconChain.log --datadir=$HOME/beaconChain --monitoring-port=8081

$ Cntl+a d

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. The monitoring-port is useful if you want to allow software such Prometheus to collect information. See more details for Eth2 monitoring here.

To re-enter the screen process then you just re-attach to that screen. Useful if you want to kill the process.

$ screen -r BeaconTestChain

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

$ cd

$ tail -f $HOME/beaconChain.log

Create Validation and Withdrawal Keys

The next step is to create validation and withdrawal keys. 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. For testnet convenience, both keys are created together with the same password but for the mainnet these keys should have different passwords and the withdrawal key should be securely kept in cold storage. The default directory for the keys is $HOME/.eth2validators. A validator can validate multiple keys, so you can go ahead and create a number of keys but for convenience use the same password for each key. For the mainnet different passwords should be used for every key.

$ cd prysm

$ bazel run //validator —- accounts create

When you first run this command you will be asked to specify the key directory and then just hit enter to accept the default. You will then be prompted for a password and then asked to confirm the same password. A withdrawal and validation key will now have been created with the same password in the directory $HOME/.eth2validators.

When you create the keys it will also output the deposit date required to be submitted to the Eth1 contract to initiate your validator. Copy the data between the double lines and paste it somewhere safe for the next step.

========================Raw Transaction Data======================= <Your deposit data> ===================================================================

Initiate your Validator on Ethereum 1 via MetaMask

For this step we suggest using the MetaMask wallet switched to the Goerli testnet and create a new Ethereum 1 account just for this testnet.

The Ethereum 2 validator will only become active when it picks up the event raised when depositing 32 Goerli Eth to the Eth1 deposit contract along with the deposit data from the above step.

Using a browser with MetaMask installed, navigate to the URL https://prylabs.net/participate and follow the instructions. This will take you through the steps for obtaining 32 test Goerli ETH and then sending it to the deposit contract along with your deposit data. Once the transaction is mined then you just have to wait until the beacon chain observes the event on the Goerli testnet. This event will trigger the validator to start staking and you can then monitor the increase balance in the validator’s output.

It will take an hour or so to activate the validator and around a while to sync, so be prepare to be patient. If you want to understand the validation life cycle you can read our blog here.

Example transaction for the deposit contract can be seen on the Goerli testnet here:

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. Run the following commands below and once you have entered in the password the validator will wait until it sees the deposit event raised for your key on Ethereum 1 Goerli testnet.

$ cd prysm

$ screen -S ValidatorTestChain

$ bazel run //validator -- --log-file $HOME/validator.log --enable-account-metrics

$ <Enter password>

$ Cntl+a d

If you want to view the logs in real-time then you can tail the log file in your home directory. The flag enable-account-metrics is useful if you want to provide an end point for Prometheus or ethstats.

$ cd

$ tail -f $HOME/validator.log

Below is an example log from our validator just as it becomes active with the beacon chain:

[2020-06-11 15:50:59] INFO keymanager: Checking validator keys keystorePath=/home/eth2/.eth2validators [2020-06-11 15:50:59] INFO keymanager: Enter your validator account password: [2020-06-11 15:51:33] INFO node: Validating for public key pubKey=0x8b1d4412497b2cde57cbcfa715b835d5ceb71cef8cdd790715824cf70d6032c1cc8da9884f41d9bc10b0b8f7287c27fa [2020-06-11 15:51:33] INFO node: Checking DB databasePath=/home/eth2/.eth2 [2020-06-11 15:51:33] INFO node: Starting validator node version=Prysm/{LATEST_GIT_TAG}/260847e92f58259c3cb11e838b931c82a20d01e0. Built at: 2020-06-11T15:50:59+01:00 [2020-06-11 15:51:33] INFO validator: Waiting for beacon chain start log from the ETH 1.0 deposit contract [2020-06-12 10:33:38] INFO validator: Beacon chain started genesisTime=2020-06-14 06:17:24 +0100 BST[2020-06-12 10:33:44] INFO validator: Waiting for deposit to be observed by beacon node pubKey=0xb7cce82ed042 status=UNKNOWN_STATUS [2020-06-12 10:33:44] INFO validator: Validator activated index=6970 publicKey=0xb89e21bf393e [2020-06-12 10:33:44] INFO validator: Attestation schedule attesters=1 pubKeys=[0xab7bd8f0b9a9] slot=3

Useful Commands

Create new keys

To create another withdrawal and validator key, run the command below and you will be asked for a single password for both keys. Make sure you use the same password as the previous keys, as the validator process can run many keys at the same time but only lets you input one password.

$ bazel run //validator —- accounts create

WARNING: Using the same password for all keys would be a security risk on the mainnet esepcially as the validator key could be held by a different organisation to the withdrawal key. Using the same password is purely for convenience while testing the testnet.

Build the beacon chain and validator client

If for any reason you want to just build from source without running the node or validator.

$ cd prysm

$ bazel build //beacon-chain:beacon-chain

$ bazel build //validator:validator

Building without Bazel

You can build compile Prysm by installing go and using go build.



wget

sudo tar -C /usr/local -xzf go1.14.4.linux-amd64.tar.gz

export PATH=$PATH:/usr/local/go/bin sudo apt -y install build-essentialwget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz sudo tar -C /usr/local -xzf go1.14.4.linux-amd64.tar.gzexport PATH=$PATH:/usr/local/go/bin

Then you can run go build in the beacon chain directory and validator directory.

cd prysm/beacon-chain

go build

./beacon-chain --log-file $HOME/beaconChain.log --datadir=$HOME/beaconChain cd prysm/validator

go build

./validator --log-file $HOME/validator.log

Useful Links

Attestant Ethereum Staking Posts

Ethereum 2.0 Staking Keys

Ethereum 2.0 Withdrawal Keys

Etherscan for the current beacon chain testnet

Onyx Testnet Pre Gensis Q/A

Eth2 Node Monitoring Tool

Useful resource https://github.com/chrishobcroft/prysmconfig/

Contact

If you wish to know more about Attestant, you can contact us on Telegram https://t.me/attestant