How to Regenerate Keystore file using the 24 words (ETH2.0)

Recover a validator from the mnemonic

Regenerating Keystore file using the 24 words

Guide for Linux

Open a terminal and go to the home directory.
cd $HOME

Download the tool you used to generate the 24 words, you can obtain it from Releases · ethereum/eth2.0-deposit-cli · GitHub

In this case we are going to use the eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz, where ed5a6d3 should be changed for the latest version.

You can download it click on it or writing the next command:
wget https://github.com/ethereum/eth2.0-deposit-cli/releases/download/v1.1.0/eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz
(again, check the latest version here, in future commands we assume you will change it should there be a new version)

Decompress the downloaded file with:
tar -xvf eth2deposit-cli-ed5a6d3-linux-amd64.tar.gz

Access the directory we’ve just created when decompressing:
cd eth2deposit-cli-ed5a6d3-linux-amd64/

To execute the tool to regenerate our keystore from the mnemonic or 24 words:

  • (If we are restoring a testnet keystore we must indicate on the flag --chain)
    ./deposit existing-mnemonic --chain pyrmont

  • (If we are restoring a mainnet keystore we must indicate on the flag --chain with the work mainnet)
    ./deposit existing-mnemonic --chain mainnet

Now, the console will ask you for the words:

Type your 24 words, for example:
chaos jewel security draw embody project route funny impact brief decorate palace sky figure blue eleven crop ocean fly bear wasp bird arrest arrow

The next question will be:

Enter the index (key number) you wish to start generating more keys from. For example, if you've generated 4 keys in the past, you'd enter 4 here, [0]:

Depends on how many keys you have generated in the past. In my case I generated 1, so I would write:

1

Repeat the confirmation.

1

You will be asked for Please choose how many validators you wish to run:
Depends on your preferences, I am running only 1, then I type:

1

Now the tool will generate new keystores for the derivated keys. It will ask us for a password to secure this new keystores. It doesn’t need to be the same as the original keystore, but it’s very important that you secure it properly: you will need it.

Prompt asks to Type the password that secures your validator keystore(s):
> whatever_password

After writing it down, confirm.

After this process, we should have a directory called validator_keys, where the keystores will be.

To check if you have restored correctly your validator, you can check it comparing the pubkey from:

If you know your validator in Beaconchain or Beaconscan, compare the string above with the string in the field called ‘pubkey’ on the file keystore-m…

If it is the same, you have regenerated the keystore of that validator correctly.

1 Like