Setting up an ETH2 Validator on testnet

HOWTO setup a Prysm, Ethereum 2.0 client on the Topaz testnet using Docker on existing hardware.

Prerequisites

  • Docker 19.x
  • 32 GöETH (testnet ETH of no value)
  • Metamask connected to Görli

If you’re on Windows, wherever you see $HOME, replace with a path to the location you would like to store the testnet files, for example instead of $HOME/.eth2:/data use c:/prysm/eth2:/data

Guide

  1. Install Docker 19.x following this guide Install Docker Engine | Docker Documentation

Add your user to the docker usergroup

sudo adduser $USER docker

Re-login for new permissions to take effect.

  1. Download the required Docker images. The Beacon Chain is the Ethereum 2.0 testnet, ‘Topaz’. Think of the validator as the miner that validates PoS blocks on ETH2 instead of mining them on ETH1.x, each validator is a worker or a rig.
docker pull gcr.io/prysmaticlabs/prysm/validator:latest
docker pull gcr.io/prysmaticlabs/prysm/beacon-chain:latest
  1. On your firewall, open up ports tcp/13000 and udp/12000.

  2. Start the Docker container for the beacon chain.

docker run -d --rm -v $HOME/.eth2:/data -p 4000:4000 -p 13000:13000 -p 12000:12000/udp --name beacon-node gcr.io/prysmaticlabs/prysm/beacon-chain:latest --datadir=/data --p2p-host-ip=$(curl -s ident.me)

If you didn’t open the ports in step #3 you can skip —p2p-host-ip=$(curl -s ident.me), You can also enter your IP address instead of having bash look it up —p2p-host-ip=<my public ip> if you do not have curl installed or if you’re on Windows

  1. You can watch the beacon chain download in the Docker logs. You need to wait for the chain to download before continuing.
docker logs -f beacon-node

The -f flag ‘follows’ the log, ctrl+c to stop following the log, this doesn’t stop the container. You can also run the logs command without the -f to see a snapshot without following.


If you need stop the node at any point

docker stop beacon-node

Start it back up again with the command in step 3.

  1. You are now running Ethereum 2.0, Phase 0. Next we setup a validator, you can setup one or many, each validator requires a 32 ETH stake deposited to a validator deposit contract before the validator can be activated.
    Go to Prylabs, skip step 1, in step 2 be sure to switch Metamask to Görli before connecting, if you do not have 32 GöETH in your wallet, you will be given the option to receive it from Prysm’s faucet.

  2. Generate a validator keypair, as well as deposit data to submit on the Prylabs page.

docker run -it -v $HOME/.eth2:/data \
gcr.io/prysmaticlabs/prysm/validator:latest \
accounts create --keystore-path=/data --password=changeme

This command will output a Raw Transaction Data block:

  1. Copy and paste the deposit data into the field in step 3 Prylabs

  2. The beacon node must be completely synced before attempting to initialize a validator client, otherwise the validator will not be able to complete the deposit and funds will be lost.

  3. Start a validator client.

docker run -d --rm -v $HOME/.eth2:/data --network=“host” \
gcr.io/prysmaticlabs/prysm/validator:latest \
--beacon-rpc-provider=127.0.0.1:4000 \
--keystore-path=/data \
--password=changeme

If you need stop the node at any point

docker stop validator

Start it back up again with the command in step 3.

  1. Once both the beacon node and validator client are running, make your deposit by clicking the button in step 5 on Prylabs and following the steps presented in your wallet.

Sources used to create this guide

3 Likes

This seems really interesting but also very intimidating and almost looks like a foreign language to me :slight_smile:

Take it one step at a time, ask questions.

Okay my first question is what is a Docker?

It allows you to run software inside of a container, like a VM but without having to have an entire o/s. Running inside a docker container saves the trouble of having to install and configure all of the dependencies (software that the node requires to run), because the container image has it all setup already.

Container are also ephemeral (temporary), you stop them and the entire thing is gone forever, making it a very clean way to run software and easy to start from scratch. In fact, you start from scratch each time you restart a container.

In this setup we use docker volumes to save the chain data in a folder on the host machine, so that part isn’t lost when you restart.

Dont worry about not knowing much about docker, just know that it’s the container that runs your application.

that was easy to understand thank bro!

2 Likes

Another guide for an easy install on dedicated hardware.

I’m having an issue with step 10.
Everything went smooth but the creation of the validation client is returning the following:
docker: invalid reference format.
See 'docker run --help'.

Using Ubuntu 18.04 on an Alienware.

What should I be seeing after I run the command in step 3? It is giving me a single string of characters then waiting for the next command. When I run the logs command, I receive “Error: No such container: beacon-node”

I have a basic doubt on master node ! How these bring passive income ?:thinking:

Hey @AbodyRulez ,

Sorry for the late reply. The forum changed my double dash into a long dash, I have corrected it.

This does not bring income until it goes live on mainnet.

Step 3 is opening ports on your firewall, unless you mean step 8 which is item #3 on the Prylabs website.

If you are trying to view the logs of the beacon node, it needs to be running per step 4. The error you have received means that the container isn’t running. You can see what containers are running with the command docker ps

Will we be rewarded with anything for being a validator using the goerli-eth?

Will being a testnet validator with little to no penalties make our validator node ready for the mainnet?

When on mainnet will we need the 32 ETH to make any staking rewards or will just running the validator node be enough to earn some ETH?

Thanks!

You’ll earn testnet eth on the testnet, has no value, never will have any value.

When (if ever) mainnet comes, you’ll need real eth, you cannot earn them on testnet.

I am stuck at step 10. When I run this command (In a Ubuntu terminal):

docker run -d --rm -v $HOME/.eth2:/data --network=“host” \
gcr.io/prysmaticlabs/prysm/validator:latest \
--beacon-rpc-provider=127.0.0.1:4000 \
--keystore-path=/data \
--password=changeme

I get the following error: docker: Error response from daemon: network “host” not found.
How can I solve this error?