How to set up Cardano Node?

Polkadot Network

When Bitcoin was introduced in 2008, it brought along Blockchain technology. Since then, the evolution of Blockchain has been incredible. While the 1st gen blockchain Bitcoin could power only cryptocurrency transactions, the second-gen entrant Ethereum raised the bar by introducing Smart Contracts, dApps, and DeFi. With Ethereum, the world witnessed how Blockchain can power enterprise-grade solutions and replace the dominance of intermediaries with user sovereignty. But scalability was one of the major shortcomings of both first and second-gen Blockchain. Besides, the lack of interoperability is another key reason that limits down the use-cases of Blockchain in the real world. Do we have a solution to it?

In this context, let’s explore Cardano. Its founders have positioned it as a third-gen blockchain because it has been designed to resolve the limitations of the first and second-gen blockchains by solving pain points like scalability, interoperability, and sustainability.

Cardano is a proof-of-stake blockchain platform that facilitates the development of dApps and systems bearing unparalleled security and sustainability. Though every blockchain platform is unique in its capacities, Cardano has a specialty. It is the first-ever Blockchain developed through peer-reviewed research and evidence-based methods.

  • What is Cardano?
  • Why use Cardano?
  • What is the Cardano node?
  • How does Cardano Node work?
  • How to set up Cardano nodes?
  • How to run the Cardano node.
  • What kind of Cardano development services can LeewayHertz offer?
  • Conclusion

What is Cardano?

Cardano is a decentralized third-generation proof-of-stake (POS) blockchain protocol designed to address the challenges of the proof-of-work (POW) system. Although Bitcoin and Ethereum are the world’s largest cryptocurrencies, the co-founder of Ethereum, Charles Hoskinson, understood the challenges associated with these two networks. He identified that scalability, sustainability, and interoperability were hard to achieve on the POW-based blockchain system.

High cost, slow transaction processing, high energy consumption, and limited infrastructure were also the shortcomings of proof-of-work consensus. This created the need for a more effective, transparent, and faster blockchain platform – Cardano.

Once done with enough research and having collected expert opinions on the vision, Charles Hoskinson began developing Cardano. He finally came up with a robust Blockchain protocol built around peer-reviewed research and evidence-based methods. Cardano utilizes the Ouroboros consensus protocol, which is fully secure and approved by academic scholars. Ouroboros can run on both permissioned and permissionless blockchain platforms. This feature has been rapidly getting traction across the companies looking for Cardano-based solutions.

Other Key Facts:

  • Cardano adopts proof-of-stake consensus protocol, where it appoints slot leaders for mining and validation of transactions. Simply put, miners can put their owned crypto possessions at stake for verification purposes.
  • Cardano ecosystem is being deployed in five phases: foundation, decentralization, smart contract integration, scaling, and governance.
  • On 13th September 2021, Cardano announced the arrival of Alonzo Hard Fork that facilitates smart contract creation and deployment on the mainnet. The update will help Cardano improve overall functionalities aside from widening the ecosystem through DeFi app development.

Why use Cardano?

Cardano is based on peer-reviewed papers. The protocol does not act on uncertain action plans. Instead, Cardano follows the research work and development methodologies proposed by the community experts that are reviewed by peer-group members, and only when the majority has consented to particular ideas, it gets into implementation. Moreover, Cardano embraces constant evolution through the best engineering and development practices, backed by continuous evolutionary research.

As mentioned, Cardano aims to remove the painful area of previous generation blockchains by concentrating on three main elements, scalability, interoperability, and sustainability.

Scalability

Cardano achieves scalability by solving problems related to TPS (transaction per second), network bandwidth, data storage, etc. It again adopts the proof-of-stake mechanism and implements a unique technique called RINA that splits the network into various subnetworks to reduce bandwidth usage on each Cardano node. The protocol also tackles data storage issues with techniques like pruning, compression, and partitioning.

Interoperability

To overcome the limitation of blockchain interoperability, Cardano operates as a reliable multi-functional ecosystem. It allows multiple currencies to exist side by side and seamlessly move across multiple chains. For instance, banks, commercial spaces, and businesses can engage with multiple cryptocurrencies with a single blockchain without any hassle.

Sustainability

To ensure the Cardano network’s sustainability and to confirm that it receives technology development support in the future, Cardano has created a treasury. Treasury is a special wallet that receives a certain percentage of funds whenever a transaction rolls down on the network. The treasury fund is used to reward the developers for their Cardano ecosystem or protocol development services.

What is the Cardano node? 

Cardano node is the key element inside the blockchain framework that upholds the entire network. Alternatively, the Cardano blockchain network consists of nodes interconnected to drive data exchanges and validate the transactions via the POS consensus mechanism. The definition of consensus differs from network to network. The Cardano network is supported by Ouroboros protocol. To join and contribute to the blockchain platform, users run Cardano nodes. And, in the context of Alonzo testnet, Cardano establishes and manages separate nodes, aside from the mainnet, which makes it easy for the miners to test and verify the ledger.

How does Cardano Node work?

Cardano node acts exactly how banks and authorized entities work in the centralized financial system. It’s basically a service node that authenticates the interaction within the network to impart complete transparency. Nodes further undertake the responsibility to validate transactions and produce blocks.

Block production

Cardano produces individually verifiable blocks in a peer-to-peer protocol. The platform employs a robust block-producing system to develop the blockchain. Meanwhile, consensus adds security layers and decides who can participate.

Transaction validation

Validation of transactions is a method in which slot leaders ascertain the needed amount for the senders. Their obligation also includes the determination of transactional parameters. Once confirmed, leaders record the data assuming it is an active block, to add it later after cross-verification.

How to set up the Cardano node in simple steps?

Since we have all the crucial information, such as Cardano and Cardano node definition, it’s time to discuss how to set up the Cardano node. We will explain installing the node and running it into multiple operating systems from the source node.

Prerequisites:

You will need the following for component setup:

Any latest operating system, whether Windows, Linux, or MacOS.

Dual-core CPU, 8GB RAM, and 10GB disk space.

Note:- Do not use a firewalled network. We recommend using TCP/IP 3000 and 3001 to establish an uninterrupted connection between the nodes.

Select the desired operating system

  • Linux
  • Windows
  • MacOS

Linux

The section is entirely dedicated to explaining Cardano node setup into the Linux operating system. We will go through the download, compilation, and installation process in sheer steps.

Step 1: OS (operating system) dependencies Installation

  • In order to download and then built the source code, you should have the
  • given tools and packages on the Linux system:
  • the version control system git
  • the gcc C-compiler
  • C++ support for gcc
  • developer libraries for the arbitrary precision library gmp
  • developer libraries for the compression library zlib
  • developer libraries for systemd
  • developer libraries for ncurses
  • ncurses compatibility libraries
  • the Haskell build tool cabal
  • the GHC Haskell compiler (version must be 8.10.4 or above)

If you are working on Redhat, Centos, and Fedora, then type the command:

sudo yum update -y
sudo yum install git gcc gcc-c++ tmux gmp-devel make tar xz wget zlib-devel libtool autoconf -y
sudo yum install systemd-devel ncurses-devel ncurses-compat-libs -y

And, for Debian or Ubuntu, type the following command:

sudo apt-get update -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

Furthermore, the yum or apt-get package manager won’t be compatible with the different flavors of Linux. In that plot, you need to choose a suitable different package manager after a thorough examination.

Step 2. GHC and cabal installation 

GHC Stands for Glassglow Haskell Compiler and Cabal for Common Architecture for Building Applications and Libraries. Using ghcup, one can conveniently and quickly install GHC and Cabal.

Type the given command to install and use ghcup:

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

Now, follow the further instructions properly to equip essential input to the installer. When done right, you will have ghc and cabal installed into your operating system.

You can also ensure if the ghcup is installed properly. For doing so, you need to type the command prompt- ghcup –version in the terminal. The result will appear like this:

The GHCup Haskell installer, version v0.1.14.1

Although ghcup automatically installs the latest ghc version, most blockchain infrastructure experts suggest ghc 8.10.4 to worldwide users. Hence, we will stick to the recommendation and use ghcup to install and swap to the latest version. Here’s the command:

ghcup install ghc 8.10.4
ghcup set ghc 8.10.4

The next step is to validate the versions of ghc and cabal.

Verify ghc version using:

ghc --version

The input will display something similar to this:

The Glorious Glasgow Haskell Compilation System, version 8.10.4

Checking the cabal version:

cabal --version

The command will display something similar to this:

cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library

Note: Before you jump to the next step of Cardano node installation, double-check that your installed version should align with the recommended version. No issues will occur unless you have skipped a few of the previous steps.

Step3: Download and compilation

The section will guide you on the creation of a working directory used to store source-code and builds. Run the command:

mkdir -p ~/cardano-src
cd ~/cardano-src

After this, you need to download, compile, and then install libsodium.

Use the command:

git clone https://github.com/input-output-hk/libsodium
cd libsodium
git checkout 66f017f1
./autogen.sh
./configure
make
sudo make instal

We will add the given command into the bottom part of configuration files based on the shell application you use (~/.zshrc or ~/.bashrc). It helps the compiler to determine the libsodium installation in the system.

export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

Again, depending on your preferred shell application, we have to reload the shell profile to explore the new variables. For that, start typing source ~/.bashrc or source ~/.zshrc.

Finally, we are all set to set up the Cardano node. However, it’s crucial to ensure that we are back to the initial stage of the working directory.

cd ~/cardano-src

Then, download the repository: Cardano-node

git clone https://github.com/input-output-hk/cardano-node.git
cd cardano-node
git fetch --all --recurse-submodules --tags

Get the latest tag commit on the git repository:

git checkout tags/1.27.0

Step4: Configuration of build option

You must use the same ghc version that we already installed. By doing so, it prevents defaulting the ghc’s system version.

cabal configure --with-compiler=ghc-8.10.4

Now, to use the Libsodium, you will need to revamp the local project:

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

Step 5: Building up and installation of the node

You can construct a Haskell-based Cardano-node as it produces feasible binaries.

cabal build all

Proceed to install the generated node and CLI commands into ~/.local/bin directory.

mkdir -p ~/.local/bin
cp -p "$(./scripts/bin-path.sh cardano-node)" ~/.local/bin/
cp -p "$(./scripts/bin-path.sh cardano-cli)" ~/.local/bin/

Don’t forget to add the command right below the Shell profile. The command helps the associated terminal to identify cardano-node and cardano-cli as global commands.

export PATH="~/.local/bin/:$PATH"

Once you saved the shell profile, reload it by writing: source ~/.zshrc or source ~/.bashrc (shell script depends on which application you choose)

Now, check the installed version.

cardano-cli –version
cardano-node –version

Kudos! You are done with the installation of Cardano components in Linux.

MacOS

Here, we will discover how to set up the Cardano node into MacOS. We will go through the download, compilation, and installation process. (Useful for Intel-based hardware).

Step1: OS (operating system) dependencies installation

To download and then built the source code, you should have the given tools and packages on the MacOS system:

Xcode - The Apple Development IDE and SDK/Tools
Xcode Command Line Tools, you can install it by typing xcode-select --install in the terminal.

Homebrew – The Missing Package Manager for MacOS (or Linux)

Step2: Homebrew packages installation 

For the proper compilation of both cardano-node and cardano-cli, you need to install libraries via brew:

brew install jq
brew install libtool
brew install autoconf
brew install automake
brew install pkg-config

Other steps are the same as what we did for Linux. (Refer to step 3 to the final step).

Windows

Windows Cardano-node installation is quite similar to MacOs and Linux. All you need is to use WSL (windows subsystem for Linux) to transform the windows environment into Linux.

After that, you can follow the Linux guide to set up and install the Cardano node.

How to run the Cardano Node?

Running the Cardano node requires the implementation of the run command. Type the following in the terminal.

cardano-node run \
--topology path/to/mainnet-topology.json \
--database-path path/to/db \
--socket-path path/to/db/node.socket \
--host-addr x.x.x.x \
--port 3001 \
--config path/to/mainnet-config.json

What kind of Cardano development services can LeewayHertz offer?

LeewayHertz offers a wide range of blockchain development services, including Cardano development services. Our core focus is to provide end-to-end solutions starting from conceptualization to development to maintenance and upgrade. We adopt the emerging technologies of advanced blockchain protocols, combine them with our expertise and develop solutions that meet today’s business needs. Check out a glimpse of our Cardano development services: 

Nodes Creation

Our blockchain developers are proficient in developing powerful Cardano nodes. They have a complete understanding of the Cardano ecosystem, proof-of-stake consensus algorithm, Alonzo testnet, and other components essential for node creation.

dAapp development

We offer Cardano-based app development services to diverse industries. Our developers abide by Cardano’s latest advances and employ them for developing enterprise-grade decentralized applications.

Smart contract development

We develop smart contracts that comply with Cardano’s programming languages and support various dApps. Aside from development, we perform thorough assessments and security audits to ensure proper optimization of the smart contracts.

Wallet development

Our blockchain developers are skilled in developing all types of digital wallets. We can build Cardano wallets apps for storing, delegating, and trading ADA cryptocurrencies, cardano native tokens and any other type of digital currencies.

What’s next?

As evident, Cardano is a highly mutative blockchain network seeking to change the blockchain space and its real-world applications. However, with the latest advances in emerging blockchain technologies like Cardano, the scope of blockchain development and deployment will also experience major changes. Businesses looking forward to leading the competition must acquire more advanced scalable, interoperable and sustainable blockchain solutions by leveraging blockchain development companies’ expertise, experience, and knowledge.

If you are looking for a high-grade & scalable decentralized dApp, you can connect with our Cardano blockchain experts. Our team does its job with keen consideration, from designing to consultation.

 

Author’s Bio

Akash Takyar
Akash Takyar
CEO LeewayHertz
Akash Takyar is the founder and CEO at LeewayHertz. With the experience of building over 100+ platforms for startups and enterprise allows Akash to rapidly architect and design solutions that are scalable and beautiful.
Akash's ability to build enterprise-grade technology solutions has attracted over 30 Fortune 500 companies, including Siemens, 3M, P&G and Hershey’s. Akash is an early adopter of new technology, a passionate technology enthusiast, and an investor in AI and IoT startups.

Start a conversation by filling the form

Once you let us know your requirement, our technical expert will schedule a call and discuss your idea in detail post sign of an NDA.

All information will be kept confidential.

 Send me the signed Non-Disclosure Agreement (NDA)