Running a Gnosis Validator on Digital Ocean droplet

Setting up a Gnosis Validator:

Setup ssh key:

Created a new public/private key pair to interact with the console of the droplet.

Create a droplet

Create a droplet with the following values.

  • 4 vCPUs

  • 32GB / 600GB Disk

  • ($262/mo)

Setup firewall

Set up the firewall ports for Nethermind, Prysm & Lighthouse.

sudo ufw allow 30303

sudo ufw deny 8545

sudo ufw allow 12000/udp

sudo ufw allow 13000/tcp

sudo ufw enable

Note: Faced an issue connecting to the droplet after making this change. Had to enable port 22 to get it working.

Install docker-compose:

Using the terminal, run the commands given to install docker-compose.

sudo apt-get remove docker-compose sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Generate Validator Keystores and Deposit Data

Pull the docker image for the validator data generator.

cd docker pull ghcr.io/gnosischain/validator-data-generator:latest

This will be used to generate key stores and deposit data.

Generating validator keys and deposit data

Run the below command in the terminal

docker run -it --rm -v /root/snap/validator_keys:/app/validator_keys ghcr.io/gnosischain/validator-data-generator:latest new-mnemonic --num_validators=1 --mnemonic_language=english --folder=/app/validator_keys

Take down the mnemonic seed phrase and follow the steps in the terminal.

Choose Your Beacon Chain Client & Import Validator Keys

I chose the lighthouse client.

Installing the lighthouse client

Download the lighthouse-v{version}-x86_64-apple-darwin-portable.tar.gz binary from the releases page.

wget https://github.com/sigp/lighthouse/releases/download/v3.2.1/lighthouse-v3.2.1-x86_64-unknown-linux-gnu-portable.tar.gz

Extract the archive.

tar -xvf lighthouse-v3.2.1-x86_64-unknown-linux-gnu-portable.tar.gz 

Move the lighthouse binary to a location in the path.

Obtain the lighthouse docker image

Run the following command to obtain the latest lighthouse docker image

docker pull sigp/lighthouse

Download and test the image with

docker run sigp/lighthouse lighthouse --version

Build from Source

  • Install Rust using [rustup]. Once done, run the below command to add cargo command to the path. source "$HOME/.cargo/env"

  • Install the following packages

    sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang protobuf-compiler
    

Build Lighthouse

Clone the lighthouse repository

git clone https://github.com/sigp/lighthouse.git
cd lighthouse
git checkout stable
make

While running the make command I ran into an error.

error: could not compile http_api due to previous error

The solution to this was to add a recursion limit to the crate http_api

#![recursion_limit = "256"]

After adding this the make command was successful.

Start the processes

To start the consensus layer, run the below command inside the validator-keys folder

lighthouse bn --http

To start the execution layer, run the below command

docker run -p 9000:9000/tcp -p 9000:9000/udp -p 127.0.0.1:5052:5052 -v $HOME/.lighthouse:/root/.lighthouse sigp/lighthouse lighthouse --network mainnet beacon --http --http-address 0.0.0.0

Connecting to an external execution layer

Create a random jwt token as this will be used to connect to an external node
openssl rand -hex 32 | tr -d "\n" > "/tmp/jwtsecret"

Once created, start the consensus layer by passing the execution layer address and the created jet

lighthouse bn --http ----execution-endpoint https://gnosischain-rpc.gateway.pokt.network --execution-jwt /tmp/jwtsecret
Subscribe to Airesh Bhat
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.