# Node

If you want to support this free educational Cardano content or found the content helpful, visit [cointr.ee](https://cointr.ee/coincashew) to find our donation addresses. Much appreciated in advance. ​

​[Input-Output (IOHK)](https://iohk.io/) regularly releases new versions of Cardano Node via the `cardano-node` [GitHub repository](https://github.com/input-output-hk/cardano-node). Carefully review release notes available in the repository for new features, known issues, technical specifications, related downloads, documentation, changelogs, assets and other details of each new release.

To receive notifications related to activity in the Cardano Node GitHub repository, configure [Watch](https://docs.github.com/en/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications#automatic-watching) functionality.

The *Upgrading a Node* topic describes how to upgrade a Cardano node to the latest version. Complete the following procedures on each block producer and relay node comprising your stake pool as needed to complete the upgrade.

For instructions on upgrading your stake pool to a previous Cardano version, see the [archive](https://github.com/coincashew/coincashew/blob/master/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node/part-iv-administration/upgrading-a-node-archive.md).

### &#x20;<a href="#upgrading-third-party-software" id="upgrading-third-party-software"></a>

If you use [CNCLI](https://github.com/cardano-community/cncli) command line utilities developed by the Cardano Community, then upgrade to the latest version if a newer version is available.

Do not confuse the Cardano Community's CNCLI utilities with the [`cncli.sh`](https://cardano-community.github.io/guild-operators/Scripts/cncli/) companion script for stake pool operators maintained by [Guild Operators](https://cardano-community.github.io/guild-operators/).

**To upgrade the Cardano Community's CNCLI binary:**

1. 1\.

   In a terminal window, type the following commands:

RELEASETAG=$(curl -s <https://api.github.com/repos/cardano-community/cncli/releases/latest> | jq -r .tag\_name)

VERSION=$(echo ${RELEASETAG} | cut -c 2-)

echo "Installing release ${RELEASETAG}"

curl -sLJ <https://github.com/cardano-community/cncli/releases/download/${RELEASETAG}/cncli-${VERSION}-x86\\_64-unknown-linux-gnu.tar.gz> -o /tmp/cncli-${VERSION}-x86\_64-unknown-linux-gnu.tar.gz

sudo tar xzvf /tmp/cncli-${VERSION}-x86\_64-unknown-linux-gnu.tar.gz -C /usr/local/bin/

2\. To confirm that the new version of the CNCLI binary is installed, type:

If the command displays the latest version number, then the upgrade is successful.

​[Guild Operators](https://cardano-community.github.io/guild-operators/) maintains a set of tools to simplify operating a Cardano stake pool, including [Guild LiveView](https://cardano-community.github.io/guild-operators/Scripts/gliveview/). If you use the gLiveView script, then ensure that you are using the latest version prior to upgrading your Cardano node.

In the [Common `env`](https://cardano-community.github.io/guild-operators/Scripts/env/) file for Guild Operator scripts, by default the `UPDATE_CHECK` user variable is set to check for updates to scripts when you start `gLiveView.sh`. If your implementation displays the message `Checking for script updates` when gLiveView starts and you install available updates when prompted, then you do NOT need to complete the following procedure.

**To upgrade the Guild LiveView tool manually:**

1. 1\.

   To back up existing Guild LiveView script files, type the following commands where `<gLiveViewFolder>` is the folder where the `gLiveView.sh` script is located on your computer:

mv gLiveView\.sh gLiveView\.sh.bak

If you follow the Coin Cashew instructions for Starting the Nodes, then you can type `$NODE_HOME` to replace

2\. To download the latest Guild LiveView script files, type:

curl -s -o gLiveView\.sh <https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/gLiveView.sh>

curl -s -o env <https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/env>

3\. To set file permissions on the `gLiveView.sh` file that you downloaded in step 2, type:

4\. To set the `CONFIG` and `SOCKET` user variables in the `env` file that you downloaded in step 2, type:

-e "s/\\#CONFIG=\\"\\${CNODE\_HOME}\\/files\\/config.json\\"/CONFIG=\\"\\${NODE\_HOME}\\/mainnet-config.json\\"/g" \\

-e "s/\\#SOCKET=\\"\\${CNODE\_HOME}\\/sockets\\/node0.socket\\"/SOCKET=\\"\\${NODE\_HOME}\\/db\\/socket\\"/g"

5\. As needed to configure Guild LiveView for your stake pool, use a text editor to transfer additional user variable definitions from the `env.bak` file that you created in step 1 to the `env` file that you downloaded in step 2.

6\. To test the upgrade, type:

If the upgrade is successful, then the terminal window displays the Guild LiveView dashboard having the version number of the latest release.

### &#x20;<a href="#setgcversions" id="setgcversions"></a>

For each Cardano Node release, Input-Output recommends compiling binaries using specific versions of GHC and Cabal. For example, refer to [Installing cardano-node and cardano-cli from source](https://developers.cardano.org/docs/get-started/installing-cardano-node/) in the [Cardano Developer Portal](https://developers.cardano.org/docs/get-started/) to determine the GHC and Cabal versions required for the current Cardano Node release. *Table 1* lists GHC and Cabal version requirements for the current Cardano Node release.

*Table 1 Current Cardano Node Version Requirements*

| Release Date    | Cardano Node Version | GHC Version | Cabal Version |
| --------------- | -------------------- | ----------- | ------------- |
| August 11, 2022 | 1.35.3               | 8.10.7      | 3.6.2.0       |

**To upgrade the GHCup installer for GHC and Cabal to the latest version:**

* In a terminal window, type:

**To install other GHC versions:**

* In a terminal window, type the following commands where `<GHCVersionNumber>` is the GHC version that you want to install and use:

ghcup install ghc \<GHCVersionNumber>

ghcup set ghc \<GHCVersionNumber>

**To install other Cabal versions:**

* In a terminal window, type the following commands where `<CabalVersionNumber>` is the Cabal version that you want to install and use:

ghcup install cabal \<CabalVersionNumber>

ghcup set cabal \<CabalVersionNumber>

To set GHCup, GHC and Cabal versions using a graphical user interface, type `ghcup tui` in a terminal window.

### &#x20;<a href="#downloading-new-configuration-files" id="downloading-new-configuration-files"></a>

A new Cardano Node release may include updated configuration files. If configuration files are updated for a release, then you need to download and install the new configuration files when you upgrade a node.

**To download and install new Cardano Node configuration files:**

1. 1\.

   To stop your Cardano node, type the following command in a terminal window where `<CardanoServiceName>` is the name of the systemd service running your Cardano node:

sudo systemctl stop \<CardanoServiceName>.service

2\. To back up the configuration files that your node currently uses, type the following commands where `<ConfigurationFileFolder>` is the path to the folder where the configuration files are located:

cd \<ConfigurationFileFolder>

mv mainnet-config.json mainnet-config.bak

mv mainnet-byron-genesis.json mainnet-byron-genesis.bak

mv mainnet-shelley-genesis.json mainnet-shelley-genesis.bak

mv mainnet-alonzo-genesis.json mainnet-alonzo-genesis.bak

mv mainnet-topology.json mainnet-topology.bak

If you follow the Coin Cashew instructions for [Preparing Configuration Files](https://github.com/coincashew/coincashew/blob/master/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node/part-ii-configuration/preparing-configuration-files.md), then `<ConfigurationFileFolder>` is `$HOME/cardano-my-node` Alternately, you can type `$NODE_HOME` If needed, you can also use the environment variable `$NODE_CONFIG` to indicate the `mainnet` cluster in configuration file names.

3\. Using a Web browser, navigate to the Cardano Node [GitHub repository](https://github.com/input-output-hk/cardano-node), then browse to the latest release, then click to expand the Downloads dropdown list in the Technical Specification section of the release notes, and then click the Configuration Files link.

4\. On the Cardano Configurations page, click the following links to download configuration files for the `mainnet` cluster to the folder where you created backups of your current configuration files in step 2: `config`, `byronGenesis`, `shelleyGenesis`, `alonzoGenesis` and `topology`

If you want to download new configuration files using the command line, then navigate to the folder where you created backups of your current configuration files in step 2 using a terminal window, and then type the following command where `<ConfigurationFileURL>` is the URL for the configuration file that you want to download: `wget <ConfigurationFileURL>`

5\. Using [`diff`](https://www.man7.org/linux/man-pages/man1/diff.1.html) or a similar file comparison utility, identify and copy customizations as needed from the backup configuration files that you created in step 2 to each new configuration file that you downloaded in step 4.

### &#x20;<a href="#buildingcn" id="buildingcn"></a>

**To build binaries for a new Cardano Node version:**

1. 1\.

   To create a clone of the Cardano Node [GitHub repository](https://github.com/input-output-hk/cardano-node), type the following commands in a terminal window on the computer you want to upgrade where `<NewFolderName>` is the name of a folder that does not exist:

\# Navigate to the folder where you want to clone the repository

\# Download the Cardano Node repository to your local computer

git clone <https://github.com/input-output-hk/cardano-node.git> ./\<NewFolderName>

Cloning the GitHub repository to a new folder allows you to roll back the upgrade, if needed, by re-installing on your computer the `cardano-node` and `cardano-cli` binaries from a folder where you compiled a previous version of Cardano Node packages.

2\. To build Cardano Node binaries using the source code that you downloaded in step 1, type the following commands where `<NewFolderName>` is the name of the folder you created in step 1 and `<GHCVersionNumber>` is the GHC version that you set in the section [Setting GHC and Cabal Versions](https://github.com/alfacardanopool/guide/blob/alfapool/guide-how-to-set-up-a-cardano-stake-pool/part-iv-administration-and-maintenance/broken-reference/README.md):

\# Navigate to the folder where you cloned the Cardano Node repository

cd $HOME/git/\<NewFolderName>

\# Update the list of available packages

\# Download all branches and tags from the remote repository

git fetch --all --recurse-submodules --tags

\# Switch to the branch of the latest Cardano Node release

git checkout $(curl -s <https://api.github.com/repos/input-output-hk/cardano-node/releases/latest> | jq -r .tag\_name)

\# Adjust the project configuration to disable optimization and use the recommended compiler version

cabal configure -O0 -w ghc-\<GHCVersionNumber>

\# Append the cabal.project.local file in the current folder to avoid installing the custom libsodium library

echo -e "package cardano-crypto-praos flags: -external-libsodium-vrf" >> cabal.project.local

\# Compile the cardano-node and cardano-cli packages found in the current directory

cabal build cardano-node cardano-cli

The time required to compile the `cardano-node` and `cardano-cli` packages may be a few minutes to hours, depending on the specifications of your computer.

3\. When the compiler finishes, to verify the version numbers of the new `cardano-node` and `cardano-cli` binaries type:

$(find ./dist-newstyle/build -type f -name "cardano-node") version

$(find ./dist-newstyle/build -type f -name "cardano-cli") version

### &#x20;<a href="#installing-new-cardano-node-binaries" id="installing-new-cardano-node-binaries"></a>

**To install new `cardano-node` and `cardano-cli` binaries:**

1. 1\.

   If your Cardano node is running, then type the following command to stop the node where `<CardanoServiceName>` is the name of the systemd service running your node:

sudo systemctl stop \<CardanoServiceName>.service

2\. To replace the existing `cardano-node` and `cardano-cli` binaries, type the following commands where `<DestinationPath>` is the absolute file path to the folder where you install Cardano Node binaries on your local computer:

sudo cp $(find ./dist-newstyle/build -type f -name "cardano-node") \<DestinationPath>/cardano-node

sudo cp $(find ./dist-newstyle/build -type f -name "cardano-cli") \<DestinationPath>/cardano-cli

If you follow the Coin Cashew instructions for [Compiling Source Code](https://github.com/coincashew/coincashew/blob/master/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node/part-i-installation/compiling-source-code.md), then `<DestinationPath>` is `/usr/local/bin`

3\. To verify that you installed the new Cardano Node binaries successfully, type:

4\. Optionally, to install the latest versions of all previously installed packages on your computer, and then reboot the computer, type:

sudo apt-get update && sudo apt-get upgrade -y && sudo reboot

5\. If you need to restart your Cardano node manually, then type the following command where `<CardanoServiceName>` is the name of the systemd service running your Cardano node:

sudo systemctl start \<CardanoServiceName>.service

Upgrading to a new Cardano Node version may require replaying the copy of the blockchain residing on the local computer. The task of replaying the blockchain may require hours to complete. To monitor your node, type the command `journalctl -fu cardano-node.service` in a terminal window.

6\. Copy the new `cardano-cli` binary to the air-gapped, offline computer that you use to sign transactions for your stake pool.

To verify that the upgrade is successful, open gLiveView, journactl logs or Grafana dashboard.

journalctl -fu cardano-node

After an upgrade, starting a node may take up to a few hours. Be patient.

Congrats on completing the update. ​

Did you find our guide useful? Send us a signal with a tip and we'll keep updating it.

It really energizes us to keep creating the best crypto guides.

Use [cointr.ee](https://cointr.ee/coincashew) to find our donation addresses. ​

Any feedback and all pull requests much appreciated. ​
