Hyperledger Indy Custom Network with Indy Node & Plenum(Protocol & Ledger)
Tags: blockchain, hyperledger, digitalidentity, hyperledgerindy
Published: 2020-12-25 10:59:24

---
title: Hyperledger Indy Custom Network with Indy Node & Plenum(Protocol & Ledger)
published: true
date: 2020-12-24 11:51:57 UTC
tags: blockchain,hyperledger,digitalidentity,hyperledgerindy
canonical_url: https://medium.com/coinmonks/hyperledger-indy-custom-network-with-indy-node-plenum-protocol-ledger-85fd10eb5bf5
---

#### Self Sovereign Identity (SSI) with Blockchain

![](https://cdn-images-1.medium.com/max/1024/1*OLN6HWQ_qUIskDI8isQsNQ.jpeg)

The popularity of Self Sovereign Identity (SSI) with Blockchain technology is gaining very rapidly where Self Sovereign Identity (SSI) is considered as the future of internet identity and Blockchain technology will be used to build the underlying structures of a proper Self Sovereign Identity (SSI) system. On the other hand Hyperledger Indy provides tools, libraries, and reusable components for providing digital self sovereign identities rooted on blockchains or other distributed ledgers so that they are interoperable across administrative domains, applications, and any other silo. **_Hyperledger Indy is a developing platform and so far there has no proper tutorial or document for development of a custom Indy network as all other tutorials are based on Indy Test Network. Moreover Indy Sdk is not ready to develop a custom Indy network. So by following this tutorial, anyone can easily build a custom made Hyperledger Indy network as per anyone’s requirements._**

To know the necessity of Self Sovereign Identity (SSI), please follow below link:  
[https://medium.com/@taseen.junaid/self-sovereign-identity-ssi-in-blockchain-the-future-of-internet-identity-6deb75607aa](https://medium.com/@taseen.junaid/self-sovereign-identity-ssi-in-blockchain-the-future-of-internet-identity-6deb75607aa)

[Self Sovereign Identity (SSI) in Blockchain & The Future of Internet Identity](https://medium.com/@taseen.junaid/self-sovereign-identity-ssi-in-blockchain-the-future-of-internet-identity-6deb75607aa)

![](https://cdn-images-1.medium.com/max/1024/1*OLN6HWQ_qUIskDI8isQsNQ.jpeg)<figcaption>Hyperledger Indy Network</figcaption>

### Indy Node:

Each Indy Node works as a distributed server and each node houses ledger to store records.

### Indy Plenum(Protocol & Ledger):

#### **Ledger**

Ledger is used to store transactions and each node into a blockchain based distributed system holds the same identical ledger. Currently, Indy Plenum has four types of ledger but plugins can add new ledger too.

**Domain Ledger** is used to store identity and application specific transactions. For example if you need to store stewards,trustees,actors identity or you need to store credential definition, schema definition or even revocation information of a particular credential, you have to use domain ledger.

![](https://cdn-images-1.medium.com/max/1024/1*XS_vJEI8EkjnwHwpDRK05A.jpeg)<figcaption>Different types of Indy Ledger</figcaption>

**Pool ledger** is used to store all node specific transactions so that we can create and manage network pools. It is used to add, edit or remove nodes into a distributed system.

**Config ledger** is used to store configuration related transactions, pool config parameters, transactions validation etc purpose. For example if an authority wants to add a credential definition and needs permission from the majority of stewards, we can store this type of access control options into config ledger.

**Audit ledger** actually works as a blockchain as it holds a global sequence number of all other ledger transactions(Domain, Pool, Config) in a sequential way.

#### **Protocol**

Protocol is the established set of rules that is used to govern our distributed system. Currently Indy uses Redundant Byzantine Fault Tolerance (RBFT) protocol for consensus with a potential plan to move to Aardvark.

### Public Permissioned Blockchain

Hyperledger Indy is called a public permissioned blockchain due to its nature. Everyone can read data from ledger without any permission which is the reason to call it public blockchain. On the other hand, to write data into ledger, you need validation according to a consensus mechanism and so it is also called permissioned blockchain.

![](https://cdn-images-1.medium.com/max/1024/1*q-9IuGrqNtevMmLerbrmgw.png)

To write something into a ledger, someone not only needs permission, but also needs consensus from a certain percentage of nodes. For example, a network pool is created with 10 nodes, so to write something into a ledger, someone needs consensus from at least 7 (10–3) nodes. The fault tolerance formula is ‘N = (3F + 1 )’ where ’N’ is the total number of nodes and F is the maximum number of malicious nodes.

![](https://cdn-images-1.medium.com/max/1024/1*sen5x0jbW_BDe2LNkOwsmg.jpeg)<figcaption>Write request</figcaption>

On the other hand, reading data does not need any permission or consensus and anyone can read data from any random node.

![](https://cdn-images-1.medium.com/max/1024/1*m_TQx41eVDCYS4sX6SGNzQ.jpeg)<figcaption>Read request</figcaption>

### Hands on Tutorial

#### **Prerequisites**

Hyperledger Indy network can be created by running nodes on different Ubuntu 16.04 machines. As till October, 2020 there is full support for only Ubuntu 16.04 which is also known as Ubuntu **Xenial**. So we have to use Ubuntu Xenial where Docker or Virtual Machine can also be used to make the network.  
Download the latest version of [**git**](https://git-scm.com/downloads) if it is not already installed.

#### Presetup

Please clone the [project](https://github.com/Ta-SeenJunaid/Hyperledger-Indy-Tutorial.git)by using the following command.

```
git clone [https://github.com/Ta-SeenJunaid/Hyperledger-Indy-Tutorial.git](https://github.com/Ta-SeenJunaid/Hyperledger-Indy-Tutorial.git)
```

For this tutorial, we will use version v1.0.0 and so we have to checkout that version with the following command.

```
git checkout tags/v1.0.0 -b v1.0.0-branch
```

![](https://cdn-images-1.medium.com/max/1024/0*4AoQfoEJwOMOaog1)<figcaption>Using tag V1.0.0</figcaption>

To set up the environment, you have to use the “prerequisites.sh” file. Instead of downloading different Indy components, we can also build those from respective sources.

```
sudo bash prerequisites.sh
```

![](https://cdn-images-1.medium.com/max/1007/0*OfWpP-9luWs6X6mx)<figcaption>Prerequisites</figcaption>

#### Generating public info using private/secret seed value

Seed is a 32 character long value which acts as an actor’s/component’s private information which is not shareable with others for security reasons. By using seed value, we can generate public information and can share those public information via agents or other mediums.  
By calling “get\_did\_and\_verkey.py” with 32 character long seed value, different actors can see their did(Decentralized Identity) and verification keys.

```
python3 get_did_and_verkey.py --seed 100A000000300000c0000000Steward1
```

![](https://cdn-images-1.medium.com/max/854/0*rnKQbezBGHh0S0tW)<figcaption>Generating public info using private/secret seed value</figcaption>

#### Initial Actors and Components

In an Indy based network there are some initials actors called endorsers, these include stewards and trustees.

**Trustee**  
First and foremost actors of our network are trustees. Domain ledger transactions start with trustee. In domain ledger, a trustee can add new stewards too. Both trustee and stewards have power to write on domain ledger.  
In this tutorial, we have one trustee with seed value “T0003000u0I000D000F000g0Trustee1”

**Stewards**  
Stewards have power to write on both domain ledger and pool ledger. A steward can add a new node by using pool ledger transactions. A steward can add only one node and so each steward can add its only node into networks.  
In this tutorial, as we have three nodes, we use three stewards with seed values   
“100A000000300000c0000000Steward1”,   
“300600b0D030000000z00000Steward2”, “v000K00l0000S000000e0000Steward3”

You can find different actors role into the following links  
[https://hyperledger-indy.readthedocs.io/projects/node/en/latest/auth\_rules.html#default-auth-map-rules](https://hyperledger-indy.readthedocs.io/projects/node/en/latest/auth_rules.html#default-auth-map-rules)

**Nodes:**  
Every node is a network component which holds ledgers. Users need to initialize each node by calling “init\_indy\_node.py” with the node name and node’s seed value. This code also prints that node’s public information like verification keys, BLS Public key, Proof of possession for BLS key which we share with others via agents or other mediums.

```
sudo python3 init_indy_node.py --name Node1 --seed 4000F000u00000D0000000g0000Node1
```

![](https://cdn-images-1.medium.com/max/858/0*QkB2Lp8YbqYMyHaw)<figcaption>Initialization of node</figcaption>

In this tutorial, as we have three nodes, we use seed with values   
“4000F000u00000D0000000g0000Node1”, “T00000000u0000I0000v0003000Node2”, “300000A00u000z0000600003000Node3”

#### Single Host Network Development

If we have an existing previous setup, we have to clear that at the very beginning by calling “clear\_setup.py”.

```
sudo python3 clear_setup.py --full True --network sandbox
```

![](https://cdn-images-1.medium.com/max/853/0*IJoxLSWh-8R2I0aM)<figcaption>Clear previous setup</figcaption>

To initialize nodes and to generate domain ledger and pool ledger genesis transactions, we have to call “single\_host\_generation.sh” file.

```
sudo bash single_host_generation.sh
```

![](https://cdn-images-1.medium.com/max/849/0*z2J55sRyWUDLblZs)<figcaption>Setup</figcaption>

To start Node, we have to use the “start\_indy\_node.py” file for each node.For Node1:

```
sudo python3 start_indy_node.py Node1 0.0.0.0 9701 0.0.0.0 9702
```

For Node2:

```
sudo python3 start_indy_node.py Node2 0.0.0.0 9703 0.0.0.0 9704
```

For Node3:

```
sudo python3 start_indy_node.py Node3 0.0.0.0 9705 0.0.0.0 9706
```

![](https://cdn-images-1.medium.com/max/772/0*io7so-RCq8zmS1Ur)<figcaption>Node start</figcaption>

To check the node information:

```
sudo python3 validator_info.py
```

![](https://cdn-images-1.medium.com/max/746/0*ouVEnpIbvTJ7kKSD)<figcaption>Node information</figcaption>

To restart the stopped node:

```
sudo bash restart_indy_node.sh
```

![](https://cdn-images-1.medium.com/max/747/0*26V1C0ZVSYEaF8zJ)<figcaption>Node restart</figcaption>

If your validity information shows that your node is stopped, you have to restart it again.

#### Multi Hosts Network Development

**If you want to run the network on a single host, then please skip the “Multi Hosts Network Development” section.**

Suppose Host IP of 3 Nodes are ‘191.177.76.26’, ‘22.185.194.102’, ‘247.81.153.79’ respectively. If you want to use your own IP, then you have to edit the “- -ips” flag of multi\_host\_host1\_generation.sh, multi\_host\_host2\_generation.sh, multi\_host\_host3\_generation.sh files. Actually for each node, you have to write that node’s generation file so that no one will be able to know that node’s seed value.

**Host 1:**  
Host IP: 191.177.76.26

```
sudo python3 clear_setup.py --full True --network sandbox
sudo bash multi_host_host1_generation.sh
sudo python3 start_indy_node.py Node1 0.0.0.0 9701 0.0.0.0 9702
```

To check node information and to restart stopped node

```
sudo python3 validator_info.py
sudo bash restart_indy_node.sh
```

**Host 2:**  
Host IP: 22.185.194.102

```
sudo python3 clear_setup.py --full True --network sandbox
sudo bash multi_host_host1_generation.sh
sudo python3 start_indy_node.py Node2 0.0.0.0 9703 0.0.0.0 9704
```

To check node information and to restart stopped node

```
sudo python3 validator_info.py
sudo bash restart_indy_node.sh
```

**Host 3:**  
Host IP: 247.81.153.79

```
sudo python3 clear_setup.py --full True --network sandbox
sudo bash multi_host_host1_generation.sh
sudo python3 start_indy_node.py Node3 0.0.0.0 9705 0.0.0.0 9706
```

To check node information and to restart stopped node

```
sudo python3 validator_info.py
sudo bash restart_indy_node.sh
```

#### Behind the Scene

At the very beginning, every host has to initialize it’s node with seed value and has to share it’s public information with others.

After that we have to create a domain ledger genesis file with stewards and trustees public information.

Next we have to create a pool ledger genesis file with nodes and stewards public information. Besides that, we have to provide node names, node to node communication ports, node to clients communication ports, node numbers, node IPs, network name etc.

After finishing the domain ledger genesis file and pool ledger genesis file, every host is ready to start it’s node.

Every actor/component has to generate it’s public information with secret seed value and every actor/component has to keep the seed value secret for security purposes. For that reason, we have to use get\_did\_and\_verkey.py and init\_indy\_node.py file and have to share public information via agents or other mediums.

For single host pluggable setup, we have to modify single\_host\_generation.sh file and for multi hosts pluggable setups, each host has to write it’s own generation file.

#### Testing with SDK Applications

Here we’ll be using an **Indy SDK API** (as provided by libindy) instead of an app, so we can see what happens behind the scenes.

We can follow the following links to know more about “Indy Story Walkthrough”

Link: [https://hyperledger-indy.readthedocs.io/projects/sdk/en/latest/docs/getting-started/indy-walkthrough.html#indy-walkthrough](https://hyperledger-indy.readthedocs.io/projects/sdk/en/latest/docs/getting-started/indy-walkthrough.html#indy-walkthrough)

[Indy Walkthrough - Hyperledger Indy SDK documentation](https://hyperledger-indy.readthedocs.io/projects/sdk/en/latest/docs/getting-started/indy-walkthrough.html#indy-walkthrough)

Link: [https://medium.com/@kctheservant/exploring-hyperledger-indy-through-indy-dev-example-10075d2547ae](https://medium.com/@kctheservant/exploring-hyperledger-indy-through-indy-dev-example-10075d2547ae)

[Exploring Hyperledger Indy through indy-dev Example](https://medium.com/@kctheservant/exploring-hyperledger-indy-through-indy-dev-example-10075d2547ae)

Go to any of host machine and you will find pool\_transactions\_genesis file into following directory:

“/var/lib/indy/sandbox/pool\_transactions\_genesis”

You can also get pool transactions by going to “indy\_network” directory and by executing read\_ledger.py file.

Now we have to share the pool\_transactions\_genesis file with others via agents or other mediums.

Please go to “indy\_sdk/src/utils.py” file and fix the “pool\_genesis\_txn\_data()” functions return value according to the pool\_transactions\_genesis file.

Now from “indy\_sdk” directory call “sdk\_sample.py” to witness the end to end application demo with Indy SDK. Be careful about putting the steward seed value at “sdk\_sample.py” file because we have to use one of our stewards credentials that we use during the network development process.

```
python3 -m src.sdk_sample
```

![](https://cdn-images-1.medium.com/max/744/0*32cRhPqbECeJAUqW)<figcaption>Indy SDK demo</figcaption>

If you face any problem like “Wallet already exists”, “Pool already exists” etc to witness the end to end application demo with Indy SDK then please clear the “.indy\_client” folder from your Home directory.

### Summary:

This blog is written only for learning purposes and we try to develop Hyperledger Indy customized blockchain network without sharing any private information. We hope this blog will be helpful for you and also expect your valuable reviews so that we all can have a chance to learn from you.

#### Also, Read

- [Learn about Ethereum and Web3](https://blog.coincodecap.com/go/learn)
- [Crypto Trading Bots](https://medium.com/coinmonks/whats-the-best-crypto-trading-bot-in-2020-top-8-bitcoin-trading-bot-c16adeb13317)
- [3Commas Review](https://medium.com/coinmonks/3commas-review-an-excellent-crypto-trading-bot-2020-1313a58bec92)
- [AAX Exchange Review](https://medium.com/coinmonks/aax-exchange-review-2021-67c5ea09330c) | Referral Code, Trading Fee, Pros and Cons
- [Deribit Review](https://medium.com/coinmonks/deribit-review-options-fees-apis-and-testnet-2ca16c4bbdb2) | Options, Fees, APIs and Testnet
- [FTX Crypto Exchange Review](https://medium.com/coinmonks/ftx-crypto-exchange-review-53664ac1198f)
- [NGRAVE ZERO review](https://medium.com/coinmonks/ngrave-zero-review-c465cf8307fc)
- [Bybit Exchange Review](https://medium.com/coinmonks/bybit-exchange-review-dbd570019b71)
- [3Commas vs Cryptohopper](https://medium.com/coinmonks/cryptohopper-vs-3commas-vs-shrimpy-a2c16095b8fe)
- The Best Bitcoin [Hardware wallet](https://medium.com/coinmonks/the-best-cryptocurrency-hardware-wallets-of-2020-e28b1c124069?source=friends_link&sk=324dd9ff8556ab578d71e7ad7658ad7c)
- [Crypto Copy Trading Platforms](https://medium.com/coinmonks/top-10-crypto-copy-trading-platforms-for-beginners-d0c37c7d698c)
- Best [monero wallet](https://blog.coincodecap.com/best-monero-wallets)
- [ledger nano s vs x](https://blog.coincodecap.com/ledger-nano-s-vs-x)
- [Bitsgap vs 3Commas vs Quadency](https://blog.coincodecap.com/bitsgap-3commas-quadency)
- The Best [Crypto Tax Software](https://medium.com/coinmonks/best-crypto-tax-tool-for-my-money-72d4b430816b)
- [Best Crypto Trading Platforms](https://medium.com/coinmonks/the-best-crypto-trading-platforms-in-2020-the-definitive-guide-updated-c72f8b874555)
- Best [Crypto Lending Platforms](https://medium.com/coinmonks/top-5-crypto-lending-platforms-in-2020-that-you-need-to-know-a1b675cec3fa)
- [Ledger Nano S vs Trezor one vs Trezor T vs Ledger Nano X](https://blog.coincodecap.com/ledger-nano-s-vs-trezor-one-ledger-nano-x-trezor-t)
- [BlockFi vs Celsius](https://medium.com/coinmonks/blockfi-vs-celsius-vs-hodlnaut-8a1cc8c26630) vs Hodlnaut
- [Bitsgap review](https://medium.com/coinmonks/bitsgap-review-a-crypto-trading-bot-that-makes-easy-money-a5d88a336df2) — A Crypto Trading Bot That Makes Easy Money
- [Quadency Review](https://medium.com/coinmonks/quadency-review-a-crypto-trading-automation-platform-3068eaa374e1)- A Crypto Trading Bot Made For Professionals
- [PrimeXBT Review](https://medium.com/coinmonks/primexbt-review-88e0815be858) | Leverage Trading, Fee and Covesting
- [Altrady review](https://blog.coincodecap.com/altrady-reivew)
- [Ellipal Titan Review](https://medium.com/coinmonks/ellipal-titan-review-85e9071dd029)
- [SecuX Stone Review](https://blog.coincodecap.com/secux-stone-hardware-wallet-review)
- [BlockFi Review](https://medium.com/coinmonks/blockfi-review-53096053c097) | Earn up to 8.6% interests on your Crypto
- [Best Crypto APIs](https://medium.com/coinmonks/best-crypto-apis-for-developers-5efe3a597a9f) for Developers
- [Best Blockchain Analysis Tools](https://bitquery.io/blog/best-blockchain-analysis-tools-and-software)
- [Crypto arbitrage](https://medium.com/coinmonks/crypto-arbitrage-guide-how-to-make-money-as-a-beginner-62bfe5c868f6) guide: How to make money as a beginner
- Best [Crypto Charting Tool](https://medium.com/coinmonks/what-are-the-best-charting-platforms-for-cryptocurrency-trading-85aade584d80)
- What are the [best books to learn about Bitcoin](https://medium.com/coinmonks/what-are-the-best-books-to-learn-bitcoin-409aeb9aff4b)?

> [Get Best Software Deals Directly In Your Inbox](https://medium.com/coinmonks/newsletters/coinmonks)

[![](https://cdn-images-1.medium.com/max/584/1*BoDnKUyK8p4hitHAJZ5Pdw.png)](https://medium.com/coinmonks/newsletters/coinmonks)

* * *