# Automated Upgrades
Learn how to automate chain upgrades using Cosmovisor.
# Using Cosmovisor
cosmovisoris 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.
👉 For more info about Cosmovisor, please refer to the project official documentation here (opens new window).
We highly recommend validators use Cosmovisor to run their nodes. This will make low-downtime upgrades smoother, as validators don't have to manually upgrade binaries during the upgrade. Instead users can pre-install new binaries, and Cosmovisor will automatically update them based on on-chain Software Upgrade proposals.
# 1. Setup Cosmovisor
Set up the Cosmovisor environment variables. We recommend setting these in your
.profile so it is automatically set in every session.
After this, you must make the necessary folders for
cosmosvisor in your
DAEMON_HOME directory (
~/.haqqd) and copy over the current binary.
To check that you did this correctly, ensure your versions of
haqqd are the same:
# 2. Download the Haqq release
# 2.a) Manual Download
Cosmovisor will continually poll the
$DAEMON_HOME/data/upgrade-info.json for new upgrade instructions. When an upgrade is released (opens new window), node operators need to:
- Download (NOT INSTALL) the binary for the new release
- Place it under
<name>is the URI-encoded name of the upgrade as specified in the Software Upgrade Plan.
# 2.b) Automatic Download
NOTE: Auto-download doesn't verify in advance if a binary is available. If there will be any issue with downloading a binary,
cosmovisor will stop and won't restart an the chain (which could lead it to a halt).
It is possible to have Cosmovisor automatically download (opens new window) the new binary. Validators can use the automatic download option to prevent unnecessary downtime during the upgrade process. This option will automatically restart the chain with the upgrade binary once the chain has halted at the proposed
upgrade-height. The major benefit of this option is that validators can prepare the upgrade binary in advance and then relax at the time of the upgrade.
To set the auto-download use set the following environment variable:
# 3. Start your node
Now that everything is setup and ready to go, you can start your node.
You will need some way to keep the process always running. If you're on linux, you can do this by creating a service.
Then update and start the node
You can check the status with:
You can check logs with:
# Manual Upgrades
Learn how to manually upgrade your node.
# 1. Upgrade the Haqq version
Before upgrading the Haqq version. Stop your instance of
Next, upgrade the software to the desired release version. Check the Haqq releases page (opens new window) for details on each release.
Ensure that the version installed matches the one needed for the network you are running (mainnet or testnet).
If you have issues at this step, please check that you have the latest stable version of Golang (opens new window) installed.
Verify that you've successfully installed Haqq on your system by using the
If the software version does not match, then please check your
$PATH to ensure the correct
haqqd is running.
# 2. Replace Genesis file
You can find the latest
genesis.json file for mainnet or testnet in the following repositories:
Save the new genesis as
new_genesis.json. Then, replace the old
genesis.json located in your
config/ directory with
We recommend using
sha256sum to check the hash of the downloaded genesis against the expected genesis.
# 3. Data Reset
Remove the outdated files and reset the data:
Your node is now in a pristine state while keeping the original
config.toml. If you had any sentry nodes or full nodes setup before,
your node will still try to connect to them, but may fail if they haven't also
🚨 IMPORTANT 🚨
Make sure that every node has a unique
priv_validator.json. DO NOT copy the
priv_validator.json from an old node to multiple new nodes. Running two nodes with the same
priv_validator.json will cause you to double sign (opens new window).
# 4. Restart Node
To restart your node once the new genesis has been updated, use these commands: