How to update a Stakepool

Thank you for your support and kind messages! It really energizes us to keep creating the best crypto guides. Use cointr.ee to find our donation addresses and share your message. 🙏

​📡 1. How to perform an update

From time to time, there will be new versions of cardano-node. Follow the Official Cardano-Node Github Repo by enabling notifications with the watch functionality.

To update with $HOME/git/cardano-node as the current binaries directory, copy the whole cardano-node directory to a new place so that you have a backup.

cd $HOME/git
rm -rf cardano-node-old/
rsync -av cardano-node/ cardano-node2/
cd cardano-node2/

Read the patch notes for any other special updates or dependencies that may be required for the latest release.

Remove the old binaries and rebuild the latest binaries. Run the following command to pull and build the latest binaries. Change the checkout tag or branch as needed.

rm -rf $HOME/git/cardano-node2/dist-newstyle/build/x86_64-linux/ghc-8.6.5
git clean -fd
git fetch --all && git checkout tags/1.21.1 && git pull
cabal build cardano-node cardano-cli

Build process may take a few minutes up to a few hours depending on your computer's processing power.

Verify your cardano-cli and cardano-node were updated to the expected version.

$(find $HOME/git/cardano-node2/dist-newstyle/build -type f -name "cardano-cli") version
$(find $HOME/git/cardano-node2/dist-newstyle/build -type f -name "cardano-node") version

Stop your node before updating the binaries.

block producer node
relaynode1
systemd
block producer node
killall cardano-node
relaynode1
killall cardano-node
systemd
sudo systemctl stop cardano-node

Copy cardano-cli and cardano-node files into bin directory.

sudo cp $(find $HOME/git/cardano-node2/dist-newstyle/build -type f -name "cardano-cli") /usr/local/bin/cardano-cli
sudo cp $(find $HOME/git/cardano-node2/dist-newstyle/build -type f -name "cardano-node") /usr/local/bin/cardano-node

Now restart your node to use the updated binaries.

block producer node
relaynode1
systemd
block producer node
cd $NODE_HOME
./startBlockProducingNode.sh
relaynode1
cd $NODE_HOME
./startRelayNode1.sh
systemd
sudo systemctl start cardano-node

Finally, the following sequence will switch-over to your newly built cardano-node folder while keeping the old directory for backup.

cd $HOME/git
mv cardano-node/ cardano-node-old/
mv cardano-node2/ cardano-node/

​🤯 2. In case of problems

​🛣 4.1 Forked off

Forget to update your node and now your node is stuck on an old chain?

Reset your database files and be sure to grab the latest genesis, config, topology json files.

cd $NODE_HOME
rm -rf db

​📂 4.2 Roll back to previous version from backup

Stop your node before updating the binaries.

block producer node
relaynode1
systemd
block producer node
killall cardano-node
relaynode1
killall cardano-node
systemd
sudo systemctl stop cardano-node

Restore the old repository.

cd $HOME/git
mv cardano-node/ cardano-node-rolled-back/
mv cardano-node-old/ cardano-node/

Copy the binaries to /usr/local/bin

sudo cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-cli") /usr/local/bin/cardano-cli
sudo cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-node") /usr/local/bin/cardano-node

Verify the binaries are the correct version.

/usr/local/bin/cardano-cli version
/usr/local/bin/cardano-node version

Now restart your node to use the updated binaries.

block producer node
relaynode1
systemd
block producer node
cd $NODE_HOME
./startBlockProducingNode.sh
relaynode1
cd $NODE_HOME
./startRelayNode1.sh
systemd
sudo systemctl start cardano-node

​🤖 4.3 Last resort: Rebuild from source code

Follow the steps in How to build a Stakepool.​