Upgrading Nodes
This is a special section dedicated to tips related to updating Cardano nodes.
NOTES: This section is specific to nodes that were created manually or with the use of Coincashew tutorials. For instructions on how to upgrade nodes created using automated tools like CNTOOLS, please refer to the instructions in the respective tool pages.
Note also that we made a script for nodes that already have the necessary pre-requisites installed (e.g. libsodium, secp256k1, cabal 3.6.2, ghc 8.10.7). You may want to check that out first before proceeding with the full manual steps below. The script can be found in this link: http://github.com/bclens/scripts/blob/main/jupgradenode.sh
Upgrading Cardano nodes to 1.35 and above
These are my compiled steps to upgrade nodes to Cardano 1.35 and above for nodes built using Coincashew or manual methods. This is NOT meant for nodes that were built using CNTOOLS. Some good reference material have already been built for that.
While there has been material for Coincashew/manual builds, I have not seen a complete compilation yet which includes backup steps, dependency installation, and some procedures that can reduce total downtime.
As of this writing, Coincashew still had the steps to upgrade to a previous version which was mostly parameterized. This makes it easy to update but not as easy to follow. Hopefully, this sharing can help people who need it.
Credits go to the incredible people/organizations from whom I copied large portions to create this procedure including IOHK, Coincashew, Jack7E and jf3110
DISCLAIMER:
These upgrade steps are shared in good faith. While I have done multiple tests to ensure it is working before I shared it, you may encounter issues unique to your setup. For example, it is likely that your directories and currently installed apps are different from mine.
Therefore, please do your own checks and adjust the commands accordingly to suit your environment.
To be safe, I suggest that you backup your node first before doing the upgrade so you can easily fall back to your backup if something goes wrong. As usual, try the upgrade on your testnet nodes first and make sure they are working before updating mainnet. Good luck!
Start of upgrade procedures
Install new dependencies and update apps
sudo apt-get install nano llvm-12 numactl libnuma-dev autoconf automake libtool -y
sudo apt update
sudo apt upgrade -y
cd ~/git # Create this directory if not existing
git clone https://github.com/bitcoin-core/secp256k1.git
cd secp256k1 git reset --hard ac83be33d0956faf6b7f61a60ab524ef7d6a473a
./autogen.sh
./configure --prefix=/usr --enable-module-schnorrsig --enable-experimental
make
make check
sudo make install
Upgrade GHCup installer to latest version
ghcup upgrade ghcup --version
Install ghc
ghcup install ghc 8.10.7
ghcup set ghc 8.10.7
ghc --version
Install cabal
ghcup install cabal 3.6.2.0
ghcup set cabal 3.6.2.0
cabal --version
Build New Binaries
Prepare for the Build
At this point, if you want to keep your node up as long as possible, I recommend you DO NOT shutdown your node and update your Config files yet. You can do this at a later stage after you have compiled the new binaries
cd $HOME/git
rm -rf cardano-node-old
git clone https://github.com/input-output-hk/cardano-node.git cardano-node2
cd cardano-node2
cabal update
git fetch --all --recurse-submodules --tags
Checkout the Build
Check out the version that you want to install. Choose from one of the options below:
Option 1: If you just want to install the latest suggested version, run the following:
git checkout $(curl -s https://api.github.com/repos/input-output-hk/cardano-node/releases/latest | jq -r .tag_name)
Option 2: If you want instead to install a specific version (e.g. 1.35.2), run the following:
git checkout 1.35.2 # Replace the version number with the one you want to install
Build the Binaries
Continue building the binaries by running the following:
cabal configure -O0 -w ghc-8.10.7
echo -e "package cardano-crypto-praos\n flags: -external-libsodium-vrf" >> cabal.project.local
cabal build cardano-node cardano-cli
Backup Important Files
To save time, this section can be run while the previous command (cabal build cardano-node cardano-cli) is still running.
You must run this from another terminal window if you want to do this simultaneously with the previous command
Remember to change all items marked testnet to mainnet if you are upgrading Mainnet
Backup Current Config files
cd $HOME/cardano-my-node
cp -p testnet-alonzo-genesis.json testnet-alonzo-genesis.json.date +%Y%m%d
cp -p testnet-byron-genesis.json testnet-byron-genesis.json.date +%Y%m%d
cp -p testnet-config.json testnet-config.json.date +%Y%m%d
cp -p testnet-shelley-genesis.json testnet-shelley-genesis.json.date +%Y%m%d
cp -p testnet-topology.json testnet-topology.json.date +%Y%m%d
Backup binary files
Assuming /usr/local/bin is the location of your cardano-node and cardano-cli files.
If not, change the directory location below as needed.
cd /usr/local/bin
# Change the version number in the commands below accordingly
sudo cp -p cardano-node cardano-node.1.34.1
sudo cp -p cardano-cli cardano-cli.1.34.1
This ends the section of the commands that should be run from another terminal window
Resume Upgrade
After the "cabal build cardano-node cardano-cli" command completes, verify that you have the correct version numbers:
$(find $HOME/git/cardano-node2/dist-newstyle/build -type f -name "cardano-node") version
$(find $HOME/git/cardano-node2/dist-newstyle/build -type f -name "cardano-cli") version
Copy latest config files
Stop Cardano node before updating config files
sudo systemctl stop cardano-node.service
Use these commands to refresh the config files from IOHK:
cd $HOME/cardano-my-node
wget -N https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/${NODE_CONFIG}-config.json
wget -N https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/${NODE_CONFIG}-byron-genesis.json
wget -N https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/${NODE_CONFIG}-shelley-genesis.json
wget -N https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/${NODE_CONFIG}-alonzo-genesis.json
WARNING: You probably don't want to overwrite your current topology files (I don't recommend unless you know how to recover this). However, if for some reason you want to, you can run the command below (proceed with caution).
wget -N https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/${NODE_CONFIG}-topology.json
Install the new binary files
Copy the new binary files to /usr/local/bin
sudo cp $(find $HOME/git/cardano-node2/dist-newstyle/build -type f -name "cardano-node") /usr/local/bin/cardano-node
sudo cp $(find $HOME/git/cardano-node2/dist-newstyle/build -type f -name "cardano-cli") /usr/local/bin/cardano-cli
Verify versions are properly installed
cardano-node version
cardano-cli version
Reboot to refresh the system
sudo reboot
Start Cardano Service
The Cardano service should automatically start after rebooting. However, if you did not configure it to auto-start, you can start it manually using this command
sudo systemctl start cardano-node.service
Organize the git directory
cd $HOME/git
mv cardano-node/ cardano-node-old/
mv cardano-node2/ cardano-node/
That's it! You have completed the upgrade to Cardano 1.35.0
OPTIONAL:
Do this only if you are encountering "Could not resolve.." errors due to missing Libsodium:
Install Libsodium
git clone https://github.com/input-output-hk/libsodium
cd libsodium
git checkout 66f017f1
./autogen.sh
./configure make
sudo make install
sudo apt install libsodium-dev
Update .bashrc
Add the following to your ~/.bashrc file and source it:
export LD_LIBRARY_PATH=/usr/local/lib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
Last updated
Was this helpful?