Try   HackMD

How to migrate from lighthouse-docker to eth-docker

Step 1: Stop the lighthouse-docker validator

In order to avoid getting slashed, you need to shutdown and permanently disable the Lighthouse node that is running via lighthouse-docker.

To do that, cd to the lighthouse-docker directory:

cd ~/lighthouse-docker

(your path may be slightly different)

Then run this command to bring down the running node:

docker-compose down

You should see output like this:

Stopping lighthouse-docker_validator_client_1 ... done
Stopping lighthouse-docker_beacon_node_1      ... done
Removing lighthouse-docker_validator_client_1 ... done
Removing lighthouse-docker_beacon_node_1      ... done
Removing lighthouse-docker_geth_1             ... done
Removing network lighthouse-docker_default

Then, to prevent accidentally restarting the node, move the node's data where lighthouse-docker won't find it:

mv validator_keys validator_keys_backup
mv lighthouse-data lighthouse-data-backup
mv .env env-backup

You can verify that lighthouse-docker has been successfully disabled using this command:

docker-compose up

You should see:

WARNING: The LIGHTHOUSE_VERSION variable is not set. Defaulting to a blank string.
WARNING: The GETH_VERSION variable is not set. Defaulting to a blank string.
ERROR: Couldn't find env file: /home/your_name/lighthouse-docker/.env

You should also verify that nothing is running under docker:

docker ps

Output should be:

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

With no running processes listed.

Step 2: sign up for an Infura account

In order to make the transition as easy as possible we'll use Infura to checkpoint sync.

Make an Infura account at https://infura.io/ and sign up for an "ETH2" node.

Create New Key > ETH2

Then make a note of the URL that looks like this:

https://2DTFPon3xyLNrj3hjfPrit1PAOV:7c1c0a51784d719c6cd1b511372912fa@eth2-beacon-mainnet.infura.io

You'll need that URL in the next step.

Step 3: set up a new node with eth-docker

Clone the eth-docker repository into ~/eth-docker:

cd ~ && git clone https://github.com/eth-educators/eth-docker.git && cd eth-docker

Next, run the ethd setup wizard:

./ethd config

Select the following options in order:

  • Select Network: Ethereum Mainnet
  • Select deployment type: Ethereum node
  • Select consensus client: Lighthouse (Rust)
  • Select execution client: choose whichever you would like, Geth is fine
  • Rapid sync with remote checkpoint, e.g. Infura? Yes
  • Configure remote consensus client: put the URL from step 2
  • Grafana dashboards? No (unless you want that)
  • Configure Rewards Address: any Ethereum/eth1 address of your choice
  • Configure Graffiti: whatever you want

The wizard will now finish and output a few logs that end with something like this:

Successfully built 9860ba6a9641
Successfully tagged geth:local

Stop and ask for help if you get anything that looks like an error.

Step 4: import keys to eth-docker

Run this command, where ~/lighthouse-docker is the path to your old lighthouse-docker directory:

./ethd keyimport --path ~/lighthouse-docker/validator_keys_backup

Enter the password when prompted. You should see output like the following:

Creating network "eth-docker_default" with the default driver
Creating volume "eth-docker_lhbeacon-data" with default driver
Creating volume "eth-docker_lhvalidator-data" with default driver
Creating volume "eth-docker_geth-eth1-data" with default driver
Creating eth-docker_validator-import_run ... done
Do all validator keys have the same password? (y/n) y
Running account manager for mainnet network
validator-dir path: "/var/lib/lighthouse/validators"
WARNING: DO NOT USE THE ORIGINAL KEYSTORES TO VALIDATE WITH ANOTHER CLIENT, OR YOU WILL GET SLASHED.

Keystore found at "/val_keys/keystore-m_12381_3600_0_0_0-1660711555.json":

 - Public key: 0xa245b62661953e3b32a6b1fc2d6ac30820580746b35440125e2e25274835d288d04b4865848f4353eeaac58535390ff7
 - UUID: 272bb6e0-b3b0-472b-974b-00947d641198

If you enter the password it will be stored as plain-text in validator_definitions.yml so that it is not required each time the validator client starts.

Enter the keystore password, or press enter to omit it:

Password is correct.

Successfully imported keystore.
Successfully updated validator_definitions.yml.

Successfully imported 1 validators (0 skipped).

WARNING: DO NOT USE THE ORIGINAL KEYSTORES TO VALIDATE WITH ANOTHER CLIENT, OR YOU WILL GET SLASHED.

Step 5: check validator is offline, then start

Check your validator indices on https://beaconcha.in to confirm that they're currently offline. They should have been offline and failing to attest since you completed Step 1. Ensure that at least 15 minutes have elapsed since you started.

IF YOUR VALIDATORS ARE NOT OFFLINE AT THIS POINT YOU WILL GET SLASHED. IF YOU'RE UNSURE STOP RIGHT NOW AND SEEK HELP.

Heeding the above warning, start the new node:

./ethd start

You can check on the logs with:

./ethd logs --tail 200 -f consensus

Which should show:

consensus_1          | Aug 17 05:53:57.905 INFO Lighthouse started                      version: Lighthouse/v2.5.1-df51a73
consensus_1          | Aug 17 05:53:57.905 INFO Configured for network                  name: mainnet
consensus_1          | Aug 17 05:53:57.905 INFO Data directory initialised              datadir: /var/lib/lighthouse
consensus_1          | Aug 17 05:53:57.905 INFO Deposit contract                        address: 0x00000000219ab540356cbb839cbe05303d7705fa, deploy_block: 11184524
consensus_1          | Aug 17 05:53:57.982 INFO Starting checkpoint sync                remote_url: https://eth2-beacon-mainnet.infura.io/, service: beacon
consensus_1          | Aug 17 05:54:49.717 INFO Loaded checkpoint block and state       state_root: 0xdf03c7a9be59ed4b1732e3e1b8ed04337cac4b71d1a0c01d8043cf0fd14368d0, block_root: 0x803c4e696d2b55f80852bc3134b515ddf967cff5af7943f351d84503f88a59be, slot: 4490880, service: beacon
consensus_1          | Aug 17 05:54:50.231 INFO Block production enabled                method: json rpc via http, endpoints: NoAuth(["http://execution:8545/"])

If you instead see errors from Infura just try re-running the log command to see if succeeds on a retry. The error case looks like this:

consensus_1          | Aug 17 05:52:55.631 INFO Logging to file                         path: "/var/lib/lighthouse/beacon/logs/beacon.log"
consensus_1          | Aug 17 05:52:55.631 INFO Lighthouse started                      version: Lighthouse/v2.5.1-df51a73
consensus_1          | Aug 17 05:52:55.631 INFO Configured for network                  name: mainnet
consensus_1          | Aug 17 05:52:55.631 INFO Data directory initialised              datadir: /var/lib/lighthouse
consensus_1          | Aug 17 05:52:55.631 INFO Deposit contract                        address: 0x00000000219ab540356cbb839cbe05303d7705fa, deploy_block: 11184524
consensus_1          | Aug 17 05:52:55.722 INFO Starting checkpoint sync                remote_url: https://eth2-beacon-mainnet.infura.io/, service: beacon
consensus_1          | Aug 17 05:53:57.311 CRIT Failed to start beacon node             reason: Error loading checkpoint state from remote 0xdf03c7a9be59ed4b1732e3e1b8ed04337cac4b71d1a0c01d8043cf0fd14368d0: StatusCode(504)
consensus_1          | Aug 17 05:53:57.311 INFO Internal shutdown received              reason: Failed to start beacon node
consensus_1          | Aug 17 05:53:57.311 INFO Shutting down..                         reason: Failure("Failed to start beacon node")

Check on the validator with ./ethd logs --tail 200 -f validator. It should show:

validator_1          | Aug 17 06:07:14.795 INFO Logging to file                         path: "/var/lib/lighthouse/validators/logs/validator.log"
validator_1          | Aug 17 06:07:14.795 INFO Lighthouse started                      version: Lighthouse/v2.5.1-df51a73
validator_1          | Aug 17 06:07:14.795 INFO Configured for network                  name: mainnet
validator_1          | Aug 17 06:07:14.796 INFO Starting validator client               validator_dir: "/var/lib/lighthouse/validators", beacon_nodes: ["http://consensus:5052/"]
validator_1          | Aug 17 06:07:14.796 INFO Metrics HTTP server started             listen_address: 0.0.0.0:8009
validator_1          | Aug 17 06:07:14.796 INFO Completed validator discovery           new_validators: 0
validator_1          | Aug 17 06:07:15.499 INFO Enabled validator                       voting_pubkey: 0xa245b62661953e3b32a6b1fc2d6ac30820580746b35440125e2e25274835d288d04b4865848f4353eeaac58535390ff7, signing_method: local_keystore
validator_1          | Aug 17 06:07:15.499 INFO Initialized validators                  enabled: 1, disabled: 0

After a few minutes you should see that your beacon node is synced and your validator is attesting again. Check https://beaconcha.in again to confirm attestations are being processed by the rest of the network.

Troubleshooting

If you run into issues please ping @sproul on Discord or ask for help on the Lighthouse server, or the lighthouse-helpdesk channel on the EthStaker server. The best time to ping me is 9am-5pm Australia eastern standard time (approx UTC+10).

You may also find the docs for eth-docker helpful:

Cleaning Up

Once you're happy with your new eth-docker setup, and confident that you have a backup of your keys somewhere, you can delete the old lighthouse-docker data to save space:

sudo rm -r ~/lighthouse-docker