Skip to content

Generate Validator Key

The 32 ETH will be staked to a validator key, so it's important to understand what we're doing here, and to do it well.

Validator public key

This key is used to verify a validator validated blocks properly (i.e. signed the blocks using its private key).

Also referred to as hot key, this one must be loaded to the validator process

Withdrawal key

A second key, know as withdrawal key, will be used later on to withdraw the 32 ETH and the fees.

It is also referred to as cold key, and will be reconstructed from the mnemonic at the appropriate time, and can be kept offline for the time being.

Generate keys

While the official documentation is availabhle at https://launchpad.ethereum.org/generate-keys, let's walk together step by step in the process.

Install the cli

Genarate the keys

Run it from where you feel the safest.

./eth2deposit-cli-ed5a6d3-linux-amd64/deposit new-mnemonic --num_validators 1 --chain mainnet --mnemonic_language english --folder .

Copy the mnemonic to a safe place. The mnemonic will be needed to recreate your keys if you loose them, and later on to withdraw the 32 staked ETH!

As a bonus hint, you can use the following command to generate a solid password:

openssl rand -base64 48

The previous ./eth2deposit-cli-ed5a6d3-linux-amd64/deposit command produced two files in the validator_keys folder:

  • deposit_data-xxxxxxxxxxx.json
  • keystore-m_yyyyy_zzzz_x_x_x-xxxxxxxxxxx.json

deposit_data-xxxxxxxxxxx.json file is for the smart contract

This deposit_data file is needed in the launchpad wizard https://launchpad.ethereum.org/upload-validator and contains your public key and public withdraw informations.

keystore-m_yyyyy_zzzz_x_x_x-xxxxxxxxxxx.json is for the validator

This keystore file is needed in the validator. It contains your private validator key, used by the validator to sign/validate transactions.

Import the key in Prysm

Assuming Prysm is running a docker container, copy the keystore-m_yyyyy_zzzz_x_x_x-xxxxxxxxxxx.json in the keys-dir folder, and run the following command:

docker run -it -v ${PWD}/keys-dir:/keys-dir \
  -v ${PWD}/prysm-wallet-v2:/prysm-wallet-v2 \
  -v ${PWD}/wallet-password.txt:/wallet-password.txt:ro \
  docker.touille.io/cryptouille/validator:stable \
    accounts import --keys-dir=/keys-dir \
    --wallet-dir /prysm-wallet-v2 \
    --wallet-password-file /wallet-password.txt \
    --accept-terms-of-use

We can quickly ensure account is properly imported:

docker run -it -v ${PWD}/keys-dir:/keys-dir \
  -v ${PWD}/prysm-wallet-v2:/prysm-wallet-v2 \
  -v ${PWD}/wallet-password.txt:/wallet-password.txt:ro \  
  docker.touille.io/cryptouille/validator:stable \
    accounts list \
    --wallet-dir /prysm-wallet-v2 \
    --wallet-password-file /wallet-password.txt \
    --accept-terms-of-use

Deposit process

The deposit process is documented in https://kb.beaconcha.in/ethereum-2.0-depositing, including an advanced write-up around the ETH2.0 keys https://kb.beaconcha.in/ethereum-2-keys.