Validating Kava-4 Mainnet

Kevin Davis
5 min readDec 2, 2019

--

The Kava 4 upgrade is scheduled to take place October 15th, 2020! Here’s an updated guide on setting up a mainnet validator. Note that this is a minimal guide and does not cover more advanced topics like sentry node architecture and double signing protection. It is strongly recommended that any parties considering validating do additional research.

Installing Kava — Prerequisites

You should select an all-purpose server with at least 8GB of RAM, good connectivity, and a solid state drive with sufficient disk space. Storage requirements are discussed further in the section below. In addition, you’ll need to open port 26656 to connect to the Kava peer-to-peer network. As the usage of the blockchain grows, the server requirements may increase as well, so you should have a plan for updating your server as well.

Storage

The monthly storage requirements for a node are as follows. These are estimated values based on experience, but should serve as a good guide.

  • An archival node (pruning = "nothing" ) grows at a rate of ~100 GB per month
  • A fully pruning node (pruning = "everything" ) grows at a rate of ~5 GB per month
  • A default pruning node (`pruning = “default”) grows at a rate of ~25 GB per month

Install Go

Kava is built using Go and requires Go version 1.13+. In this example, we will be installing Go on a fresh install of ubuntu 18.04.

# Updates ubuntu
sudo apt update
sudo apt upgrade -y
# Installs packages necessary to run go
# Installs jq for pretty formatting command line outputs
sudo apt install build-essential jq -y
# Installs go
wget https://dl.google.com/go/go1.15.8.linux-amd64.tar.gz
sudo tar -xvf go1.15.8.linux-amd64.tar.gz
sudo mv go /usr/local
# Updates environmental variables to include go
cat <<EOF>> ~/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
source ~/.profile

To verify that go is installed:

go version# Should return go version go1.15.8 linux/amd64

Install Kava

We’ll install Kava using git clone. Note that version 0.3.1 is the correct version for mainnet.

git clone https://github.com/kava-labs/kava
cd kava
git checkout v0.12.4
make install

To verify that kava is installed:

kvd version --long
# name: kava
# server_name: kvd
# client_name: kvcli
# version: 0.12.4
# commit: 3fdf88ee96e9867fe79946b59f05426a701dc9fc
# build_tags: netgo,ledger
# go: go version go1.15.8 linux/amd64

Configuring Your Node

Next, we need to download the correct genesis file and sync our node with the Kava mainnet. To download the genesis file:

# First, initialize kvd. Replace <name> with the public name of your node
kvd init --chain-id kava-6 <name>
# Download the genesis file
wget https://raw.githubusercontent.com/Kava-Labs/launch/master/kava-6/genesis.json -O $HOME/.kvd/config/genesis.json
# Verify genesis hash
jq -S -c -M '' $HOME/.kvd/config/genesis.json | shasum -a 256
# 8e59b43d5c287b752e9f7efa083b01cb2ca504fb27698bda7b9c16dc60b31a22

Next, we want to adjust some configurations. To open the config file:

vim $HOME/.kvd/config/config.toml

At line 160, add a seeds. These are used to connect to the peer-to-peer network:

seeds = "e66bab0b02ff7d3a16b945eadb2f56e05761a922@52.87.79.182:26656"

And at line 163, add some persistent peers, which help maintain a connection to the peer-to-peer network:

persistent_peers = "08c8ce458e641517b43201e4e60be1258be17198@52.21.161.252:26656,cba00e5675c574539d3ab5471623d7572b0e6b30@52.55.48.194:26656,ecc08ec62c8f1dec811a216f64f46f066a3c9e95@18.214.224.18:26656,fb430888445a8b3832c934e043bf3668c47b0c9d@35.174.230.88:26656,1291ef230910953545fb3d83c4e989578da978a1@35.157.56.248:26656,bd6d7005a588277b4306abc67c6605586971cd67@116.202.82.201:50056,e312b38635e7939ba462f8f59f8b461c18ed43bd@13.57.132.201:26656,c605c3c84e1e5aa911c877108614925f6d68c66d@184.72.37.153:26656,4daa3a43b309043795577153b0e33fe70eb1de1a@15.164.5.164:26656,6d0e6440300b7c39fd553d15ab7718fb42a8da89@13.124.234.166:26656,d3658cb9c63cf43b0c707401649809a6007a7c12@94.130.67.43:26656,a4b1509a84c1beeb4b8eb09fcb3bdcb4db96595f@167.86.71.208:26656"

Next, we need to chose how much historical state we want to store. To open the application config file:

vim $HOME/.kvd/config/app.toml

In this file, you can choose between default, nothing, and everything. To reduce hard drive storage, choose “everything” or “default”. To run an archival node, chose nothing.

pruning = "default"

In the same file, we want to set minimum gas prices — setting a minimum prevents spam transactions:

minimum-gas-prices = "0.001ukava"

Syncing Your Node

To sync our node, we will use systemd, which manages the Kava daemon and automatically restarts it in case of failure. To use systemd, we will create a service file. Be sure to replace <your_user> with the user on your server:

sudo tee /etc/systemd/system/kvd.service > /dev/null <<'EOF'
[Unit]
Description=Kava daemon
After=network-online.target

[Service]
User=<your_user>
ExecStart=/home/<your_user>/go/bin/kvd start
Restart=on-failure
RestartSec=3
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target
EOF

To start syncing:

# Start the node
sudo systemctl enable kvd
sudo systemctl start kvd

To check on the status of syncing:

kvcli status --output json | jq '.sync_info'

This will give output like:

{
"latest_block_hash": "21D7E37A0A5992E1992DD43E42C05E4475A6E212694F746ABEE132267067847D",
"latest_app_hash": "FBE0E799BCCA57F12F781252787BD6340782E5D45E591294D01269F481B128AC",
"latest_block_height": "183566",
"latest_block_time": "2021-03-22T17:21:41.848445277Z",
"earliest_block_hash": "09E688467E5016159D74CEDE2EE870D671CAA772F76E6697AEEB685A398ACB08",
"earliest_app_hash": "",
"earliest_block_height": "1",
"earliest_block_time": "2021-03-05T06:00:00Z",
"catching_up": false
}

The main thing to watch is that the block height is increasing. Once you are caught up with the chain, catching_up will become false. At that point, you can start using your node to create a validator.

To check the logs of the node

sudo journalctl -u kvd -f

Creating a Validator

First, create a wallet, which will give you a private key / public key pair for your node.

# Replace <your-key-name> with a name for your key that you will remember
kvcli keys add <your-key-name>
# To see a list of wallets on your node
kvcli keys list

Be sure to write down the mnemonic for your wallet and store it securely. Losing your mnemonic could result in the irrecoverable loss of KAVA tokens.

To see the options when creating a validator:

kvcli tx staking create-validator -h

An example of creating a validator with 50KAVA self-delegation and 10% commission:

# Replace <key_name> with the key you created previously
kvcli tx staking create-validator \
--amount=50000000ukava \
--pubkey=$(kvd tendermint show-validator) \
--moniker="choose moniker" \
--website="optional website for your validator"
--details="optional details for your validator"
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1" \
--from=<key_name> \
--chain-id=kava-3 \
--gas=auto
--gas-adjustment=1.4

To check on the status of your validator:

kvcli status --output json | jq '.validator_info'

After you have completed this guide, your validator should be up and ready to receive delegations. Note that only the top 100 validators by weighted stake (self-delegations + other delegations) are eligible for block rewards. To view the current validator list, checkout one of the Kava block explorers:

For technical questions and troubleshooting:

Disclaimer: This content is provided for informational purposes only, and should not be relied upon as legal, business, investment, or tax advice. You should consult your own advisers as to those matters. References to any securities or digital assets are for illustrative purposes only, and do not constitute an investment recommendation or offer to provide investment advisory services. Furthermore, this content is not directed at nor intended for use by any investors or prospective investors, and may not under any circumstances be relied upon when making investment decisions.

--

--

Kevin Davis

I work on interledger and other cool tech in the blockchain and interoperability space for @kava-labs.