Running Evmos Testnet with Cosmovisor

Artifact Staking
3 min readOct 19, 2021

This is a quick a dirty guide for setting up Cosmovisor for the Evmos testnet.

中文翻译

Cosmovisor is a small process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals. If it sees a proposal that gets approved, cosmovisor can automatically download the new binary, stop the current binary, switch from the old binary to the new one, and finally restart the node with the new binary.

Install go

Download and install go. If you are already running Evmos testnet, you probably already have this installed so feel free to skip this section. It is here for completeness.

# Remove any existing go installation
sudo rm -rf /usr/local/go
# Install the latest version of Go with this helpful script
curl https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh | bash
# Update environment variables to include go
cat <<'EOF' >>$HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
#Housekeeping
source $HOME/.profile

Check the go version to make sure that it installed correctly. You may need to open a new shell for this to work. Go is a bit fickle on the install.

go version

Install Evmos

Download and install the evmosd binary. Again, you have probably already done this so feel free to skip ahead.

git clone https://github.com/tharsis/evmos.git
cd evmos
make install

Install Cosmovisor

Download and install Cosmos-SDK. At the time of this publication v0.44.2 is the newest stable version. For all of you future people that may be reading this, head on over to the GitHub page and look for the newest version and update the code below to match.

git clone https://github.com/cosmos/cosmos-sdk
cd cosmos-sdk
git checkout v0.44.2
make cosmovisor
cp cosmovisor/cosmovisor $GOPATH/bin/cosmovisor
cd $HOME

Build out the directory structure for Cosmovisor

mkdir -p ~/.evmosd
mkdir -p ~/.evmosd/cosmovisor
mkdir -p ~/.evmosd/cosmovisor/genesis
mkdir -p ~/.evmosd/cosmovisor/genesis/bin
mkdir -p ~/.evmosd/cosmovisor/upgrades

A little housekeeping

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

Copy the evmosd binary into the Cosmovisor directory

cp $GOPATH/bin/evmosd ~/.evmosd/cosmovisor/genesis/bin

Set up a Systemd service for Cosmovisor. Make sure you change <yourUserName>to whatever username you want to run this under.

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

Fire up the Cosmovisor service

sudo -S systemctl daemon-reload
sudo -S systemctl enable evmosd
sudo -S systemctl start evmosd
sudo -S systemctl status evmosd

Auto Upgrade Instructions

One of the main benefits of Cosmovisor is its ability to detect upgrade governance proposals and then automatically upgrade your validator binary on the upgrade block. Truly magical!

Evmos Olympus Mons v0.4.2 Upgrade

First, some directory maintenance. Keep in mind that the directory should be v0.4.1. There was a last minute upgrade to v0.4.2 but the directory needs to match what is in the upgrade proposal.

cd ~
mkdir ~/.evmosd/cosmovisor/upgrades/Olympus-Mons-v0.4.1
mkdir ~/.evmosd/cosmovisor/upgrades/Olympus-Mons-v0.4.1/bin
rm -R evmos

Download and compile Evmos Olympus Mons v0.4.2

git clone https://github.com/tharsis/evmos.git
cd evmos
git checkout v0.4.2
make install

Copy the v0.4.2 binary into the Cosmovisor upgrade folder

cp $GOPATH/bin/evmosd ~/.evmosd/cosmovisor/upgrades/Olympus-Mons-v0.4.1/bin

That is it! Just wait for the upgrade block to come. Once it does, Cosmovisor will detect the upgrade, stop your node, deploy the new binary, and then restart your node.

Enjoy the luxury of not having to stress out about the upgrade!!! 🥩🥩🥩

--

--

Artifact Staking

Artifact Staking is a cutting edge, forward leaning blockchain infrastructure provider.