Join The Testnet

Setup A Testnet Validator Node

Familiarize yourself with Gitian

Downloading and running a binary makes most sane people nervous. Gitian introduces a level of trust for binary artifacts and is the distribution method chosen by IOV and other blockchains including Bitcoin and Cosmos. We'll use binaries built using gitian and systemd to drive the IOV Name Service blockchain.

Use systemd for running a sentry node or validator

This document is not for beginners. It assumes that you know how to setup a sentry node architecture for Tendermint nodes. It also assumes that basename, curl, grep, jq, sed, sha256sum, and wget are installed on your system, and user $USER_IOV exists.

Given that, you should be able to copy-and-paste the following commands into a terminal and end up with a running node. It has been tested on Centos8, Ubuntu 19, and Fedora 31. You'll have to do this procedure on at least two machines to implement a sentry node architecture.

sudo su # make life easier for the next ~100 lines
cd /etc/systemd/system
export USER_IOV=iov # "iov" is not recommended
export SIGNER=dave # signer for the create-validator tx
# create an environment file for the IOV Name Service services
cat <<__EOF_IOVNS_ENV__ > starname.env
# operator variables
# directories (without spaces to ease pain)
# artifacts
chgrp ${USER_IOV} starname.env
chmod g+r starname.env
set -o allexport ; source /etc/systemd/system/starname.env ; set +o allexport # pick-up env vars
# create starname.service
cat <<__EOF_STARNAME_SERVICE__ > starname.service
Description=IOV Name Service
User=$(id ${USER_IOV} -u -n)
Group=$(id ${USER_IOV} -g -n)
systemctl daemon-reload
# download gitian built binaries; iovnsd is the IOV Name Service daemon
mkdir -p ${DIR_IOVNS} && cd ${DIR_IOVNS}
wget ${IOVNS} && sha256sum $(basename ${IOVNS}) | grep f596e7561143bf482ea7a7bc799452ded2f446800fd79f807951122b20563382 && tar xvf $(basename ${IOVNS}) || echo 'BAD BINARY!'
# create, a wrapper for iovnsd
cat <<__EOF_IOVNSD_SH__ >
exec $PWD/iovnsd start \\
--home=${DIR_WORK} \\
--minimum-gas-prices='1.0uvoi' \\
--moniker='${MONIKER}' \\
--p2p.laddr='tcp://' \\
--p2p.persistent_peers='c0a71edc987eb78b8c7b99b9963c6429bc9c8f1e@' \\
--rpc.laddr='tcp://' \\
--rpc.unsafe=true \\
chgrp ${USER_IOV}
chmod a+x
# initialize the IOV Name Service
su - ${USER_IOV}
set -o allexport ; source /etc/systemd/system/starname.env ; set +o allexport # pick-up env vars
rm -rf ${DIR_WORK} && mkdir -p ${DIR_WORK} && cd ${DIR_WORK}
# initialize IOV Name Service (iovnsd)
${DIR_IOVNS}/iovnsd init ${MONIKER} --chain-id ${CHAIN_ID} --home ${DIR_WORK} 2>&1 | jq -r .chain_id
curl --fail | jq -r .result.genesis > config/genesis.json
sha256sum config/genesis.json | grep cff2bbe4f7c9ccc3900bf5879153e1622cd383609eca9d086147fc9c08078b83 || echo 'BAD GENESIS FILE!'
exit # ${USER_IOV}
journalctl -f -u starname.service & # watch the chain sync
systemctl start starname.service
exit # root

At this point you're running a full-node that can be examined at http://localhost:46657/status. Repeat the above procedure on as many sentry nodes as you have and once more on your validator node.

Point the nodes at each other

Now that you have sentry node(s) and a validator, they need to be made aware of their role and pointed at each other.

Sentry node configuration

In the most rudimentary form, a sentry node is meant to gossip with other nodes but keep its associated validator hidden. Change ${DIR_IOVNS}/ so that the node gossips while keeping its validator hidden. Be mindful of --rpc.unsafe true below, you might not want that. On the validator node, execute curl -s http://localhost:46657/status | jq -r to get the value for VALIDATOR_ID.

exec "$PWD/iovnsd start \
--moniker='sentry' \
--p2p.laddr='tcp://' \
--p2p.persistent_peers='c0a71edc987eb78b8c7b99b9963c6429bc9c8f1e@' \
--rpc.laddr='tcp://' \
--rpc.unsafe=true \

There are a lot more tendermint configuration options available than those shown above. Customize them as you see fit and then execute sudo systemctl restart starname.service.

Validator configuration

As mentioned, it's ${DIR_IOVNS}/ that determines whether the node will act as a sentry or validator based on p2p.* options and priv_validator_laddr if you're using an HSM. Change ${DIR_IOVNS}/ so that the node gossips with its sentry node(s) only, ie set p2p.pex=false and add an explicit list of p2p.persistent_peers. Obtain the sentry node ids for p2p.persistent_peers by executing curl -s http://localhost:46657/status | jq -r on each sentry node. You know the IP and PORT of the nodes, so include them appropriately.

exec "$PWD/iovnsd start \
--moniker='validator' \
--priv_validator_laddr='tcp://HSM_IP:HSM_PORT' \
--p2p.pex='false' \
--rpc.unsafe='false' \

Execute sudo systemctl restart starname.service.

Hardware Security Module (HSM) configuration

The IOV Name Service is based on tendermint v0.33.x, which requires tmkms v0.8.0-rc0 or better.

Update your tmkms.toml file after you customize ADDR_VALIDATOR, FILE_SECRET and FILE_TMKMS in the following script:

sudo su # make life easier for the next 20 lines
export ADDR_VALIDATOR="tcp://" # or addr = "unix:///path/to/socket"
export FILE_SECRET=/path/to/kms-identity.key
export FILE_TMKMS=/path/to/tmkms.toml
set -o allexport ; source /etc/systemd/system/starname.env ; set +o allexport # pick-up env vars
grep ${CHAIN_ID} ${FILE_TMKMS} || { cat <<__EOF_TMKMS_UPDATE__ >> ${FILE_TMKMS}
id = "${CHAIN_ID}"
key_format = { type = "bech32", account_key_prefix = "starpub", consensus_key_prefix = "starvalconspub" }
state_file = "${DIR_WORK}/data/priv_validator_state.json"
# state_hook = { cmd = ["/path/to/block/height_script", "--example-arg", "starname network"] }
addr = "${ADDR_VALIDATOR}"
chain_id = "${CHAIN_ID}"
secret_key = "${FILE_SECRET}"
protocol_version = "v0.33"
sed --in-place "s/\(chain_ids.*\)\"/\\1\", \"${CHAIN_ID}\"/" ${FILE_TMKMS}
systemctl restart tmkms.service
exit # root

Light-up the validator

Once your sentry nodes and validator are sync'ed then the final step to becoming a validator is to execute the create-validator command just like for any Cosmos-based chain. Get some tokens from our faucet with `curl${SIGNER}`. The testnet's token is denominated in uvoi, so your create validator command will look something like

set -o allexport ; source /etc/systemd/system/starname.env ; set +o allexport # pick-up env vars
iovnscli tx staking create-validator \
--moniker "${MONIKER}" \
--amount 100000000uvoi \
--commission-max-change-rate 0.01 \
--commission-max-rate 0.2 \
--commission-rate 0.1 \
--min-self-delegation 1 \
--from ${SIGNER} \
--pubkey $(iovnsd tendermint show-validator --home ${DIR_WORK}) \
--gas-prices 1.0uvoi \
--node \
--chain-id ${CHAIN_ID}

Happy validating!