The basics: Validators are special full-nodes that participate in the consensus process. If you want to read more about the various types of nodes within Tendermint, you will find a nice write-up in the Tendermint Core documentation.
Cosmos Code With Us — Setting Up a Cosmos Validator is another great starting point, where Marko Baricevic walks you through the process of running a (Cosmos) validator and reveals quite important ideas! Though the video is from 2020, it is still very relevant if you are starting out. Thank you, Marko, for this great walk through! Let’s get started.
TOC
— Server
— Environmental setup
— Initialize
— app.toml | config.toml configuration
— syncing status…
Documentation
You will find the official documentation from the Evmos here.
Evmos is built using Go version 1.17+.
Server
Start with a Virtual Private Server (VPS). This VPS from contabo —VPS M / 400 GB SSD — should be quite nice. We’ll be using Ubuntu 20.04LTS.
1. Make sure to understand ‘How to use VNC to connect to your VPS’.
2. Enable SSH on Ubuntu and ssh into the machine.
If you’re logging in using root, we highly recommend creating and switching to another user because “It defeats the security model that’s been in place for years. Applications are meant to be run with non-administrative security…”. Read more here.
Add non-administrative user:
adduser <username>
usermod -aG sudo <username>
su <username>
Follow this article if you are unfamiliar with how to Enable SSH on Ubuntu
sudo ufw allow ssh
sudo ufw status
sudo systemctl status ssh
#logout
#ssh into the machine
ssh jovyan@161.97.176.35
Environmental setup
We are going to install necessary libraries as well as to update the system.
#core system update
sudo apt upgrade --yes
sudo apt update --yes
#install build-essential
sudo apt install --yes git build-essential curl jq snapd net-tools#install go - https://dl.google.com/
#SHA256 checksum
#550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c
cd $HOME
wget https://dl.google.com/go/go1.17.3.linux-amd64.tar.gz
sha256sum go1.17.3.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.17.3.linux-amd64.tar.gz# Export environment variables
cat <<’EOF’ >>$HOME/.profile
export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$PATH
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export PATH=$PATH:/usr/local/go/bin
EOF
source ~/.profile
Verify that go is installed on the system
go version
go env
Opening up | ports
It is beneficial to the whole network if you open port 26656.
This would allow other nodes to connect to your node as a peer.
For this reason, we will be opening port 26656 using ufw.
# running ufw status should show port 26656 is inactive
sudo ufw status
# Accept any incomming connections to port 26656
sudo ufw allow from any to any port 26656 proto tcp
# ufw enable
sudo ufw enable
# check ufw
sudo ufw status
Install evmosd
Make sure that the evmosd
binaries have been successfully installed. If not, delete the directory $HOME/evmos
and start over again.
# Evmos
# https://evmos.dev/quickstart/installation.htmlgit clone https://github.com/tharsis/evmos.git
cd evmos
git checkout v0.1.3
make install#Check that the evmosd binaries have been successfully installed
#evmosd version --long
evmosd version
Initialize
Make sure to provide a <moniker>, your machine name.
With evmosd config --chain-id=”evmos_9000–1" we will set the default chain-id flag to evmos_9000–1.
We are going to initialize the Evmos working directory as well as to download the genesis file into the right working directory.
#Testnet --chain-id="evmos_9000-1"
evmosd init --chain-id="evmos_9000-1" <moniker> #download the genesis.json file
wget -qO $HOME/.evmosd/config/genesis.json "https://raw.githubusercontent.com/tharsis/testnets/main/arsia_mons/genesis.json"evmosd validate-genesis
This will generate genesis.json, node_key.json , and priv_validator_key.json files in the $HOME/.evmosd/config/ directory.
Now let’s see our node-id:
#show-node-id
evmosd tendermint show-node-id
Edit configuration files
app.toml
#update minimum gas price
sed -i.bak -E 's#^(minimum-gas-prices[[:space:]]+=[[:space:]]+).*$#\1"0aphoton"#' ~/.evmosd/config/app.toml
config.toml
Find up-to-date peers here:
The ‘batch’ of peers are changing quite often.
Make sure to get an up-to-date peer list.
#peers 11/10/21peers="0a24863bb4dd5eacdba8ef8a27f76a2da061b066@167.114.210.99:26656,aa7d97f4e45f3f13daa591b1508bacc1fb58ee71@35.238.207.229:26656,f8a3175eb76a805016f57b43b2c038aca6533896@161.97.120.217:26656,0c6752887741e0528048a4bacb8ee2c5db9b28c1@147.182.210.7:26656,6624238168de05893ca74c2b0270553189810aa7@95.216.100.80:26656,cb78e3c316ecfe7d539a86e730d37f2ab82d6c32@35.238.207.229:26656,fa7673a80fddf492a30e1200ea350973acdd7151@194.163.187.188:26656,512710f2856331ed6c6a319bd7f243a3f06cf34c@65.21.158.119:26656,f9892d55a5432ce803f3b7abf85673fca5bb9131@178.63.43.120:26656,c36cec90ded95d162b85f8ecd00ecd7c8849ca75@35.238.207.229:26656,00f882032b132481247e43276187ff99b8b8f138@217.79.189.33:26656,be3b57d55a171896d12693f4379b2239cd510181@23.88.100.176:26736,0d30a25685e18ca7f964e2d024bcd83a75258b89@81.30.157.64:26656,7cb1576a6ed3dbdc62bc30908ff7d7e910c5b08f@78.46.52.20:46656,1c4c38243893889a17fd3e677999f896b2b18586@95.217.35.111:26666,400fceb72ee2148c41f691618a1dd1c882c627fc@173.249.40.87:26656,ec5f0ec77fef87d6ef2bcf174f7d5b34cdfc45ba@95.217.187.120:26656,3bd90caf48ddd2d6b290550ecccd63348fc51da0@95.217.107.96:26658,360a2bb1885a4f591f9ea36e2c5ea761a5b2b9bc@134.209.248.210:26656,ebfb28f7174b9623bc9d18623957add1c06370e7@65.108.6.54:25656,a5f1852ada7237905b515dc9f3ad83756cdf5b18@202.61.204.123:26656,56de4d8fe7421f5a4fb6ba75b20d749be3eecf22@95.217.84.54:26656,78605eed3018a74d9c8c3a912cd8e6d5c9a9ca4b@65.21.232.149:26726,b4c65992274ce58f37efd825eef1a75ed1740213@185.182.9.92:26656,3e7b138c766dc6da32decca8665da1afb2b6bb88@207.244.249.17:26656"sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" ~/.evmosd/config/config.toml
Set your external_address
This helps the network to connect to the node. We have to find the IP address (IPv4) ip a
to set the external address.
#IPv4
IPv4=$(hostname -I | cut -d' ' -f1)sed -i.bak -e "s/^external_address *=.*/external_address = \"$IPv4:26656\"/" ~/.evmosd/config/config.toml
Start the node — Dry test run …
Before we can set up a background service — systemctl — let’s start the node for a check-up. If all is well, we can stop the node (ctrl + c) and set up a systemctl service. You will see some indexed blocks after a couple of minutes.
evmosd start
Background service
This will allow the node to run in the background and restart automatically.
sudo tee /etc/systemd/system/evmosd.service > /dev/null <<EOF
[Unit]
Description=evmosd daemon
After=network-online.target[Service]
User=$USER
ExecStart=/bin/bash -c '$HOME/go/bin/evmosd start'
Restart=always
RestartSec=3
LimitNOFILE=4096[Install]
WantedBy=multi-user.target
EOF
#systemctl daemon-reload
sudo -S systemctl daemon-reload
sudo -S systemctl enable evmosd
sudo -S systemctl start evmosd
#status
sudo service evmosd status
Logging
We are using journalctl to view systemd logs.
sudo journalctl -fu evmosd
#stop journalctl use ctrl + c
node is syncing up?
Now, we have to make sure, that the node is syncing with the network.
sync status (if the output is false then you are all synced up), else it is still syncing… hold on and wait.
Check that the latest block height is catching up from time to time.
evmosd status | jq "{latest_block_height: .SyncInfo.latest_block_height}"
If the sync has been successfully completed, you will see “ ‘catching_up’: false”.
evmosd status | jq "{catching_up: .SyncInfo.catching_up}"
Congratulations!
What we will do next on your write-up is converting this full-node into a validator node.