Building Iroha from Source on your Linux System

Hyperledger Iroha is a Blockchain platform written in C++ that uses YAC Consensus. Iroha mainly helps create, verify and manage fungible assets and user accounts.

Installing Iroha with Docker is a lot easier, but for a lot of purposes, installing Iroha natively makes a lot more sense.

Pre-requisites

The first thing to do would be to update package lists.

apt-get update

Remember that while I’m using sudo, you should only use it after ensuring that it’s A-ok to give root permissions to install the modules required.

You can go ahead and install the pre-requsites using the following command.

apt-get -y --no-install-recommends install build-essential ninja-build git ca-certificates tar curl unzip cmake

Here’s the list of the pre-requisites needed.

build-essential references the tools needed to compile a Debian packge, such as GCC/G++ etc.

ninja-build is a build system.

git is version control.

ca-certificates are authority tools used to issue digital certificates.

tar, curl, unzip are tools to download and work with certain types of file.

cmake is another build system.

Installing the dependencies

Here you’ll need to install a bunch of dependencies Iroha uses. This one is pretty straightforward. Fair warning: This might take a minute or two to be done with.

git clone https://github.com/hyperledger/iroha.git
iroha/vcpkg/build_iroha_deps.sh
vcpkg/vcpkg integrate install

At the end, you’ll get a build parameter such as -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake, you might want to save it somewhere for later.

Building Iroha

Check the number of threads on your system using nproc. Now go ahead and build Iroha using the resources we have!

cd iroha
cmake -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake -G "Ninja"
cmake --build build --target irohad -- -j<number of threads>

And you’re done! Tune in to find our some tutorials on Iroha soon enough. Let me in the comments if anything isn’t clear.