Install Hyperledger Iroha on AWS

Install Hyperledger Iroha on AWS

Recipe ID: hsts-r9

Self-paced training

We offer blockchain introduction, Hyperledger for system admin, Ethereum, Solidity, Corda R3, Hyperledger for developers, blockchain cybersecurity and more classes in self-paced video format starting at $60. Click here to learn more and register. For complete self-paced blockchain training, visit our Complete Blockchain Development Training page.

Recipe Overview

Hyperledger Iroha is a general-purpose permissioned blockchain system hosted by The Linux Foundation. It was contributed by Soramitsu, Hitachi, NTT DATA, and Colu.Hyperledger Iroha is written in C++ and incorporates the BFT consensus algorithm, named Yet Another Consensus (YAC). Hyperledger Iroha consists of simple deployment and fast development. It can be used in applications that manage digital assets, identity, interbank payment, and so on.
For those who are not familiar with Hyperledger project, reading Blockchain Overview, Intro to Hyperledger Family and Hyperledger Blockchain Ecosystem, Hyperledger Design Philosophy and Framework Architecture, and Overview of Building Blockchain Smart Contracts in Hyperledger articles are strongly recommended beforehand.

Hyperledger Iroha Project Overview
Hyperledger Iroha offers the following key features:

The Iroha network is illustrated in the following diagram, and each component in the Iroha network is explained here:

The Iroha network is composed of peer nodes, and these communicate with each other through the gossip protocol. Iroha stores its block in a specified block store and stores the current state of the system World State View (WSV) in a PostgreSQL database.

One of the features of Iroha is to provide permission management and account creation, and each account is assigned with roles for its permission. The role-based permission model is flexible enough to manage the allowed actions and resources for accounts in the system.
Iroha provides a pre-built set of commands and queries to perform common asset and account operations. With the help of built-in commands, you can define assets and accounts into the domain for various applications in your organization.

Iroha also distributes a set of client libraries for different languages, such as Python, Java, and C++, to communicate with the network via gRPC-based Torii. Torii is implemented with C++ using gRPC, and it is the entry point for a client to interact with the Iroha network. The gRPC is a remote procedure call framework that was developed by Google. In the gRPC client application, it could call methods on the remote server in the same way as it is calling local objects. The gRPC uses protobuf to define its Interface Definition Language (IDL) and message-interchange formats.

To develop the gRPC application, the service and its methods are first defined in protobuf files. Secondly, the protobuf file is compiled with a gRPC tool to generate the server skeleton code and client stub code for different languages. The real business logic for the server side will be implemented based on the generated server skeleton code. For Iroha, the gRPC server is Torii. The client application could easily call methods on the gRPC server with the generated stud files using a communication channel, such as TCP.
In this recipe, we will only cover the installation of Hyperledger Iroha on Amazon Web Services or AWS. After completing this recipe, you can configure Hyperledger Iroha, interact with Hyperledger Iroha using the CLI to create cryptocurrency and interact with Hyperledger Iroha using the client library.

Hyperledger Iroha Installation on AWS
To install and run the recipes in this chapter, you need an EC2 instance on AWS with the following prerequisite:

Take the following steps to install Hyperledger Iroha on AWS:
1. Create the Hyperledger Iroha Docker network:

ubuntu@ip-172-31-90-67:~/iroha$ sudo docker network create iroha-network

2. To start the Iroha state database, PostgreSQL, enter the following command, which will start the PostgreSQL Docker container:

ubuntu@ip-172-31-90-67:~/iroha$ sudo docker run --name postgresDB \

Unable to find image 'postgres:9.5' locally

Pulling from library/postgres c1f213be5edb: Pull complete Digest: sha256:f4603c7b8aaf418393edb8cd5e2d1abd91d686ab571302dc83f887ea4a56 286b

Status: Downloaded newer image for postgres:9.5 5fe47dbc49027617ad6c6e5c6ba57092bfbb485f3aba6dacc70e2a5183b1d9ba

3. Create blockstore:

ubuntu@ip-172-31-90-67:~/iroha$ sudo docker volume create

4. Configure the network. In this recipe, we are using the configuration file, genesis block, and key pairs from the Iroha example. To configure the Iroha network for real business usage, these need to be generated for your organization:

ubuntu@ip-172-31-90-67:~/iroha$git clone Cloning into 'iroha'...
remote: Enumerating objects: 1575, done.

remote: Counting objects: 100% (1575/1575), done.
remote: Compressing objects: 100% (1336/1336), done.
remote: Total 1575 (delta 460), reused 596 (delta 182), pack-reused 0
Receiving objects: 100% (1575/1575), 3.58 MiB | 0 bytes/s, done.
Resolving deltas: 100% (460/460), done.
Checking connectivity... done.

5. Start the Iroha Docker container:
ubuntu@ip-172-31-90-67:~/iroha$ sudo docker run -it --name iroha -p 50051:50051 -v $(pwd)/iroha/example:/opt/iroha_data -v blockstore:/tmp/block_store --network=iroha-network -- entrypoint=/bin/bash hyperledger/iroha:develop
Unable to find image 'hyperledger/iroha:develop' locally develop: Pulling from hyperledger/iroha Digest:
Status: Downloaded newer image for hyperledger/iroha:develop

6. Launch the Iroha daemon:
root@8a0356adcbe3:/opt/iroha_data# irohad --config config.docker -- genesis_block genesis.block --keypair_name node0
[2018-11-03 17:38:04.844225244][th:20][info] MAIN start
[2018-11-03 17:38:04.844847536][th:20][info] MAIN config initialized

Put Things Together
Iroha can be built from source, but it is easier and faster to install the Iroha network using its Docker image. In this recipe, we installed Iroha with Docker and used its example configuration, key pairs, and so on to set up the Iroha testing environment to work with the blockchain.
We have also created a virtual Docker network to facilitate network communication between the Iroha node and database. Then, we created a block store to persist blocks and started a single Iroha peer network for testing.
Congratulation! We have successfully installed Hyperledger Iroha on an AWS EC2 virtual machine. After completing this recipe, you can configure Hyperledger Iroha, interact with Hyperledger Iroha using the CLI to create cryptocurrency and interact with Hyperledger Iroha using the client library.
The following recipes are excellent resources for installing other Hyperledger tools:

Blockchain Developer Guide- How to Install and work with Hyperledger Sawtooth
Blockchain Developer Guide- How to Install Hyperledger Fabric on AWS
Blockchain Hyperledger Composer Business Network Modeling and Environment Setup
Blockchain Developer Guide- How to Install Hyperledger Burrow on AWS
Blockchain Developer Guide- How to Install Hyperledger Seth and Docker on AWS
Blockchain Developer Guide- How to Install Hyperledger Indy and Indy CLI on AWS

To conclude this recipe, we like to recommend our Blockchain Hyperledger Development in 30 hours course to those interested in pursuing a blockchain development career. Indeed, as of this writing, Hyperledger Foundation offers the following two Hyperledger certifications: The Certified Hyperledger Fabric Administrator (CHFA) and The Certified Hyperledger Sawtooth Administrator (CHSA), both of which are highly regarded in the industry. Hyperledger Foundation is in the process of creating Hyperledger Developer certification program, which may be released in early or middle of 2020. In short, by taking our hands-on online Hyperledger class, you would be able to obtain CHFA certification.

This recipe is written by Brian Wu who is our senior Hyperledger instructor in Washington DC. His Hyperledger Cookbook with 40+ hands-on recipes is highly recommended.

Related Training Courses

Hands-on Node.JS, MongoDB and Express.js Training
Advance JavaScript, jQuery Using JSON and Ajax
Learn Hands-on Blockchain Ethereum Development & Get Certified in 30 Hrs
Learn Blockchain Hyperledger Development & Get Certified in 30 Hrs
Become Blockchain Certified Security Architect in 30 hours
Blockchain Certified Solution Architect in 30 hours
Introduction to Python Programming
Object Oriented Programming with UML

Private and Custom Tutoring

We provide private tutoring classes online and offline (at our DC site or your preferred location) with custom curriculum for almost all of our classes for $50 per hour online or $75 per hour in DC. Give us a call or submit our private tutoring registration form to discuss your needs.

View Other Classes!