HOW TO BECOME AN ETH2 VALIDATOR (STEP BY STEP PRACTICAL TUTORIAL)
Nov 30th 2020
Ethereum will start tomorrow (1st December) the first phase of its migration to Ethereum 2.0 mainnet. One of the biggest changes it brings is the switch from the consensus protocol proof of work, to the proof of stake.
Ethereum decentralised ecosystem that is currently maintained by Miners (proof of work) will be replaced with Validators (proof of stake).
Instead of having to setup powerful mining hardware, and waste a lot of power energy, contribute to the blockchain will be a lot simpler and environment-friendly: Anyone with at least 32ETH (~$17.000) can “stake”, become a validator of the Ethereum blockchain, and of course.. profit (~20% APY on the first Year).
Although it’s possible to join with a lower amount, unfortunately this article is not suitable for that purpose — these Staking Services may be what you’re looking for.
Requirements (for the tutorial below):
- 32 Eths for every Validator — You can setup as many Validators as you want.
- An Ubuntu 18/20 Server with at least 600GB SSD, and 16GB Ram — It costs me around €50/month on Hetzner.com
Step 1 — Full Node of ETH 1.0
We’ll start by the most time consuming step, syncing with the ETH1.0 blockchain. Due to the current size of the network, it would take between 24 to 48hrs to fully sync your full node.
As we’ll have to keep synced with the network while validating the ETH 2.0, we’ll install and run Go Ethereum (Geth).
#Add Repo sudo add-apt-repository -y ppa:ethereum/ethereum #Install Geth sudo apt-get update sudo apt-get install ethereum
To ensure it’s aways running, even after a crash or a reboot, we’ll create an Ubuntu service for Geth:
#Create Service / Unit sudo nano /etc/systemd/system/geth.service
And paste the following code:
[Unit] Description=Geth [Service] ExecStart=/usr/bin/geth --http --syncmode fast StandardOutput=append:/root/geth.log RemainAfterExit=no Restart=on-failure RestartSec=5s [Install] WantedBy=default.target
#Enable Service sudo systemctl enable geth #Start Service sudo systemctl start geth #Ensure it's running, by checking logs tail -f /root/geth.log
Step 2— Generate your ETH2 Deposit Address(es)
Download the most recent release Eth2.0-deposit-cli/releases.
#Generate Ethereum 2.0 Deposit Address ./deposit new-mnemonic
After you complete the interactive CLI, you may have saved your 24-word mnemonic, together with some files — deposit_data, and keystore(s) — we’ll come to these later.
Store the mnemonic in a safe place as it’s the only way to withdrawal your funds later.
Step 3 — Make the Deposit(s) via ETH2 Launchpad
After you have the addresses ready, it’s time to visit the launchpad to make the deposit simply and securely.
Read and accept everything, until you reach the Upload Deposit File part. You’ll have to upload the recently created deposit_data-xxxxx.json
Connect your preferred wallet, and fund the deposit until you fund the addresses generated.
Step 4— Setup Prysm — Implementation of ETH 2.0
To continue our setup, we’ll install Prysm, which is basically an implementation of Ethereum 2.0 written in Go. If you want to learn more, check this link: https://docs.prylabs.network/docs/getting-started
#Create Directory for Installation cd ~ && mkdir prysm && cd prysm #Install Prysm from Source curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh && chmod +x prysm.sh
Then we Run the Beacon Node connecting it to the Ethereum 1 Full Node of Step 1. It must be fully Synced with the Network, otherwise we’ll have an error. If it’s happening just wait, and try again later.
#Start beacon Node /root/prysm/prysm.sh beacon-chain --http-web3provider=http://localhost:8545
When the beacon node finally runs, we can create another Ubuntu Service to ensure the beacon node will be always running like we did before for Geth
#Create Service / Unit sudo nano /etc/systemd/system/prysm_beacon.service
And paste the following code:
[Unit] Description=Geth [Service] ExecStart=/bin/bash /root/prysm/prysm.sh beacon-chain --http-web3provider=http://localhost:8545 RemainAfterExit=no Restart=on-failure RestartSec=5s [Install] WantedBy=default.target
#Enable Service sudo systemctl enable prysm_beacon #Start Service sudo systemctl start prysm_beacon
Step 5— Import the Funded ETH2 Addresses
We’re almost over: Now you have to copy/upload the generated keys at step 2, and funded at step 3 to the server, and run the following code, with the parameter of their location
#Import Accounts to Prysm /root/prysm/prysm.sh validator accounts import — keys-dir=/root/prysm/validator_keys
It will ask you to ask you for a password to secure the wallet, and also the password you used to generate the key(s) in step 2
Step 6— Run your Validator
We’re good to Go!
Our Ethereum 1.0 node is running and synced, our beacon node is running, and our account(s) are well funded and imported — Let’s start our Validator:
#Start Prysm Validator /root/prysm/prysm.sh validator
If it runs, it means everything is done with Prysm —Your Node is 100% ready to start Validating — , let’s start the automation, by creating a file called “pw”, and input there the wallet password you created on Step 5.
Then we’ll create another Ubuntu Service that loads that pw file, and autostarts, ensuring the validator runs all the time.
#Create Service / Unit sudo nano /etc/systemd/system/validator.service
And paste the following code:
[Unit] Description=Validator [Service] ExecStart=/bin/bash /root/prysm/prysm.sh validator --wallet-password-file /root/prysm/pw StandardOutput=append:/root/validator.log RemainAfterExit=no Restart=on-failure RestartSec=5s [Install] WantedBy=default.target
#Enable Service sudo systemctl enable validator#Start Service sudo systemctl start validator#Ensure it's running, by checking logs tail -f /root/validator.log
Written by João Silva | Business Development Manager at Cleverti