Setting up a fullnode for Juno testnet [lucina]

Cat Boss
5 min readAug 24, 2021

--

Hello Cat Boss here! Today we’ll be going through a quick tutorial on how to set up a working full node for Juno testnet.

We will cover post genesis setup for their current testnet lucina.
Official documentation from Juno team can be found here: https://docs.junochain.com/validators/joining-the-testnets#joining-as-a-validator

Create a server

First we will setup the server. We’ll be using the minimum required setup which is Ubuntu 18.04LTS with 2GB RAM / 1 CPUs/ 50GB storage.

Remotely ssh into the server using the CLI and create a new user

As mentioned in our previous article, we recommend creating new user and switching to it from root user. To do this, login in to the server using cli:

ssh root@your-server-ip 

Run this to create new user and give it a sudo role:

adduser <username>
usermod -aG sudo <username>

We can test it by switching to this user and running a sudo command:

su - <username>
sudo ls -la /root

The output should look similar to this:

Now, we can exit root ssh and login with user we’ve just created

ssh username@your-server-ip

General environment setup

Next step is to prepare our environment by updating / upgrading the system and installing the libraries needed to install the juno binary.

# Update the system
sudo apt-get update
sudo apt-get upgrade
# Install git, gcc and make
sudo apt-get install make build-essential gcc git ufw curl git-lfs jq -yqq
git lfs install --skip-repo# Install Go with Snap
sudo snap install go --classic
# Export environment variables
echo 'export GOPATH="$HOME/go"' >> ~/.profile
echo 'export GOBIN="$GOPATH/bin"' >> ~/.profile
echo 'export PATH="$GOBIN:$PATH"' >> ~/.profile
echo 'export GO111MODULE=on' >> ~/.profile
source ~/.profile

To verify go is installed correctly run:

go version

It should return go version, the output should look similar to this:

go version go1.16.6 linux/amd64

Install junod

cd $HOME
git clone https://github.com/CosmosContracts/Juno.git
cd Juno
git fetch -a
git checkout lucina
make install

To verify you successfully installed junod run:

junod version --long

It should return output like this:

name: juno
server_name: junod
version: HEAD-41e53a7972bf9472ad3cc551b468268e087f95ae
commit: 41e53a7972bf9472ad3cc551b468268e087f95ae
build_tags: netgo,ledger
go: go version go1.16.6 linux/amd64
build_deps:
- github.com/99designs/keyring@v1.1.6
- github.com/ChainSafe/go-schnorrkel@v0.0.0-20200405005733-88cbf1b4c40d
- github.com/CosmWasm/wasmd@v0.16.0
- github.com/CosmWasm/wasmvm@v0.14.0
- github.com/Workiva/go-datastructures@v1.0.52
- github.com/armon/go-metrics@v0.3.8
- github.com/beorn7/perks@v1.0.1
- github.com/bgentry/speakeasy@v0.1.0
- github.com/btcsuite/btcd@v0.21.0-beta
- github.com/cespare/xxhash/v2@v2.1.1
- github.com/confio/ics23/go@v0.6.6
- github.com/cosmos/cosmos-sdk@v0.42.5
- github.com/cosmos/go-bip39@v1.0.0
- github.com/cosmos/iavl@v0.16.0
- github.com/cosmos/ledger-cosmos-go@v0.11.1
- github.com/cosmos/ledger-go@v0.9.2
- github.com/davecgh/go-spew@v1.1.1
- github.com/dvsekhvalnov/jose2go@v0.0.0-20200901110807-248326c1351b
- github.com/enigmampc/btcutil@v1.0.3-0.20200723161021-e2fb6adb2a25
- github.com/felixge/httpsnoop@v1.0.1
- github.com/fsnotify/fsnotify@v1.4.9
- github.com/go-kit/kit@v0.10.0
- github.com/go-logfmt/logfmt@v0.5.0
- github.com/godbus/dbus@v0.0.0-20190726142602-4481cbc300e2
- github.com/gogo/gateway@v1.1.0
- github.com/gogo/protobuf@v1.3.3 => github.com/regen-network/protobuf@v1.3.3-alpha.regen.1
- github.com/golang/protobuf@v1.5.2
- github.com/golang/snappy@v0.0.3-0.20201103224600-674baa8c7fc3
- github.com/google/btree@v1.0.0
- github.com/google/gofuzz@v1.2.0
- github.com/google/orderedcode@v0.0.1
- github.com/gorilla/handlers@v1.5.1
- github.com/gorilla/mux@v1.8.0
- github.com/gorilla/websocket@v1.4.2
- github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0
- github.com/grpc-ecosystem/grpc-gateway@v1.16.0
- github.com/gsterjov/go-libsecret@v0.0.0-20161001094733-a6f4afe4910c
- github.com/gtank/merlin@v0.1.1
- github.com/gtank/ristretto255@v0.1.2
- github.com/hashicorp/go-immutable-radix@v1.0.0
- github.com/hashicorp/golang-lru@v0.5.4
- github.com/hashicorp/hcl@v1.0.0
- github.com/libp2p/go-buffer-pool@v0.0.2
- github.com/magiconair/properties@v1.8.5
- github.com/mattn/go-isatty@v0.0.12
- github.com/matttproud/golang_protobuf_extensions@v1.0.1
- github.com/mimoo/StrobeGo@v0.0.0-20181016162300-f8f6d4d2b643
- github.com/minio/highwayhash@v1.0.1
- github.com/mitchellh/go-homedir@v1.1.0
- github.com/mitchellh/mapstructure@v1.3.3
- github.com/mtibben/percent@v0.2.1
- github.com/pelletier/go-toml@v1.8.1
- github.com/pkg/errors@v0.9.1
- github.com/pmezard/go-difflib@v1.0.0
- github.com/prometheus/client_golang@v1.10.0
- github.com/prometheus/client_model@v0.2.0
- github.com/prometheus/common@v0.23.0
- github.com/prometheus/procfs@v0.6.0
- github.com/rakyll/statik@v0.1.7
- github.com/rcrowley/go-metrics@v0.0.0-20200313005456-10cdbea86bc0
- github.com/regen-network/cosmos-proto@v0.3.1
- github.com/rs/cors@v1.7.0
- github.com/rs/zerolog@v1.21.0
- github.com/spf13/afero@v1.3.4
- github.com/spf13/cast@v1.3.1
- github.com/spf13/cobra@v1.1.3
- github.com/spf13/jwalterweatherman@v1.1.0
- github.com/spf13/pflag@v1.0.5
- github.com/spf13/viper@v1.7.1
- github.com/stretchr/testify@v1.7.0
- github.com/subosito/gotenv@v1.2.0
- github.com/syndtr/goleveldb@v1.0.1-0.20200815110645-5c35d600f0ca
- github.com/tendermint/btcd@v0.1.1
- github.com/tendermint/crypto@v0.0.0-20191022145703-50d29ede1e15
- github.com/tendermint/go-amino@v0.16.0
- github.com/tendermint/spm@v0.0.0-20210524110815-6d7452d2dc4a
- github.com/tendermint/tendermint@v0.34.10
- github.com/tendermint/tm-db@v0.6.4
- github.com/zondax/hid@v0.9.0
- golang.org/x/crypto@v0.0.0-20201221181555-eec23a3978ad
- golang.org/x/net@v0.0.0-20210316092652-d523dce5a7f4
- golang.org/x/sys@v0.0.0-20210510120138-977fb7262007
- golang.org/x/term@v0.0.0-20201126162022-7de9c90e9dd1
- golang.org/x/text@v0.3.5
- google.golang.org/genproto@v0.0.0-20210426193834-eac7f76ac494
- google.golang.org/grpc@v1.37.0 => google.golang.org/grpc@v1.33.2
- google.golang.org/protobuf@v1.26.0
- gopkg.in/ini.v1@v1.61.0
- gopkg.in/yaml.v2@v2.4.0
- gopkg.in/yaml.v3@v3.0.0-20210107192922-496545a6307b

To initialise juno working directory we will run the following:

junod init <moniker-name> --chain-id=lucina

This will generate genesis.json , node_key.json , and priv_validator_key.json files in ~/.juno/config/ .

Download the genesis file

curl https://raw.githubusercontent.com/CosmosContracts/testnets/main/lucina/genesis.json > ~/.juno/config/genesis.json

This will replace the genesis file created using junod init command with the genesis file currently being used in lucina testnet.

Edit config.toml

Next we need to update peers in config.toml file, let’s run the following to open the file:

nano ~/.juno/config/config.toml

Findpersistent-peers and update the field with the details:

# Comma separated list of nodes to keep persistent connections to
persistent_peers = "1c667727dec684af1d985072b11652ca47dd2ff0@172.16.2.61:26656,2e2628319f50a61e979cb1a86234351f93aff62c@172.31.44.248:26656,3a46840ad6ef9f014fb8157409eef6808806c861@74.207.254.130:26656,83e15c0440bc9a2e74c7deb28f2c7a1b2c4142e9@172.26.10.55:26656,ec730773944fbdc6a8c4918984f571aa57c975a3@192.168.1.199:26656,ed292d66c239f3b86f19cbb1d7c6c125464b87d0@66.42.91.67:26656,ff68dc9f1808d9d497a769719cecd2785e093776@207.244.245.6:26656,6ec2b1b9f0c279875de1b493278e1c54d2de98f5@104.236.76.128:26656,74667752912bb51325492682ab97bbff8edb7101@165.232.134.27:26656,1adfaa31f3ea8dba735771645fb2f5aba406431c@80.240.18.187:26656"

Now let’s save current chain-id as lucina in our config so we don’t need to pass —-chain-idflag every time we send tx.

cd $HOME
junod config chain-id lucina

Setup Cosmovisor (optional)

In order to do automatic on-chain upgrades we will be using cosmovisor. Setting it up is optional but highly recommended by Cats. You can read more about it here: https://docs.cosmos.network/master/run-node/cosmovisor.html

  1. Download Cosmovisor binary
cd $HOME
go get github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor

Check if cosmovisor has been installed correctly:

which cosmovisor

It should return something like this

/home/<your-user>/go/bin/cosmovisor

2. Set up the environment variables

cd $HOME
echo "# Setup Cosmovisor" >> ~/.profile
echo "export DAEMON_NAME=junod" >> ~/.profile
echo "export DAEMON_HOME=$HOME/.juno" >> ~/.profile
source ~/.profile

Verify by running the following, it should return junod:

echo $DAEMON_NAME

Set up folder structure

mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin
mkdir -p $DAEMON_HOME/cosmovisor/upgrades
cp $(which junod) $DAEMON_HOME/cosmovisor/genesis/bin

Verify by running

cosmovisor version

3. Open 26656 port to allow other nodes to connect to you as a peer

Opening port 26656 is beneficial for the entire network. To do this, run:

# running this should show it is inactive
sudo ufw status
# Turn on ssh if you need it
sudo ufw allow ssh
# Accept connections to port 26656 from any address
sudo ufw allow from any to any port 26656 proto tcp
# enable ufw
sudo ufw enable
# check ufw is running
sudo ufw status

4. Start the node (test run)

Alright after everything is setup and ready to go we can finally start our node. Run the command:

cosmovisor start

Give it a few minutes to process the genesis file and if you can’t see any errors on the screen, stop the node by pressing Ctrl + C. We are going to setup the background service now.

5. Set up cosmovisor as background service

This will allow the node to run in the background and restart automatically.

sudo tee /etc/systemd/system/cosmovisor.service > /dev/null <<EOF  
[Unit]
Description=Juno Daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which cosmovisor) start
Restart=always
RestartSec=3
LimitNOFILE=4096
Environment="DAEMON_HOME=$HOME/.juno"
Environment="DAEMON_NAME=junod"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
[Install]
WantedBy=multi-user.target
EOF

Update and start

sudo -S systemctl daemon-reload
sudo -S systemctl enable cosmovisor
sudo -S systemctl start cosmovisor

Check the status

sudo service cosmovisor status

Check the logs

sudo journalctl -u cosmovisor -f

6. Check if your node has been synced up

To check if your node has synced to the latest height, run this command :

cosmovisor status 2>&1 | jq "{catching_up: .SyncInfo.catching_up}"

If the returned output is true then your node is still syncing, if false then you are all synced up.

Conclusion

Congrats, you’ve made it! You have officially created a full node for lucina testnet. Now that wasn’t too hard, was it?
Look out for more tutorials coming out soon. including turning a full node into validator node for juno lucinatestnet.
Let’s stay in touch! Meow!

ヾ(=`ω´=)ノ”

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Cat Boss
Cat Boss

Written by Cat Boss

We’re dPoS validators and we like writing medium posts documenting our journey, sharing tips we learn along the way. Trust me, I am a Cat.

No responses yet

Write a response