Guide to Joining The Kava Testnet

Kevin Davis
6 min readJun 25, 2019

--

Edit — Updated to reflect the upgrade to Kava testnet 1.1

This article will provide a step-by-step tutorial for setting up a server and getting started as a validator on the Kava testnet. You can view the code and see the latest release at our GitHub. If you’ve done this a few times before, the instructions on GitHub should be sufficient.

Getting Started 🌱

First off, you’ll need to setup a server. Having a dedicated server helps ensure that your validator is highly available and doesn’t go offline. Kava uses Tendermint consensus, which selects a leader for each block. If your validator is offline when it gets chosen as a leader, consensus will take longer, and you could even get slashed!

For this guide, we’ll be using a server with the following specifications:

  • Ubuntu 18.04 OS
  • 2 CPUs
  • 4GB RAM
  • 24GB SSD
  • Allow incoming connections on ports 26656
  • Static IP address (Elastic IP for AWS, floating IP for DigitalOcean, etc)

You can get a server with these specifications on most cloud service providers (AWS, DigitalOcean, Google Cloud Platform, Linode, etc).

After logging into your server, we’ll install security updates and the required packages to run Kava:

# Updates ubuntu
sudo apt update
sudo apt upgrade -y
# Installs packages necessary to run go
sudo apt install build-essential -y
# Installs go
wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
sudo tar -xvf go1.12.5.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.12.5 linux/amd64

Install the Kava daemon 🛠

Next, we’ll install the software needed to run the Kava blockchain. First, create your own fork so that you can submit a genesis transaction pull request if necessary. Head over to GitHub and click “Fork.”

git clone git@github.com:<YOUR-USERNAME>/kava.git
cd kava
# install executables
make install

Now, we’ll setup the kvd software to run the current Kava testnet:

# Replace <your-moniker> with the publicly viewable name for your validator.
# kava-testnet-1.1 is the name of the current testnet
kvd init --chain-id kava-testnet-1.1 <your-moniker>

Note: kvd init sets the node-id of your validator. You can see this value by doing kvd tendermint show-node-id. The node-id value will become part of your genesis transaction, so if you are planning on submitting a genesis transaction, don’t reset your node-id by uninstalling kvd or changing your public IP address.

# Create a wallet for your node. <your-wallet-name> is just a human readable name you can use to remember your wallet. It can be the same or different than your moniker.kvcli keys add <your_wallet_name>

This will spit out your recovery mnemonic. Be sure to back up your mnemonic before proceeding to the next step!

Submit a genesis transaction 🧬

If you are planning on participating in the genesis of the Kava testnet, you can follow along here and create a genesis transaction that you can submit as a pull request before launch. Otherwise, skip to the section about obtaining some coins from the faucet. If you are participating in genesis, it is expected that your validator will be up and available at all times during the testnet. If you can’t commit to this, we recommend joining via the faucet after the testnet is live.

# Create an account in genesis with 1000000000000 kva tokens. Don't change the amount of kva tokens so that we can have equal distribution among genesis participants.kvd add-genesis-account $(kvcli keys show <your_wallet_name> -a) 1000000000000ukva# Sign a gentx that creates a validator in the genesis file for your account. Note to pass your public ip to the --ip flag.kvd gentx --name <your_wallet_name> --amount 1000000000000ukva --ip <your-public-ip>

This will write your genesis transaction to $HOME/.kvd/config/gentx/gentx-<gen-tx-hash>.json. This should be the only file in your gentx directory. If you have more than one, delete them and repeat the gentx command above.

Now we will submit the transaction as a PR to be included in the genesis block:

# create a branch for your pr submission
git checkout -b genesis-<your-moniker>
# check that there's only one gentx
ls $HOME/.kvd/config/gentx
# copy the genesis transaction you created to the kava repo
cp $HOME/.kvd/config/gentx/* testnet-1.1/gentx/.
# Add and commit your changes
git add testnet-1.1/gentx/*
git commit -m "feat: gentx for <your-moniker>"# Push your branch to the remote repositor
git push -u origin genesis-<your-moniker>

Now go to Kava’s GitHub repo and select “New Pull Request.”

Create a pull request for <github-username>/kava:genesis-<your-moniker> against the master branch of the Kava repo.

We’ll make sure to promptly review your PR, let you know if there are any issues, and merge it in!

Please note that all genesis transactions must be submitted by July 4, 2019 at 23:00 UTC. If you don’t submit a genesis transaction, don’t worry! After the testnet is launched, we’ll make a faucet available to easily request testnet tokens.

Launching the testnet 🚀

On July 4, 2019 at 23:00 UTC, Kava will release the proposed genesis block. We well create a release tagged v0.1.1-preview that contains the proposed genesis. All validators are invited to review the included transactions, agree on the final genesis block.

When the genesis is agreed upon, we will create a release tagged v0.1.1. Validators can download the genesis file from that release and start validating July 5, 2019 at 23:00 UTC.

To start validating the testnet after the genesis has been released, run the following commands:

# Copy the genesis file to the kvd directory
wget https://raw.githubusercontent.com/Kava-Labs/kava/master/testnet-1.1/genesis.json -P ~/.kvd/config
# Create log files for kvd
sudo mkdir -p /var/log/kvd && sudo touch /var/log/kvd/kvd.log && sudo touch /var/log/kvd/kvd_error.log
# create a systemd file to run the kvd daemon
# replace <your_user> where necessary
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
StandardOutput=file:/var/log/kvd/kvd.log
StandardError=file:/var/log/kvd/kvd_error.log
Restart=always
RestartSec=3
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target
EOF
# Start the node
sudo systemctl enable kvd
sudo systemctl start kvd

To check on the status of the node

kvcli status
sudo journalctl -u kvd -f

To view the logs

# Standard output of kvd
tail -f /var/log/kvd/kvd.log
# Standard error of kvd
tail -f /var/log/kvd/kvd_error.log

After the Kava blockchain reaches a quorum, the testnet will be officially launched! If a quorum is not reached promptly, we will coordinate further communication through the Kava validator Riot chat.

Joining the Testnet Via Facuet

To join the Kava testnet after launch, you can use our faucet. To install the testnet software, follow this guide up to the section titled ’Submitting a genesis transaction’.

To start your node:

# Copy the genesis file to the kvd directory
wget https://raw.githubusercontent.com/Kava-Labs/kava/master/testnet-1.1/genesis.json -P ~/.kvd/config
# Create log files for kvd
sudo mkdir -p /var/log/kvd && sudo touch /var/log/kvd/kvd.log && sudo touch /var/log/kvd/kvd_error.log
# create a systemd file to run the kvd daemon
# Be sure to replace <your_user> where necessary
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
StandardOutput=file:/var/log/kvd/kvd.log
StandardError=file:/var/log/kvd/kvd_error.log
Restart=always
RestartSec=3
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target
EOF
# Start the node
sudo systemctl enable kvd
sudo systemctl start kvd
# Wait until the status shows that catching_up = false
# Syncing the chain may take a few minutes.
kvcli status

To get testnet coins:

# Get the address of your wallet
kvcli keys show -a <your_wallet_name>
# Go to the faucet and paste your address in# Confirm that your account is funded
kvcli q account $(kvcli keys show -a <your_wallet_name>)

To create a validator:

# Set your node to wait for transactions to confirm
kvcli config broadcast-mode block
# Create the validator
# Be sure to replace <your-wallet-name> and <your-moniker>
kvcli tx staking create-validator --amount 10000000000ukva --commission-max-change-rate 0.01 --commission-max-rate 0.2 --commission-rate 0.1 --from <your-wallet-name> —-min-self-delegation 1 --moniker <your-moniker> —-pubkey $(kvd tendermint show-validator)# Confirm that you have voting power (look at the last value in the output. It should show voting power > 0)
kvcli status

Congrats, you’ve joined the Kava testnet!

--

--

Kevin Davis

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