sudo su # make life easier for the next ~60 lines
systemctl stop starname.service
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
# directories (without spaces to ease pain)
DIR_WORK=/home/${USER_IOV}/iov-mainnet-2
IOVNS=https://github.com/iov-one/iovns/releases/download/v0.9.1/iovns-0.9.1-linux-amd64.tar.gz
chgrp $(id -g ${USER_IOV}) starname.env
set -o allexport ; source /etc/systemd/system/starname.env ; set +o allexport # pick-up env vars
# create iovnsd.sh, a wrapper for iovnsd
cat <<__EOF_IOVNSD_SH__ > iovnsd.sh
exec $PWD/iovnsd start \\
--minimum-gas-prices='1.0uiov' \\
--moniker="${MONIKER}" \\
--p2p.laddr='tcp://0.0.0.0:46656' \\
--rpc.laddr='tcp://127.0.0.1:46657' \\
chgrp $(id -g ${USER_IOV}) iovnsd.sh
# initialize the IOV Name Service
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!'
journalctl -f -u starname.service & # watch the chain sync
systemctl start starname.service