Updated on June 30, 2020

Connect to a testnet

The following instructions describe the process to connect Teku to an Ethereum 2.0 testnet.

Important

This example connects to the Altona testnet. Networks can experience stability issues and are prone to regular resets. We recommend you regularly check network and client documentation for updates.

Prerequisites:

Teku allows you run a beacon chain client only, or you can run the beacon chain client with validators on a public testnet.

Run a validator on a testnet

Each Ethereum 2.0 validator needs access an Ethereum 1.0 client to onboard new validators. Validators make deposits into Ethereum 1.0, and existing Ethereum 2.0 validators must process the deposits to allow the validators to join Ethereum 2.0.

Deposits are made into a deposit contract on the Goerli Ethereum 1.0 testnet.

The steps to run an Ethereum 2.0 validator on a testnet are:

  1. If using a local Ethereum 1.0 client, sync the Ethereum 1.0 network containing the deposit contract.

    Note

    This step is only required if using a local Ethereum 1.0 client such as Besu. If using a cloud-based service such as Infura, proceed to fund your deposit account.

  2. Fund the Ethereum 1.0 deposit account.

  3. Generate the validator key and send the deposit to the deposit contract.

  4. Start Teku with the validator key.

Sync the Ethereum 1.0 network

This step is only required if using a local Ethereum 1.0 client.

This example uses Besu to connect to Ethereum 1.0, but any client can be used. Configure Besu to connect to Goerli and expose the RPC-HTTP APIs.

Example

besu --network=goerli --data-path=./goerli --rpc-http-enabled=true --rpc-http-port=8545 \
--rpc-http-api=ETH,NET,WEB3 --sync-mode=FAST --fast-sync-min-peers=2

Load the deposit account with ETH

You need an Ethereum 1.0 account that contains the amount of ETH (plus gas) required to activate the validator. The altona testnet requires 32 ETH, and the account must be on Goerli.

Tip

You can create an account on Goerli using Metamask, and use a faucet to fund the account.

You will need the private key of the Ethereum 1.0 account when sending the deposit to the deposit contract. The private key can be stored in a password protected V3 Keystore file.

Generate the validator and send the deposit

Teku allows you to generate validator keys and send deposits to the deposit contract.

Example

teku validator generate-and-register --network=altona \
--eth1-endpoint=http://localhost:8545 --keys-output-path=validator_key \
--encrypted-keystore-validator-password-file=./altona/password.txt \
--encrypted-keystore-withdrawal-password-file=./altona/password.txt \
--eth1-keystore-file=./altona/walletKey --eth1-keystore-password-file=./altona/password.txt \
--number-of-validators=1

On the command line:

It may take more than 8 hours for a deposit to become active.

Tip

View the deposit details on Etherscan by visiting https://goerli.etherscan.io/address/<accountPublicKey>.

Start the validator

Run Teku and specify the validator key created earlier.

Example

teku --network=altona --eth1-endpoint=http://localhost:8545 \
--validators-key-files=validator_key/validator_888eeef/validator_888eeef.json \
--validators-key-password-files=./altona/password.txt \
--rest-api-enabled=true --rest-api-docs-enabled=true \
--metrics-enabled

Once the validator is activated, view it on the beacon chain explorer at https://altona.beaconcha.in/validator/<validatorPublicKey>.

Run a beacon chain client only

You can run a Teku beacon chain node on a network without any validators.

Example

teku --network=altona --metrics-enabled --rest-api-enabled --rest-api-docs-enabled

Add a beacon chain client to Eth2stats

You can add the beacon chain node to Eth2stats for monitoring.

Ensure you enable metrics using the --metrics-enabled option when starting Teku.