sudo su # make life easier for the next ~100 lines
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
# directories (without spaces to ease pain)
DIR_WORK=/home/${USER_IOV}/galaxynet
IOVNS=https://github.com/iov-one/iovns/releases/download/v0.9.7/iovns-0.9.7-linux-amd64.tar.gz
chgrp ${USER_IOV} 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
After=network-online.target
User=$(id ${USER_IOV} -u -n)
Group=$(id ${USER_IOV} -g -n)
EnvironmentFile=/etc/systemd/system/starname.env
ExecStart=${DIR_IOVNS}/iovnsd.sh
WantedBy=multi-user.target
# download gitian built binaries; iovnsd is the IOV Name Service daemon
mkdir -p ${DIR_IOVNS} && cd ${DIR_IOVNS}
wget ${IOVNS} && sha256sum $(basename ${IOVNS}) | grep b06575a0254ad1dceeabdb56de09cca0451173d57d3de43f060ff8be67fdf053 && tar xvf $(basename ${IOVNS}) || echo 'BAD BINARY!'
# create iovnsd.sh, a wrapper for iovnsd
cat <<__EOF_IOVNSD_SH__ > iovnsd.sh
exec $PWD/iovnsd start \\
--minimum-gas-prices='1.0uvoi' \\
--moniker='${MONIKER}' \\
--p2p.laddr='tcp://0.0.0.0:46656' \\
--rpc.laddr='tcp://127.0.0.1:46657' \\
chgrp ${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://rpc.cluster-galaxynet.iov.one/genesis | jq -r .result.genesis > config/genesis.json
sha256sum config/genesis.json | grep d41378b0d21dd4c3bc7e0e77325df4adc7d801d6c804879946a001361f24056d || echo 'BAD GENESIS FILE!'
journalctl -f -u starname.service & # watch the chain sync
systemctl start starname.service