Running Evmos Testnet with Cosmovisor

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

Considerations

This guide will be updated to explain how to configure Cosmovisor to automatically deploy an upgraded evmosd binary for you as soon as Cosmovisor detects the upgrade governance block. Until then, this section will be left incomplete.

Enjoy the moment! 🥩🥩🥩

artifact-staking.io is a high performance crypto currency validation company. We operate blockchain infrastructure to enable users to stake cryptocurrency.