Joining Eth2 Medalla Testnet with Geth and Prysm



For this “tutorial”, I have used these instructions in a fresh Ubuntu 20.04 Server virtual machine. You may need to add “sudo” in front for some of the commands.

I have used the instructions at Prysm docs (https://docs.prylabs.network/docs/testnet/medalla) as an initial reference point.

Initial Setup

Update your packages and install required packages

apt update && apt upgrade -y && apt install -y screen curl libdigest-sha-perl gnupg2 libssl-dev libgmp-dev libtinfo5 software-properties-common

Make a Prysm directory and get the Prysm installation script.

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

Install Geth

Now, the Prysm client will need to connect to a Eth1 node. You can either run your own Eth1 node or use a “public” Eth1 node service. My opinion is that it is much “safer” if you run your own Eth1 node. They do not take much resources to run and can potentially save your bacon if the “public” Eth1 node services go down (due to DDOS?).

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

As Geth will take some time to sync, we shall start the node first.

screen -S EthTestnet
geth --goerli --http --http.addr=0.0.0.0 --http.corsdomain "*" --cache=3512 --maxpeers 150 --maxpendpeers 10 --nousb

Use the following key combination to exit the “screen”.

Ctrl+A D

To reattach to the screen, use:

screen -r EthTestnet

Create Validators

Proceed to the official Eth2 launchpad: https://medalla.launchpad.ethereum.org/overview

Follow the instructions and you should be ready for the next steps. If you have some problems installing the dependencies and running the tool, use the code below:

apt install python3-venv python3-pip
cd && git clone https://github.com/ethereum/eth2.0-deposit-cli.git
cd eth2.0-deposit-cli
./deposit.sh install
./deposit.sh --chain medalla

Import validator account into Prysm

./prysm/prysm.sh validator accounts-v2 import --keys-dir=$HOME/eth2.0-deposit-cli/validator_keys

Your accounts can be found: (where $HOME is your home directory)

wallet path: $HOME/.eth2validators/prysm-wallet-v2
wallet directory: $HOME/.eth2validators/prysm-wallet-v2
account passwords path: $HOME/.eth2validators/prysm-wallet-v2-passwords

Running Beacon Node

Same as the instructions for Geth, we shall start a screen and dump the starting command in there.

cd && mkdir eth2

screen -S Eth2BeaA

./prysm/prysm.sh beacon-chain --datadir=$HOME/eth2/.eth2 --p2p-host-ip=<your public IP address> --http-web3provider=http://<Your Eth1 Node IP address>:8545 --monitoring-host 0.0.0.0

To reattach to the screen, use:

screen -r EthBeaA

Starting Validators

Important: If the Medalla testnet has already started, you should only start your validators AFTER your beacon node is fully synced. If not, you will face penalties.

screen -S Eth2ValA
./prysm/prysm.sh validator

Misc Remarks

With the Prysm installation script, everything seems easy enough. I might try other Eth2 clients when I have the time. Note that you can run as many validators with the single beacon node. But personally, I will be keep the number of validators to less than 10 for each beacon node for this testnet.

Cheers!


Spread the word:
Sunshine

Dabbling with random things in his free time.

Leave a Comment