Lava Protocol, a crypto-market which powers a decentralized RPC layer for Web3. How to setup a Validator node with Cosmovisor
This Guide will focus on the setup of a Validator node which is also a Full node for Lava chain, with cosmovisor
Cosmovisor: Cosmovisor is a tool for automating the upgrades process. it runs as a small process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals and can automatically download new binaries.
A validator can be setup without this tool, where the binaries must be updated manually
Hardware Requirements: 4vCPU/8GB/100GB SSD
OS: Ubuntu 20.04LTS
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
apt install logrotate git jq sed wget curl coreutils systemd unzip -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 installation with go version
and echo $PATH
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.
git clone https://github.com/lavanet/lava-config.git
cd lava-config/testnet-1
Copy Config Files
mkdir -p $HOME/.lava/config
cp default_lavad_config_files/* $HOME/.lava/config
Copy the genesis.json file to the Lava config folder
cp genesis_json/genesis.json $HOME/.lava/config/
from home
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0
Create the Cosmovisor folder and copy config files to it
mkdir -p $HOME/.lava/cosmovisor
mkdir -p $HOME/.lava/data
Download the latest cosmovisor-upgrades from S3
wget https://lava-binary-upgrades.s3.amazonaws.com/testnet/cosmovisor-upgrades/cosmovisor-upgrades.zip
unzip cosmovisor-upgrades.zip
cp -r cosmovisor-upgrades/* $HOME/.lava/cosmovisor
Set environment variables
echo "# Setup Cosmovisor" >> ~/.bash_profile
echo "export DAEMON_NAME=lavad" >> ~/.bash_profile
echo "export CHAIN_ID=lava-testnet-1" >> ~/.bash_profile
echo "export DAEMON_HOME=$HOME/.lava" >> ~/.bash_profile
echo "export DAEMON_ALLOW_DOWNLOAD_BINARIES=true" >> ~/.bash_profile
echo "export DAEMON_LOG_BUFFER_SIZE=512" >> ~/.bash_profile
echo "export DAEMON_RESTART_AFTER_UPGRADE=true" >> ~/.bash_profile
echo "export UNSAFE_SKIP_BACKUP=true" >> ~/.bash_profile
source ~/.bash_profile
Initialize the chain
from lava-config/testnet-1
from home?
$HOME/lava_validator/cosmovisor/genesis/bin/lavad init \
my-node \
--chain-id lava-testnet-1 \
--home $HOME/lava_validator \
--overwrite cp genesis_json/genesis.json $HOME/.lava/config/genesis.json
this will create an error, but ignore for now
confirm installation with cosmovisor version
echo "[Unit]
Description=Cosmovisor daemon
After=network-online.target
[Service]
Environment="DAEMON_NAME=lavad"
Environment="DAEMON_HOME=$HOME/.lava"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"
Environment="DAEMON_LOG_BUFFER_SIZE=512"
Environment="UNSAFE_SKIP_BACKUP=true"
User=$USER
ExecStart=$HOME/go/bin/cosmovisor start --home=$HOME/.lava
Restart=always
RestartSec=3
LimitNOFILE=infinity
LimitNPROC=infinity
[Install]
WantedBy=multi-user.target
" >cosmovisor.service
sudo mv cosmovisor.service /lib/systemd/system/cosmovisor.service
Optional: add seed node with the flag --p2p.seeds $seed_node
systemctl daemon-reload
systemctl enable cosmovisor.service
systemctl start cosmovisor
Logs
sudo journalctl -u cosmovisor -f
Without any seeds node or addrbook it can take a while to find peers and start syncing.