Lava Full Node

Deploy a full node for Lava chain, this is a non-validating node. NOTE: this is for current lava-testnet-2

Document Last Update: 14/09/23

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

Lava Chain: is a cosmos PoS layer 1 with $LAVA for settlement, validator nodes secure the chain.

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


Hardware requirements:

For Full (current Testnet): 8GB RAM /100GB SSD Storage/ CPU 4v x64 2.0 GHz. These are minimum specs, and I would recommend more.

1.    Initial Setup

Update and install dependencies

sudo apt update && sudo apt upgrade -y

sudo apt install git curl wget tar unzip jq build-essential pkg-config clang bsdmainutils make ncdu -y

Install Go

Use version 1.20.5 for current binary

wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.20.5

Run source $HOME/.bashrc to take effect

Confirm install is successful

go version

This script is made by osmosis-labs and installs PATH variables to .bashrc and sets up in a way compatible with the rest of the build. Go binary installs to $HOME/.go and $HOME/go/bin

#to remove installation 
wget -q -O - https://git.io/vQhTU | bash -s -- --remove

2. Download Lava Binary

Note: downloading the latest binary requires snapshot

Check for latest version here: replace version accordingly, always use the version tagged latest

Select binary type.

Lava is split into two binaries which handle different functions, lava-visor handles consensus for lava, while lava-protocol is the process for provider node.

For lava full node lavad
For provider node lava-provider

export LAVA_BINARY=lavad
cd $HOME
git clone https://github.com/lavanet/lava.git
cd lava
git checkout v0.22.0
make install

Confirm installed

which lavad
lavad --help

When running the binary 1st time it creates the working folder .lava with the following files, app.toml, client.toml, config.toml

3. Lava CLI

client.toml: Configuration file for using the lava CLI

If not setting up as a full node and syncing the data, you can add a public RPC. This adds to the client.toml

Skip this step if using your own (following the rest of this guide), the default is tcp://localhost:26657

lavad config node https://public-rpc.lavanet.xyz:443/rpc/

Set Keyring backend and chain-id

lavad config chain-id lava-testnet-2
lavad config keyring-backend test

Set Variables:

LAVA_WALLET="NAME OF WALLET"
LAVA_MONIKER="NAME OF CHOICE FOR NODE"

Adding Wallet:

# create new
lavad keys add $LAVA_WALLET --keyring-backend test
# to restore from seed
lavad keys add $LAVA_WALLET --keyring-backend test --recover

4. Configure Lava Node

Configuration of lavad to run as a full node with Snapshot

Initialize node

lavad init $LAVA_MONIKER --chain-id lava-testnet-2

Get Genesis

wget -O $HOME/.lava/config/genesis.json "https://raw.githubusercontent.com/lavanet/lava-config/main/testnet-2/genesis_json/genesis.json"

Set Min Gas Price

This needs to be configured to avoid an error

sed -i -e 's|^minimum-gas-prices = ".*"|minimum-gas-prices = "0ulava"|' $HOME/.lava/config/app.toml

Set Seeds

SEEDS="3a445bfdbe2d0c8ee82461633aa3af31bc2b4dc0@testnet2-seed-node.lavanet.xyz:26656,e593c7a9ca61f5616119d6beb5bd8ef5dd28d62d@testnet2-seed-node2.lavanet.xyz:26656,258f523c96efde50d5fe0a9faeea8a3e83be22ca@seed.lava-testnet-2.lava.aviaone.com:20271,3a445bfdbe2d0c8ee82461633aa3af31bc2b4dc0@testnet2-seed-node.lavanet.xyz:26656,e593c7a9ca61f5616119d6beb5bd8ef5dd28d62d@testnet2-seed-node2.lavanet.xyz:26656"
PEERS=""
sed -i 's|^seeds *=.*|seeds = "'$SEEDS'"|; s|^persistent_peers *=.*|persistent_peers = "'$PEERS'"|' $HOME/.lava/config/config.toml

Download Address-book

This can aid in finding peers quicker, many validators host this, example is with AviaOne

wget -O $HOME/.lava/config/addrbook.json "https://services.lava-testnet-2.lava.aviaone.com/addrbook.json"

5. Download Chain data (Snapshot)

This install method is using snapshot data, this means downloading the blockchain history directly from a trusted source, many community members host this data example: Kjnodes, AviaOne, Skynodes, bccnodes

If you have previously started the node and started to sync the chain, you will need to clear the data to use snapshot

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

Get Snapshot URL, from one of the providers above

SNAPSHOT_URL="COPY URL TO RECENT SNAPSHOT HERE"

Depending on Provider, you may have gz or lz4 extension files

Option 1: Download Snapshot gz extension

cp $HOME/.lava/data/priv_validator_state.json $HOME/.lava/priv_validator_state.json.backup
rm -rf $HOME/.lava/data $HOME/.lava/wasm
wget -c $SNAPSHOT_URL $ -O - | tar -xz -C $HOME/.lava
mv $HOME/.lava/priv_validator_state.json.backup $HOME/.lava/data/priv_validator_state.json

Option 2: Download Snapshot lz4 extension

# get packages required to unpack data
sudo apt install snapd -y
sudo snap install lz4 

# Download Snapshot
cp $HOME/.lava/data/priv_validator_state.json $HOME/.lava/priv_validator_state.json.backup
rm -rf $HOME/.lava/data $HOME/.lava/wasm
curl -L $SNAPSHOT_URL | tar -Ilz4 -xf - -C $HOME/.lava
mv $HOME/.lava/priv_validator_state.json.backup $HOME/.lava/data/priv_validator_state.json

Adjust Pruning settings for Snapshot

WARNING: Check with snapshot provider to confirm and adjust the app.toml accordingly for pruning settings, as these values may be different depending on provider.

change to pruning = “custom”

Adjust the config.toml accordingly for indexer settings

7. Set up SystemD for Lava Node

Option 1: without Cosmovisor

Set up a system service to run the lava node

sudo tee /etc/systemd/system/lavad.service > /dev/null <<EOF
[Unit] 
Description=LAVA\n 
After=network.target 
[Service] 
Type=simple
User=$USER
ExecStart=$(which lavad) start 
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

Enable and Start service

sudo systemctl daemon-reload
sudo systemctl enable lavad
sudo systemctl start lavad

Check status and logs

sudo systemctl status lavad
journalctl -u lavad -f
Synced & working node will look similar
Synced & working node will look similar

Stop service

sudo systemctl stop lavad

Make changes to service file

sudo nano /etc/systemd/system/lavad.service

Check Node Sync status

# Query via the RPC (default port: 26657)
curl http://localhost:26657/status | jq .result.sync_info.catching_up

Option 2: with Cosmovisor

Cosmovisor: is a process management tool to handle cosmos-based chain upgrades seamlessly, it looks for chain upgrades and downloads & installs at the correct block height.

Create directories for Cosmovisor

cd
mkdir -p ~/.lava/cosmovisor/genesis/bin
mkdir -p ~/.lava/cosmovisor/upgrades

create directory for corresponding binary version (change v0.22.0 accordingly)

mkdir -p ~/.lava/cosmovisor/upgrades/v0.22.0/bin

Install Cosmovisor binary

go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest

this should install Cosmovisor binary to $GOPATH/bin/cosmovisor

Copy binaries to Cosmovisor

Note on versions: if using snapshot (this guide) you are downloading the latest binary, with chain data manually downloaded and placed in the correct location, Cosmovisor will look from the block height the node is currently on and the corresponding binary in the upgrades folder.  The binary also needs to be placed in ~/.lava/cosmovisor/genesis/bin for first start up or an error will occur.

cp $GOPATH/bin/lavad ~/.lava/cosmovisor/genesis/bin
cp $GOPATH/bin/lavad ~/.lava/cosmovisor/upgrades/v0.22.0/bin/

Create system service:

Set up a system service to run the lava node through Cosmovisor

sudo tee /etc/systemd/system/cosmovisor.service > /dev/null <<EOF
[Unit]
Description=lava Daemon (cosmovisor)
After=network-online.target

[Service]
User=$USER
ExecStart=$HOME/go/bin/cosmovisor run start
Restart=always
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_NAME=lavad"
Environment="DAEMON_HOME=$HOME/.lava"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_LOG_BUFFER_SIZE=512"

[Install]
WantedBy=multi-user.target
EOF

Enable and Start service

sudo systemctl daemon-reload
sudo systemctl enable cosmovisor
sudo systemctl start cosmovisor

Additional Settings to Open Node for API calls

Edit RPC/gRPC server configurations

Edit Configurations to ensure APIs are open and reachable on all servers, to expose externally change to 0.0.0.0 which will listen for requests from any IP.

If configuring with a sub-domain process (setup locally) then localhost should be used, as these API ports would only need to be exposed to the host.

Ports can be changed, if need be but will need to be changed in any other services that connect.

Open RPC: in config.toml

# TCP or UNIX socket address for the RPC server to listen on
laddr = "tcp://0.0.0.0:26657"

# TCP or UNIX socket address for the gRPC server to listen on
# NOTE: This server only supports /broadcast_tx_commit
grpc_laddr = ""

Open REST API: in app.toml

[api]

# Enable defines if the API server should be enabled.
enable = true

# Swagger defines if swagger documentation should automatically be registered.
swagger = false

# Address defines the API server to listen on.
address = "tcp://0.0.0.0:1317"

Open gRPC: in app.toml

[grpc]

# Enable defines if the gRPC server should be enabled.
enable = true

# Address defines the gRPC server address to bind to.
address = "tcp://0.0.0.0:9090"

Open Ports in Firewall settings

sudo ufw allow 26657 # RPC
sudo ufw allow 26656 # P2P Port
sudo ufw allow 1317 # REST
sudo ufw allow 9090 # gRPC

# Ensure do not get locked ot if on VPS
sudo ufw allow shh
sudo ufw enable

Port forward these ports from router if running local

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.