Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Notes on setting up Eth2 clients for Medalla testnet (Prysm / Lighthouse / Teku / Nimbus / Lodestar)

Notes on setting up Eth2 clients for Medalla testnet (Prysm / Lighthouse / Teku / Nimbus / Lodestar)

PLEASE NOTE:

  • Prysm, Lighthouse, and Teku are attesting and proposing correctly following this guide
  • Nimbus currently has a glitch that it syncs the beacon chain well but can't post any attestations (#1443) is attesting properly following the latest updates!
  • Lodestar has a glitch that the beacon client hangs up and won't sync the beacon chain (#1347)
  • This guide will be updated once these issues have been resolved

Using the launchpad

Create and fund validator accounts following the instructions on the official launchpad: https://medalla.launchpad.ethereum.org/

I use Anaconda to manage my Python installation because I'm familiar with it as a Python developer. You don’t have to do it the same way

When using Anaconda, the eth2.0-deposit.cli/deposit.sh script needs to be modified. Change the lines that contain python3 and pip3 to python and pip, respectively (i.e. remove the 3’s)

POAP badges

Don’t forget to get the graffiti codes for POAP badges! https://beaconcha.in/poap

Ports

Some clients by defaults want to use the same for ports for finding peers and exporting metrics. Here I'm using the following settings

Don't forget to set up port forwarding fo the P2P ports on your router! Otherwise you will not find any peer

client p2p-port metrics-port
geth 30606 -
prysm 13000/tcp 12000/udp 8080
lighthouse 9000 -
teku 9001 8008
nimbus 9002 8009
lodestar 30607 8010

Create validator accounts

# Install dependencies
sudo apt install build-essential

# Install Anaconda
cd ~/Downloads
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh

# Restart terminal, configure anaconda
conda init
conda config --set auto_activate_base false

# Restart terminal again and check python installation
conda activate base
which python
python --version

# Create validator accounts using official CLI tool
git clone https://github.com/ethereum/eth2.0-deposit-cli.git
cd eth2.0-deposit-cli

# Create validator accounts
./deposit.sh install
./deposit.sh --num_validators 20 --chain medalla

Geth

# Install geth
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt update
sudo apt install ethereum

# Sync Goerli testnet
geth --goerli --datadir ~/.goerli \
  --syncmode full --gcmode full \
  --http --http.addr localhost --http.port 8545 \
  --ws --ws.addr localhost --ws.port 8546

Prysm

# Get the helper script
mkdir ~/prysm && cd ~/prysm
curl -O https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh
chmod +x prysm.sh

# Import validator account created by the official launchpad
./prysm.sh validator accounts-v2 import --keys-dir ../eth2.0-deposit-cli/validator_keys
./prysm.sh validator accounts-v2 list

# run beacon node
./prysm.sh beacon-chain \
  --p2p-host-ip $(curl -s v4.ident.me) \
  --http-web3provider http://127.0.0.1:8545/

# Run validator client
./prysm.sh validator --graffiti "yourGraffiti"

Lighthouse

# Install dependencies
sudo apt install -y git gcc g++ make cmake pkg-config libssl-dev

# Install Rust language and Cargo, its package manager
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
export $PATH=PATH:$HOME/.cargo/bin

# Compile Lighthouse
git clone https://github.com/sigp/lighthouse.git
cd lighthouse
make

# Import validator accounts
lighthouse account validator import --directory ../eth2.0-deposit-cli/validator_keys

# Run beacon node
lighthouse --testnet medalla \
  beacon \
  --testnet medalla \
  --eth1 \
  --http \
  --eth1-endpoint http://127.0.0.1:8545/ \
  --graffiti "yourGraffi"

# Run validator client
lighthouse --testnet medalla validator --auto-register

Teku

Save a file which contains the password your entered on the launchpad; here I use launchpad_validators.pass Then, create config file for Teku

# ~/eth2/teku_config.yaml
network: "medalla"
eth1-deposit-contract-address: "0x07b39F4fDE4A38bACe212b546dAc87C58DfE3fDC"
eth1-endpoint: "http://127.0.0.1:8545/"
validators-key-files: [
  "/path/to/validator_keys/keystore-m_*.json"
]
validators-key-password-files: [
  "/path/to/launchpad_validators.pass",
]
validators-graffiti: "<yourGraffiti>"
p2p-port: 9001
metrics-enabled: true
metrics-port: 8008
rest-api-enabled: true
rest-api-docs-enabled: true
# Install Java (open source variant)
sudo apt install default-jre default-jdk
java --version
javac --version

# Build Teku
git clone https://github.com/PegaSysEng/teku.git
cd teku
./gradlew distTar installDist
export PATH=$PATH:$HOME/build/install/teku/bin
teku --help

# Run Teku
teku --config-file ~/eth2/teku_config.yaml

Nimbus

# Dependencies
sudo apt install libpcre3-dev

# Clone the latest Github repo, use devel branch
git clone https://github.com/status-im/nim-beacon-chain
cd nim-beacon-chain
git checkout devel

# Compile beacon node client & import validators
make BASE_PORT=9002 beacon_node
build/beacon_node deposits import ../eth2.0-deposit-cli/validator_keys \
  --data-dir=build/data/shared_medalla_0

# Run beacon node and validator client
make LOG_LEVEL='INFO' \
  BASE_PORT=9002 BASE_METRICS_PORT=8009 \
  NODE_PARAMS="--graffiti='yourGraffiti'" \
  medalla

Lodestar

# Install Node.js using nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
nvm install 12
nvm use 12  # Lodestar does not support the newer versions of Node.js!
nvm alias default 12

# 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 upgrade
sudo apt install yarn
yarn --version

# Build from source
git clone https://github.com/chainsafe/lodestar.git
cd lodestar
yarn install
yarn run build
yarn run cli --help

# Import validator accounts
yarn run cli account validator import \
  --rootDir ~/.lodestar \
  --testnet medalla \
  --directory ~/eth2/eth2.0-deposit-cli/validator_keys

# Run beacon node
yarn run cli beacon \
  --testnet medalla \
  --rootDir ~/.lodestar \
  --eth1.provider.url http://127.0.0.1:8545/ \
  --metrics.serverPort 8010

# Run validator
yarn run cli validator \
  --rootDir ~/.lodestar \
  --testnet medalla \
  --graffiti "yourGraffiti"

Other useful commands

# Check which ports are being used by clients
netstat -tulpn

# Check CPU and memory usage of processes
ps -eo pid,cmd,%mem,%cpu --sort=-%cpu | \
  grep -E 'PID|prysm|lighthouse|java|beacon_node|yarn' | \
  grep -v grep
@viswanathkgp12

This comment has been minimized.

Copy link

@viswanathkgp12 viswanathkgp12 commented Aug 6, 2020

In the lighthouse script, shouldn't it be:

- export $PATH=$PATH:/$HOME/.cargo/bin
+ export PATH=$PATH:$HOME/.cargo/bin
@D-Nice

This comment has been minimized.

Copy link

@D-Nice D-Nice commented Aug 6, 2020

In the lighthouse script, shouldn't it be:

- export $PATH=$PATH:/$HOME/.cargo/bin
+ export PATH=$PATH:$HOME/.cargo/bin

👍

@Larrypcdotcom

This comment has been minimized.

Copy link
Owner Author

@Larrypcdotcom Larrypcdotcom commented Aug 6, 2020

In the lighthouse script, shouldn't it be:

- export $PATH=$PATH:/$HOME/.cargo/bin
+ export PATH=$PATH:$HOME/.cargo/bin

Thanks for pointing out. It's fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.