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.
sudosu# make life easier for the next ~100 linescd/etc/systemd/systemexport USER_IOV=iov # "iov" is not recommendedexport SIGNER=dave # signer for the create-validator tx# create an environment file for the IOV Name Service servicescat<<__EOF_IOVNS_ENV__>starname.env# operator variablesCHAIN_ID=iovns-galaxynetMONIKER=$(hostname)SIGNER=${SIGNER}USER_IOV=${USER_IOV}# directories (without spaces to ease pain)DIR_IOVNS=/opt/iovns/binDIR_WORK=/home/${USER_IOV}/galaxynet# artifactsIOVNS=https://github.com/iov-one/iovns/releases/download/v0.9.7/iovns-0.9.7-linux-amd64.tar.gz__EOF_IOVNS_ENV__chgrp ${USER_IOV} starname.envchmodg+rstarname.envset-oallexport ; source/etc/systemd/system/starname.env ; set+oallexport# pick-up env vars# create starname.servicecat<<__EOF_STARNAME_SERVICE__>starname.service[Unit]Description=IOV Name ServiceAfter=network-online.target#PartOf=iovnsapi.service[Service]Type=simpleUser=$(id ${USER_IOV} -u -n)Group=$(id ${USER_IOV} -g -n)EnvironmentFile=/etc/systemd/system/starname.envExecStart=${DIR_IOVNS}/iovnsd.shLimitNOFILE=4096#Restart=on-failure#RestartSec=3StandardError=journalStandardOutput=journalSyslogIdentifier=iovnsd[Install]WantedBy=multi-user.target__EOF_STARNAME_SERVICE__systemctldaemon-reload# download gitian built binaries; iovnsd is the IOV Name Service daemonmkdir-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 iovnsdcat<<__EOF_IOVNSD_SH__>iovnsd.sh#!/bin/bashexec $PWD/iovnsd start \\ --home=${DIR_WORK} \\ --minimum-gas-prices='1.0uvoi' \\ --moniker='${MONIKER}' \\ --p2p.laddr='tcp://0.0.0.0:46656' \\ --p2p.persistent_peers='b69d5878ef8997e749a499f14cb050c5de6bcedc@64.227.40.19:46656' \\ --rpc.laddr='tcp://127.0.0.1:46657' \\ --rpc.unsafe=true \\__EOF_IOVNSD_SH__chgrp ${USER_IOV} iovnsd.shchmoda+xiovnsd.sh# initialize the IOV Name Servicesu- ${USER_IOV}set-oallexport ; source/etc/systemd/system/starname.env ; set+oallexport# pick-up env varsrm-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_idcurl--failhttps://rpc.cluster-galaxynet.iov.one/genesis|jq-r.result.genesis>config/genesis.jsonsha256sum config/genesis.json | grep d41378b0d21dd4c3bc7e0e77325df4adc7d801d6c804879946a001361f24056d || echo 'BAD GENESIS FILE!'
exit# ${USER_IOV}journalctl-f-ustarname.service&# watch the chain syncsystemctlstartstarname.serviceexit# 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}/iovnsd.sh 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 .result.node_info.id to get the value for VALIDATOR_ID.
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}/iovnsd.sh 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}/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.idon each sentry node. You know the IP and PORT of the nodes, so include them appropriately.
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:
sudosu# make life easier for the next 20 linesexport ADDR_VALIDATOR="tcp://id@example1.example.com:46658"# or addr = "unix:///path/to/socket"export FILE_SECRET=/path/to/kms-identity.keyexport FILE_TMKMS=/path/to/tmkms.tomlset-oallexport ; source/etc/systemd/system/starname.env ; set+oallexport# pick-up env varsgrep ${CHAIN_ID} ${FILE_TMKMS} || { cat<<__EOF_TMKMS_UPDATE__>> ${FILE_TMKMS}[[chain]]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"] }[[validator]]addr = "${ADDR_VALIDATOR}"chain_id = "${CHAIN_ID}"secret_key = "${FILE_SECRET}"protocol_version = "v0.33"__EOF_TMKMS_UPDATE__sed--in-place"s/\(chain_ids.*\)\"/\\1\", \"${CHAIN_ID}\"/" ${FILE_TMKMS}systemctlrestarttmkms.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 https://faucet.cluster-galaxynet.iov.one/credit?address=${SIGNER}`. The testnet's token is denominated in uvoi, so your create validator command will look something like