Skip to main content

Node Upgrade

In this chapter, we will see the CLI command lines to install the necessary dependencies to upgrade a Mavryk node.

Upgrade a Mavkit node

Mavryk is an evolving blockchain. Through its on-chain governance mechanism, Mavryk smoothly evolves to become more secure and scalable over time.

The following commands help to upgrade your node to the latest Mavkit version.

tip

Node software upgrades (Mavkit versions) are different from protocol amendments. Protocol changes are decided through Mavryk's on-chain governance and activate automatically. Mavkit upgrades ensure your node supports the latest protocol and includes bug fixes and performance improvements.

caution

Major version upgrades may change the storage format. After upgrading, run mavkit-node upgrade storage if prompted. Once upgraded, the data directory cannot be used with the previous version. Always back up your data directory before upgrading.

Before you upgrade

  1. Check your current version: mavkit-node --version
  2. Verify your node is synced: mavkit-client bootstrapped
  3. Back up your data directory (default: ~/.mavkit-node)
  4. Review the release notes for breaking changes

Docker and Docker Compose

Upgrade the docker image
To upgrade your node to the latest Mavkit version, replace your previous image version (your current version) with the latest: v19.1. Note that if you run the image tagged `latest`, a restart of your container is sufficient.
danger

Ensure you mount a persistent volume with -v when using docker run. Without it, a new container creates a fresh volume and your existing chain data will not be used.

To use the v19.1 image, execute the following command:

docker run -v node-data-volume:/var/run/mavryk/node mavrykdynamics/mavryk:v19.1 mavkit-node run --rpc-addr 127.0.0.1:8732

Docker Compose

If you deployed with Docker Compose, update the image version in your docker-compose.yml:

services:
mavryk-node:
image: mavrykdynamics/mavryk:v19.1

Then pull the new image and restart:

docker-compose pull
docker-compose down
docker-compose up -d

Your chain data is preserved in the mounted volume.

Serokell PPA with Mavryk packages

Upgrade mavryk packages

To fetch the latest node version, run the following command:

sudo apt-get update
sudo apt-get upgrade

From source

From scratch

Upgrade from scratch

Execute the following commands in your Mavryk repository:

git fetch
git checkout v19.1
opam switch remove .
rm -rf _opam _build
make build-deps
eval $(opam env)
make
caution

opam switch remove . is only needed if you are updating an already compiled repository, not if you are compiling from a freshly cloned repository.

danger

opam switch remove . destroys the entire local opam switch for the current directory. Verify you are in the correct Mavkit repository directory before running this command.

Mavryk opam packages

Upgrade using opam

Run the following commands:

opam update
opam depext
opam upgrade

After upgrading

  1. Verify the new version: mavkit-node --version
  2. Upgrade storage if needed: mavkit-node upgrade storage
  3. Confirm network connectivity: mavkit-client bootstrapped
  4. Monitor logs for errors during the first few minutes

Rolling back

danger

If your storage was upgraded, rolling back to a previous version is not possible with the same data directory. You must restore from a backup or re-sync from a snapshot.

If you have a backup from before the upgrade:

  1. Stop the node
  2. Restore the backed-up data directory
  3. Install the previous version of Mavkit
  4. Restart the node
caution

Be careful when closing terminal windows because this stops the node.

tip

Use screen, or nohup to keep the node running in the background:

# Using screen
screen -S mavryk-node
mavkit-node run --rpc-addr 127.0.0.1:8732
# Detach with Ctrl+A, then D

# Using nohup
nohup mavkit-node run --rpc-addr 127.0.0.1:8732 > mavryk-node.log 2>&1 &