A guide to deploy a fullnode on Hugnet

This document is a guide to deploying a fullnode on Digital Ocean, which is a low cost route to running a node and getting the experience.

Note this document assumes you have a Digital Ocean account.

Creating a Droplet

This step is to create the environment to run the fullnode.

Once you have logged in and gone to the your project section from there you are ready to create a new Droplet.

  • Create a new Droplet using the Docker template in the One-click apps tab (Docker 18.x, Ubuntu 18.04)
  • 4GB with 2 CPU
  • Select a Data Centre closest to your location.
  • Add your ssh keys
  • Give the new Droplet a nice name

Wait for the Droplet to boot up and ssh into the shell on your new droplet (`ssh root@<ip from web ui>`)

Prepare the Docker containers

To prepare the Docker containers needed to run Tendermint and Bcpd type the following commands:

TM_IMAGE=iov1/tendermint:v0.29.1
BCPD_IMAGE=iov1/bcpd:v0.11.2
docker pull $TM_IMAGE
docker pull $BCPD_IMAGE
docker images

Get the hugnet configuration

Test the configuration

curl https://discovery-bov.hugnet.iov.one | jq

This will return something like the following.

{“data”:[{“ip”:”35.195.171.69",”port”:26656,”node_id_url”:”https://bov-fullnode-0.hugnet.iov.one/node_id"},{"ip":"35.241.136.128","port":26656,"node_id_url":"https://bov-fullnode-1.hugnet.iov.one/node_id"}]}

The next step is to put the configuration into some useful variables:

BOV_IP=$(curl -s https://discovery-bov.hugnet.iov.one | jq -r .data[0].ip)
BOV_PORT=$(curl -s https://discovery-bov.hugnet.iov.one | jq .data[0].port)
BOV_NODE_ID_URL=$(curl -s https://discovery-bov.hugnet.iov.one | jq -r .data[0].node_id_url)
BOV_NODE_ID=$(curl -s $BOV_NODE_ID_URL)
echo $BOV_IP
echo $BOV_NODE_ID

Make a storage directory and download the genesis file:

mkdir -p hugnet/config
cd hugnet
curl --fail https://bov.hugnet.iov.one/genesis | jq '.result.genesis' > config/genesis.json
less config/genesis.json

Start the fullnode

First, begin the tendermint daemon, which connects to the network and collects blocks:

# init
docker run --rm -v $(pwd):/tendermint ${TM_IMAGE} init
# start node
docker run -d --rm -p26657:26657 -v $(pwd):/tendermint ${TM_IMAGE} node --p2p.seeds=”${BOV_NODE_ID}@${BOV_IP}:${BOV_PORT}” --moniker=”local” --proxy_app=”unix:///tendermint/app.sock”

Then start the bcpd application, which processes the blocks and runs the transactions:

# init
docker run --rm -v $(pwd):/tendermint ${BCPD_IMAGE} -home=/tendermint init -i
# start
docker run -d --rm -v $(pwd):/tendermint ${BCPD_IMAGE} -home=/data/bov start -bind=”unix:///tendermint/app.sock”

Check it is running

Key in these commands to check that it is all up and running

docker ps
BCP_CONTAINER=$(docker ps | grep bcpd | cut -c-12)
docker logs ${BCP_CONTAINER} | tail
curl http://localhost:26657/status
curl -s http://localhost:26657/status | jq .result.sync_info

Stopping Docker Processes

To check which Docker instances are running enter the following command

docker ps

The output in the console shows the processes running.

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8582b2b205f0 iov1/bcpd:v0.11.1 “/bcpd -home=/data/b…” 11 minutes ago Up 11 minutes epic_varahamihira
d614a0e41785 iov1/tendermint:v0.29.1 “tendermint node — m…” 17 minutes ago Up 17 minutes 26656/tcp, 0.0.0.0:26657->26657/tcp boring_swanson

To stop the tasks then key in docker stop <container id>

docker stop 8582b2b205f0

What’s next?

As you have seen you configure and run a set of commands and scripts to get everything up and running, the next task is to write a script to run as background process as everything will stop running once you log out.