Skip to content

Lava

Installation

Terminal window
# install dependencies, if needed
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
Terminal window
# install go, if needed
cd $HOME
VER="1.20.5"
wget "https://golang.org/dl/go$VER.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$VER.linux-amd64.tar.gz"
rm "go$VER.linux-amd64.tar.gz"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
# set vars
echo "export WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="test"" >> $HOME/.bash_profile
echo "export LAVA_CHAIN_ID="lava-testnet-2"" >> $HOME/.bash_profile
echo "export LAVA_PORT="20"" >> $HOME/.bash_profile
source $HOME/.bash_profile
# download binary
cd $HOME
wget -O lavad https://github.com/lavanet/lava/releases/download/v5.1.0/lavad-v5.1.0-linux-amd64
chmod +x $HOME/lavad
mv $HOME/lavad $HOME/go/bin/lavad
# config and init app
lavad init $MONIKER --chain-id $LAVA_CHAIN_ID
sed -i \
-e 's/timeout_commit = ".*"/timeout_commit = "30s"/g' \
-e 's/timeout_propose = ".*"/timeout_propose = "1s"/g' \
-e 's/timeout_precommit = ".*"/timeout_precommit = "1s"/g' \
-e 's/timeout_precommit_delta = ".*"/timeout_precommit_delta = "500ms"/g' \
-e 's/timeout_prevote = ".*"/timeout_prevote = "1s"/g' \
-e 's/timeout_prevote_delta = ".*"/timeout_prevote_delta = "500ms"/g' \
-e 's/timeout_propose_delta = ".*"/timeout_propose_delta = "500ms"/g' \
-e 's/skip_timeout_commit = ".*"/skip_timeout_commit = false/g' \
$HOME/.lava/config/config.toml
# download genesis and addrbook
wget -O $HOME/.lava/config/genesis.json https://server-4.itrocket.net/testnet/lava/genesis.json
wget -O $HOME/.lava/config/addrbook.json https://server-4.itrocket.net/testnet/lava/addrbook.json
# set seeds and peers
SEEDS="eb7832932626c1c636d16e0beb49e0e4498fbd5e@lava-testnet-seed.itrocket.net:20656"
PEERS="3693ea5a8a9c0590440a7d6c9a98a022ce3b2455@lava-testnet-peer.itrocket.net:20656,cac61825d7225f40f1fb25b26238f302de6a0380@65.109.113.242:35256,13a9209a4d08803a3becac57de8eb02dd51f8f41@65.109.23.114:19956,0a528da95ca8025ef4043b6e73f1e789f4102940@176.103.222.22:26656,d60f8d9f8e5916c3ad7d7dd2d251f274b4efc310@193.122.137.30:26656,fb9b0822df6083824d39669cbce7eb6258969c73@37.142.120.101:28656,0aeff7accab494567edc0d5aab28f24cf8e3ecbc@65.109.28.165:26656,98fe8b7cbc376484f0c7f01517f55bc4e206c8d7@65.109.106.6:26656,05a256658f0400777c24829021a9927cda6bc29e@51.222.241.155:26656,3cc2733c2247c935290c18403bd3afb8ca9df23e@86.48.31.100:26656"
sed -i -e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*seeds *=.*/seeds = \"$SEEDS\"/}" \
-e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*persistent_peers *=.*/persistent_peers = \"$PEERS\"/}" $HOME/.lava/config/config.toml
# set custom ports in app.toml
sed -i.bak -e "s%:1317%:${LAVA_PORT}317%g;
s%:8080%:${LAVA_PORT}080%g;
s%:9090%:${LAVA_PORT}090%g;
s%:9091%:${LAVA_PORT}091%g;
s%:8545%:${LAVA_PORT}545%g;
s%:8546%:${LAVA_PORT}546%g;
s%:6065%:${LAVA_PORT}065%g" $HOME/.lava/config/app.toml
# set custom ports in config.toml file
sed -i.bak -e "s%:26658%:${LAVA_PORT}658%g;
s%:26657%:${LAVA_PORT}657%g;
s%:6060%:${LAVA_PORT}060%g;
s%:26656%:${LAVA_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${LAVA_PORT}656\"%;
s%:26660%:${LAVA_PORT}660%g" $HOME/.lava/config/config.toml
# config pruning
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.lava/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.lava/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"19\"/" $HOME/.lava/config/app.toml
# set minimum gas price, enable prometheus and disable indexing
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.0ulava"|g' $HOME/.lava/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.lava/config/config.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.lava/config/config.toml
# create service file
sudo tee /etc/systemd/system/lavad.service > /dev/null <<EOF
[Unit]
Description=Lava node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.lava
ExecStart=$(which lavad) start --home $HOME/.lava
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
# reset and download snapshot
lavad tendermint unsafe-reset-all --home $HOME/.lava
curl https://server-4.itrocket.net/testnet/lava/lava_2025-02-22_2736518_snap.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.lava
# enable and start service
sudo systemctl daemon-reload
sudo systemctl enable lavad
sudo systemctl restart lavad && sudo journalctl -u lavad -fo cat

Create Wallet

Terminal window
# to create a new wallet, use the following command. don’t forget to save the mnemonic
lavad keys add $WALLET
# to restore exexuting wallet, use the following command
lavad keys add $WALLET --recover
# save wallet and validator address
WALLET_ADDRESS=$(lavad keys show $WALLET -a)
VALOPER_ADDRESS=$(lavad keys show $WALLET --bech val -a)
echo "export WALLET_ADDRESS="$WALLET_ADDRESS >> $HOME/.bash_profile
echo "export VALOPER_ADDRESS="$VALOPER_ADDRESS >> $HOME/.bash_profile
source $HOME/.bash_profile
# check sync status, once your node is fully synced, the output from above will print "false"
lavad status 2>&1 | jq
# before creating a validator, you need to fund your wallet and check balance
lavad query bank balances $WALLET_ADDRESS

Create Validator

Terminal window
lavad tx staking create-validator \
--amount 1000000ulava \
--from $WALLET \
--commission-rate 0.1 \
--commission-max-rate 0.2 \
--commission-max-change-rate 0.01 \
--min-self-delegation 1 \
--pubkey $(lavad tendermint show-validator) \
--moniker "test" \
--identity "" \
--website "" \
--details "" \
--chain-id lava-testnet-2 \
--fees 300ulava \
-y