Posted By : Yogesh
A Cardano node is a software application that runs on a computer and connects to the Cardano blockchain network. Nodes are responsible for maintaining a copy of the blockchain ledger, validating transactions, and producing new blocks.
Cardano nodes are essential for the security and decentralization of the network. By running a node, you are helping to ensure that the blockchain is accurate and that transactions are processed fairly.
To run a Cardano node, you will need a computer with a reliable internet connection. You will also need to install the Cardano node software.
Setting up a Cardano node involves several steps, and it's a somewhat technical process. Before you begin, make sure you have the necessary hardware, software, and familiarity with command-line tools. Here's a high-level overview of how to set up a Cardano node:
Prerequisites:
Hardware Requirements:
Operating System:
Software Dependencies:
Steps to Set Up a Cardano Node:
Linux
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install automake build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ tmux git jq wget libncursesw5 libtool autoconf -y
If you are using a different flavor of Linux, you will need to utilize the appropriate package manager for your platform, instead of yum or apt-get, and the package names you need to install may vary.
Installation of GHC and Cabal The quickest method for installing GHC (Glasgow Haskell Compiler) and Cabal (Common Architecture for Building Applications and Libraries) involves using ghcup.
To install ghcup, execute the following command:
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
ghcup will attempt to detect your shell and prompt you to add it to the environment variables. Kindly restart your shell or terminal after installing ghcup.
ghcup --version
The GHCup Haskell installer, version 0.1.19.2
ghcup will install the most recent stable release of Cabal. Nevertheless, as of the time of writing, Input-Output recommends the use of Cabal version 3.6.2.0. Therefore, we will employ ghcup to install and switch to the specified version.
ghcup install cabal 3.6.2.0
ghcup set cabal 3.6.2.0
mkdir -p $HOME/cardano-src
cd $HOME/cardano-src
Following that, we will proceed to download, compile, and install libsodium.
git clone https://github.com/input-output-hk/libsodium
cd libsodium
git checkout dbb48cc
./autogen.sh
./configure
make
sudo make install
Next, you should append the following environment variables to your shell profile. Depending on your preferred shell application (e.g., $HOME/.zshrc or $HOME/.bashrc), add the following lines to the end of your shell profile/configuration file. This step informs the compiler that libsodium is present on your system.
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
Download and install libsecp256k1:
cd $HOME/cardano-src
git clone https://github.com/bitcoin-core/secp256k1
cd secp256k1
git checkout ac83be33
./autogen.sh
./configure --enable-module-schnorrsig --enable-experimental
make
make check
sudo make install
Now we are ready to download, compile and install cardano-node and cardano-cli
cd $HOME/cardano-src
git clone https://github.com/input-output-hk/cardano-node.git
cd cardano-node
git fetch --all --recurse-submodules --tags
Switch the repository to the most recent tagged commit:
git checkout $(curl -s https://api.github.com/repos/input-output-hk/cardano-node/releases/latest | jq -r .tag_name)
cabal configure --with-compiler=ghc-8.10.7
During some installations, you may encounter the following warning: "Warning: The package list for 'cardano-haskell-packages' does not exist. To resolve this issue, run 'cabal update' to download it. It is advisable to run 'cabal update' for each installation, even if you do not encounter this specific error, as it can also address other issues stemming from changes to the package list."
If you are running non x86/x64 platform (eg. ARM) please install and configure LLVM with:
sudo apt install llvm-9
sudo apt install clang-9 libnuma-dev
sudo ln -s /usr/bin/llvm-config-9 /usr/bin/llvm-config
sudo ln -s /usr/bin/opt-9 /usr/bin/opt
sudo ln -s /usr/bin/llc-9 /usr/bin/llc
sudo ln -s /usr/bin/clang-9 /usr/bin/clang
cabal update
cabal build all
mkdir -p $HOME/.local/bin
cp -p "$(./scripts/bin-path.sh cardano-node)" $HOME/.local/bin/
cp -p "$(./scripts/bin-path.sh cardano-cli)" $HOME/.local/bin/
To enable your shell or terminal to recognize "cardano-node" and "cardano-cli" as global commands, you need to add the following line to your shell profile configuration file, which can be either $HOME/.zshrc or $HOME/.bashrc, depending on the shell application you are using.
export PATH="$HOME/.local/bin/:$PATH"
After saving the changes, refresh your shell profile by entering the command source $HOME/.zshrc or source $HOME/.bashrc (depending on the shell application you are using).
To confirm the installed version, run:
cardano-cli --version
cardano-node --version
You've completed the installation of Cardano components on your Linux system successfully! ???
November 22, 2024 at 10:52 pm
Your comment is awaiting moderation.