Eth 2.0 - Teku Validator

Eth 2.0: Clients || Keys || Launchpad || Install || Configure || Systemd || Run || Update Teku

Clients

There are multiple Eth2 clients with working implementations. This guide will focus on installing Lighthouse, but be sure to research the other clients and promote Eth2 client diversity.

Teku

Lighthouse

Prysm

Nimbus

Dev Team

Consensys

Sigma Prime

Prysmatic Labs

Status

Focus

Enterprise

Speed, security

Usability, reliability

Lightweight

Language

Java

Rust

Go

Nim

Generate Keys

Use the Ethereum Foundation's Github repository to install the Eth 2.0 key generating tool.

Please be sure you are using to the official Ethereum Foundation GitHub account.

Clone the Eth2 deposit generator client:

cd ~
git clone https://github.com/ethereum/eth2.0-deposit-cli.git
cd eth2.0-deposit-cli

Check Python version:

python3 -V

You need Python 3.7 or above. Follow these steps if you need to update

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7

Install other prerequisites:

sudo apt install python3-pip

Install and generate validator keys:

sudo ./deposit.sh install
./deposit.sh --num_validators 1 --chain medalla

THESE FILES ARE VERY IMPORTANT

Files can be found at:/home/<yourusername>/eth2.0-deposit-cli/validator_keys

  1. deposit_data-[timestamp].json

  2. keystore -[timestamp].json

The mnemonic seed provides withdrawal access to your 32 Eth.

Eth2 Launchpad

In order to register as a validator on Eth 2.0, you need to submit the deposit data through the Official Eth2 Launchpad.

You already installed an Eth1 node, synced an Eth2 beacon node, and generated the key pairs. Click continue until you reach "Upload Deposit File".

Upload Deposit File

Send 32 GoEth Deposit

Check Validator Status

The deposit_data-[timestamp].json file contains your validator"pubkey"

You can use beaconcha.in to check the status of Eth1 and Eth2 deposits. Once the Eth2 deposit is confirmed, your validator will be added to the que and receive an activation epoch.

Teku Install

Teku requires the Java Runtime Environment (JRE) and Java Development Kit (JDK)

Install dependencies and check versions:

sudo apt install default-jre default-jdk
java --version
javac --version

Clone Teku repository:

cd ~
sudo git clone https://github.com/PegaSysEng/teku.git
cd teku

Compile using Gradle:

sudo ./gradlew installDist

Copy output to /usr/local/teku:

sudo cp -a ~/teku/build/install/teku/. /usr/local/teku

Configure

Create /var/lib/teku and /etc/teku directory:

sudo mkdir -p /var/lib/teku
sudo mkdir -p /etc/teku

Copy validator_keys into /var/lib/teku data directory:

sudo cp -a /$HOME/eth2.0-deposit-cli/validator_keys /var/lib/teku

Create user teku:

sudo useradd --no-create-home --shell /bin/false teku

Set permissions for user teku :

sudo chown -R teku:teku /var/lib/teku
sudo chown -R teku:teku /etc/teku

Create validator password file:

Teku expects to find identically named keystore and password files. For example: keystore name:keystore-m_12381_3600_0_0_0-1596161835.json

password name:keystore-m_12381_3600_0_0_0-1596161835.txt

sudo nano /etc/teku YOUR_EXACT_JSON_KEYSTORE_FILE_NAME.txt

A file should open, type yourpassword, exit (Ctrl + X), save (Y) , then press (Enter).

Create Teku configuration file:

sudo nano /etc/teku/teku.yaml

Paste the following into the file:

data-path: "/var/lib/teku" network: "medalla" eth1-endpoint: "http://127.0.0.1:8545/" validator-keys: "/var/lib/teku/validator_keys:/etc/teku validators-graffiti: "YOURgraffiti" p2p-port: 9001 log-destination: CONSOLE metrics-enabled: true metrics-port: 8008 rest-api-enabled: true rest-api-docs-enabled: true

Once updated, you can exit (Ctrl + X), save (Y) , and pressEnterto confirm file name.

Command Descriptions:

  • network: "medalla" - connect to medalla testnet

  • eth1-endpoint: "http://127.0.0.1:8545/"

    • Tells the beacon node what to use for eth1-endpoint

    • Eth1 local node is located at http://127.0.0.1 port 8545

  • validators-keys: - keystore_json_file : keystore_password_file

  • validators-graffiti: - graffiti used to "tag" your Eth2 blocks

  • p2p-port: 9001 - port used for p2p traffic

  • log-destination: CONSOLE - recommended settings for systemd files

  • metrics-enabled: true - allows for metrics like Prometheus

Create teku.service file to run in systemd :

systemd files allows you to automatically start teku and run it in the background.

sudo nano /etc/systemd/system/teku.service

Paste the following into the file:

[Unit] Description=Teku Beacon Node Wants=network-online.target After=network-online.target [Service] Type=simple User=teku Group=teku Restart=always RestartSec=5 ExecStart=/usr/local/teku/bin/teku -c /etc/teku/teku.yaml [Install] WantedBy=multi-user.target

Reload systemd to reflect changes:

sudo systemctl daemon-reload

Start Teku

sudo systemctl start teku

Show teku.service journal entries:

sudo journalctl -f -u teku.service

This shows running journal entries created by teku.service. You can use Ctrl + C to quit, but the program will continue running in the background.

Use sudo systemctl stop teku if you need to stop teku.service

Teku Startup:

Eth 2.0 Medalla || Teku Validator Startup

Teku Attestations:

Eth 2.0 Medalla || Teku Attestations

Enable teku.service on startup:

sudo systemctl enable teku

Congratulations, your Teku validator is set to run 24/7!

Updating Teku

Be sure to stop Teku, then use the following commands to update:

cd teku
sudo git pull
sudo ./gradlew installDist
sudo rm -r /usr/local/teku
sudo cp -a ~/teku/build/install/teku/. /usr/local/teku

Start Teku after update:

sudo systemctl start teku

Congratulates, you are now running the most recent version of Teku!