Lava Network- Validator Node

Lava Protocol, a crypto-market which powers a decentralized RPC layer for Web3.

Main Concepts

Lava Chain: is a cosmos PoS layer 1 with $LAVA for settlement, validator nodes secure the chain by verifying new blocks to earn rewards.

Providers: Provider nodes, are nodes running atop Lavanet connecting to Lava chain for rewards do not participate in consensus), these nodes provide RPC endpoints of other chains to any consumer.

Consumers: consumers of chain data, paying for access to RPC endpoints to providers

Setup Validator Node

This Guide will focus on the setup of a Validator node which is also a Full node for Lava chain

Hardware Requirements: 4vCPU/8GB/100GB SSD
OS: Ubuntu 20.04LTS

1. Install dependencies and setup server

Switch to root user, can exit any time with exit

sudo -i

Update your system and repositories

apt update && apt upgrade -y

Install Dependencies

The following packages required for lava node

sudo apt install make clang pkg-config libssl-dev build-essential git jq llvm libudev-dev -y

Install Go

Download and unpack installation file to /usr/local

ver="1.19.4"
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
rm -rf /usr/local/go
tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"

Add to PATH

echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile

Confirm installed with go version

Firewall Settings

Outbound - allow all traffic. Inbound - open the following ports: 1317 - REST, 26657 - TENDERMINT_RPC, 26656 - Cosmos

sudo ufw allow 1317
sudo ufw allow 26657
sudo ufw allow 26656
sudo ufw allow ssh
sudo ufw enable

Default setting ufw is to allow all outgoing, if your server is remote ensure to allow 22 for ssh.

2. Download Lava Node (lavad)

Download lavad (genesis) binary, move to $HOME/go/bin and make executable. Check discord ‘updates’ for the latest version.

mkdir -p $HOME/go/bin
wget $HOME/go/bin/lavad "https://lava-binary-upgrades.s3.amazonaws.com/testnet/v0.4.0/lavad" -O lavad
chmod +x $HOME/go/bin/lavad

Lavad should now be accessible from PATH, to verify run lavad --help this will output available commands, if you have Error then make sure the lavad_binary_path is part of PATH

3. Download setup configurations

Copy lavad default config files to config Lava config folder, and set genesis JSON file in the configuration folder, obtain files from here

git clone https://github.com/K433QLtr6RA9ExEq/GHFkqmTzpdNLDd6T.git
cd GHFkqmTzpdNLDd6T/testnet-1

in here you can see the configurations, source setup_config/setup_config.sh

mkdir -p $HOME/.lava/config
cp default_lavad_config_files/* $HOME/.lava/config
cp genesis_json/genesis.json $HOME/.lava/config/genesis.json

This makes a folder in our working directory .lava to copy setup configurations to, that were cloned from github. 2nd line copies the folder and contents to $HOME/.lava/config, and 3rd line the file genesis.json to $HOME/.lava/config

You should have the following files in here now
You should have the following files in here now

Validator Configurations

These configurations should be set to help with performance which can be edited in the ~/.lava/config/config.toml

create_empty_blocks = true
create_empty_blocks_interval = "60s"
timeout_propose = "60s"
timeout_commit = "60s"
timeout_broadcast_tx_commit = "601s"

4 . Setup lavad to run with systemD

Make System service file

tee /etc/systemd/system/lavad.service << EOF
[Unit]
Description=Lava Node
After=network-online.target
[Service]
User=root
ExecStart=$(which lavad) start --home="$HOME/.lava"
Restart=always
RestartSec=30
LimitNOFILE=infinity
LimitNPROC=infinity
[Install]
WantedBy=multi-user.target
EOF

Enable and Start Service

systemctl enable lavad
systemctl daemon-reload
systemctl start lavad

Check running and Check logs with

systemctl status lavad
journalctl -u lavad -f
if started with no errors node will be trying to connect to other peers
if started with no errors node will be trying to connect to other peers

It might take a while to find peers, and get synced. If having trouble a number of options as follows can be tried.

Adding an address book

a number of validators are hosting address books, that you can download to help find peers quicker. Such as

curl -s https://snapshots1-testnet.nodejumper.io/lava-testnet/addrbook.json > $HOME/.lava/config/addrbook.json 

Snapshot Sync (optional)

lavad tendermint unsafe-reset-all --home $HOME/.lava --keep-addr-book

This resets and deletes current chain data, next to download a snapshot of the chain from one of a number of hosts.

SNAP_NAME=$(curl -s https://snapshots1-testnet.nodejumper.io/lava-testnet/ | egrep -o ">lava-testnet-1.*\.tar.lz4" | tr -d ">")
curl https://snapshots1-testnet.nodejumper.io/lava-testnet/${SNAP_NAME} | lz4 -dc - | tar -xf - -C $HOME/.lava

Check Sync

curl localhost:26657/status
Look for catching up, this will be false once synced
Look for catching up, this will be false once synced

5. Wallet Setup

You need to create a wallet on Lava chain and to fund it with $LAVA (test tokens)

Option 1: Via Keplr browser extension (Experimental)

Keplr is a cosmos based browser extension for Cosmos chains, you can install and setup with keplr then connect to the Lava network below.

Option 2: Create New Via CLI

lavad keys add <your-key-name> --keyring-backend test

new account details will be output, the name, public address and your mnemonic phrase. Save your Seed Phrase as this is the only way to recover your wallet. NOTE: Your public address, starts with lava@

Restore existing wallet

If you used option 1, then run the following to import it to lavad on your device

lavad keys add <your-key-name> --keyring-backend test --recover

Once a wallet has been created, a working directory .lava becomes available and your keys will be stored in .lava/keyring-test. find out about Keyring here.

Show saved accounts/wallets

lavad keys list --keyring-backend test

Claim Tokens

This can be done from discord or via the Faucet API here.

Check Balance

Once tokens have been claimed you can query balance using your own node with

lavad query bank balances "<YOUR_ADDRESS>" --denom ulava 

6. Create Validator

Create Validator Transaction

lavad tx staking create-validator \
--amount="<ammount to stake>ulava" \
--pubkey=$(lavad tendermint show-validator --home "$HOME/.lava/") \
--moniker="<your name of choice>" \
--chain-id=lava-testnet-1 \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1" \
--gas="auto" \
--home="$HOME/.lava/" \
--from=<name of wallet from step5>

It will broadcast your transaction and output a TX hash you can search on the blockchain explorer, or find your validator node there once confirmed

Find Valoper address

A validator node, has a unique address Valoper different from the standard derived address from the same seed.

lavad keys show <wallet-key> --bech val -a

See Validator Details

lavad q staking validator <Valoper address>

Useful Commands

Stop and Restart Node for changes to configs

systemctl stop lavad
# make changes to config files in ./lava/config
# restart service with
systemctl daemon-reload
systemctl restart lavad

Delegate to validator (add more to own validator)

lavad tx staking delegate <lava@valoper1...-address> 1000000ulava --chain-id <CHAIN-ID> --from <wallet-name> --gas=auto

Withdraw all-rewards & commission

lavad tx distribution withdraw-rewards <lava@valoper1...-address> --from <wallet-name>  --chain-id <CHAIN-ID> --commission --yes --gas=auto

unjail command

lavad tx slashing unjail --from <wallet_name> --chain-id <CHAIN-ID> --gas=auto

Updating Version

See HERE

If not using cosmovisor, upgrade the binaries manually with the following steps. You can check for governance to see at what block height the proposal upgrade is to be implemented, upgrades must be done when this block height is reached.

curl localhost:26657/status
for v0.5.2 the upgrade is at block 63760
for v0.5.2 the upgrade is at block 63760

Stop Lava Validator

systemctl stop lavad

Set new version

Look for releases here, and change the required_upgrade_name respectively

temp_folder=$(mktemp -d) && cd $temp_folder
required_upgrade_name="v0.5.3"
upgrade_binary_url=https://lava-binary-upgrades.s3.amazonaws.com/testnet/$required_upgrade_name/lavad
source $HOME/.bash_profile

Obtain new binary

wget "$upgrade_binary_url" -q -O $temp_folder/lavad

Make executable

chmod +x $temp_folder/lavad

Replace current binary

sudo cp $temp_folder/lavad $(which lavad)

Restart Lava Validator

systemctl daemon-reload
systemctl start lavad

You can confirm version with lavad version
check logs and sync with the following

lavad status | jq .SyncInfo.catching_up

Alternative- If this doesn’t work

If this doesn’t work, it may be that the file path name has changed, you can manually get the file from GitHub from here: https://github.com/lavanet/lava/releases

Manually copy the link from under assets under specific version

Example (with version 0.6.0)

wget https://github.com/lavanet/lava/releases/download/v0.6.0/lavad-v0.6.0-RC3-linux-amd64

Make Executable

chmod +x lavad-v0.6.0-RC3-linux-amd64

 Move and rename to the executable files directory

sudo mv lavad-v0.6.0-RC3-linux-amd64 /root/go/bin/lavad

 this method simply downloads the binary to the home folder, you grant permissions then move and rename the now executable file to the right path in the service. Can follow the remaining steps to restart the node.

Server Migration

Process for migrating validator from one server to another

1. Backup “priv_validator_key.json”

On the old server that you wish to retire Locate priv_validator_key.json it should be in here by default cd .lava/config/priv_validator_key.json

2. Start Node & Sync New Server

follow the steps for a validator up until Create wallet (Step 5) allow this node to fully sync, use snapshot for a fast migration. Allow to sync on the New server

3. Stop Node on Old Server

Before inserting the existing validator key on the new server, ensure that the Old Server validator/node is stopped

systemctl stop lavad.service

Shut down the device to be sure, and erase the data/reinstall

4. Replace the priv_validator_key.json on New Server

Stop the Node on New server

systemctl stop lavad

Open the priv_validator_key.json on the New Device for editing. Replace the contents with the contents from original server.

nano /home/$USER/.lava/config/priv_validator_key.json

5. Recover wallet on New server

lavad keys add <your-key-name> --keyring-backend test --recover

6.  Restart the node on New server

Setup with Cosmovisor

Subscribe to GLCstaked
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.