Join The Mainnet

Update starname.env and iovnsd.sh

This document assumes that you are migrating your testnet nodes to mainnet nodes. Given that, the setup for the mainnet is basically identical to that for a testnet. The only difference between the two are entries in /etc/systemd/system/starname.env file and ${DIR_IOVNS}/iovnsd.sh, so let's re-create those files.

sudo su # make life easier for the next ~60 lines
systemctl stop starname.service
cd /etc/systemd/system
export USER_IOV=iov # "iov" is not recommended
export SIGNER=dave # signer for the gentx/create-validator
# overwrite the environment file for the IOV Name Service services
cat <<__EOF_IOVNS_ENV__ > starname.env
# operator variables
CHAIN_ID=iov-mainnet-2
MONIKER=$(hostname)
SIGNER=${SIGNER}
USER_IOV=${USER_IOV}
# directories (without spaces to ease pain)
DIR_IOVNS=/opt/iovns/bin
DIR_WORK=/home/iov/iov-mainnet-2
# artifacts
IOVNS=https://github.com/iov-one/iovns/releases/download/v0.9.1/iovns-0.9.1-linux-amd64.tar.gz
__EOF_IOVNS_ENV__
chgrp iov starname.env
chmod g+r starname.env
set -o allexport ; source /etc/systemd/system/starname.env ; set +o allexport # pick-up env vars
cd ${DIR_IOVNS}
# create iovnsd.sh, a wrapper for iovnsd
cat <<__EOF_IOVNSD_SH__ > iovnsd.sh
#!/bin/bash
exec $PWD/iovnsd start \\
--home=${DIR_WORK} \\
--minimum-gas-prices='1.0uiov' \\
--moniker="${MONIKER}" \\
--p2p.laddr='tcp://0.0.0.0:46656' \\
--p2p.seeds='c00e2f8ff7f521cc6385dcc4ad4c7053d9895e9e@167.99.194.126:46656' \\
--rpc.laddr='tcp://127.0.0.1:46657' \\
--rpc.unsafe=false \\
__EOF_IOVNSD_SH__
chgrp ${USER_IOV} iovnsd.sh
chmod a+x iovnsd.sh
# 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 https://gist.githubusercontent.com/davepuchyr/4fe7e002061c537ddb116fee7a2f8e47/raw/2ac02aea0e7ba2e0aab6cd00819a4d8d45c30f29/genesis.json > config/genesis.json
sha256sum config/genesis.json | grep 27898a4fb858ddee28202b6f8e8d0f4b608d9587f39529f7a18be331c5d7a4fc || echo 'BAD GENESIS FILE!'
exit # ${USER_IOV}
journalctl -f -u starname.service & # watch the chain sync
systemctl start starname.service
exit # root

Specialize the nodes

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

Change ${DIR_IOVNS}/iovnsd.sh so that each of your sentry nodes gossip while keeping their validator hidden. On the validator node, execute curl -s http://localhost:46657/status | jq -r .result.node_info.id to get the value for VALIDATOR_ID. Change the ${DIR_IOVNS}/iovnsd.sh to something like

#!/bin/bash
exec $PWD/iovnsd start \
--home=${DIR_WORK} \
--minimum-gas-prices='1.0uiov' \
--moniker='${MONIKER}' \
--p2p.laddr='tcp://0.0.0.0:46656' \
--p2p.pex=true \
--p2p.private_peer_ids='VALIDATOR_ID' \
--p2p.seeds='c00e2f8ff7f521cc6385dcc4ad4c7053d9895e9e@167.99.194.126:46656' \
--rpc.laddr='tcp://127.0.0.1:46657' \
--rpc.unsafe=false \

There are a lot more tendermint configuration options available than those shown above. Customize them as you see fit. When you're done customizing then execute sudo systemctl restart starname.service on each sentry node.

Validator configuration

Change ${DIR_IOVNS}/iovnsd.sh 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 .result.node_info.id on each sentry node. You know the IP and PORT of the nodes, so include them appropriately. Change the ${DIR_IOVNS}/iovnsd.sh file to something like

#!/bin/bash
exec $PWD/iovnsd start \
--home=${DIR_WORK} \
--minimum-gas-prices='1.0uiov' \
--moniker='${MONIKER}' \
--p2p.laddr='tcp://0.0.0.0:46656' \
--p2p.persistent_peers='SENTRY_ID0@SENTRY_IP0:SENTRY_PORT0,SENTRY_ID1@SENTRY_IP1:SENTRY_PORT1' \
--p2p.pex=false \
--priv_validator_laddr='tcp://HSM_IP:HSM_PORT' \
--rpc.laddr='tcp://127.0.0.1:46657' \
--rpc.unsafe=false \

Setup of the HSM is detailed here. When you're done customizing then execute sudo systemctl restart iovns.service.

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.

set -o allexport ; source /etc/systemd/system/starname.env ; set +o allexport # pick-up env vars
export PATH=${DIR_IOVNS}:$PATH
iovnscli tx staking create-validator \
--moniker "${MONIKER}" \
--amount 100000000uiov \
--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.0uiov \
--node https://rpc.iov-mainnet-2.iov.one:443 \
--chain-id ${CHAIN_ID}

Happy validating!