Let’s start building an example network that consists of three organizations (Org1, Org2 & Org3). Each of these organizations contribute two peers. The ordering service part of a network should consists of few Orderer nodes but to keep this example simple we will use only one (solo) node as shown in the diagram below. However at this point of time there is no trust relationship between the organizations and the network entities that they are providing.
In Fabric network the authenticity, confidentiality and privacy of the transactions amongst the participants is ensured by using asymmetric cryptography and chain of trust. In simple words, we need a certificate authority that issues identities to the participants so that they can trust each other.
Fabric provides a tool called cryptogen (Crypto Generator) that is able to generate the certificates for the participating organizations and the entities contributed by them.
Before we look at how to use cryptogen we need to download it. The script provided by Hyperledger Fabric project at present downloads many other tools as well as required docker images so it may take few minutes depending on your network connection.
curl -sSL https://goo.gl/iX9dek | bash
Above command will figure out the operating system and the architecture of your machine & will download appropriate binaries and docker images. After the successful execution of above script you should have a folder named bin in the directory in which you executed the script. The bin folder will contain the cryptogen tool.
The cryptogen tool accepts a yaml file as an input where the participants and the entities offered by them are specified.
In this yaml file we have specified an orderer (since we are using solo ordering service) and peers for Org1, Org2 and Org3. The PeerOrgs/Template/Count field in the file indicates the number of peers for an organization. In this example we have used the value 2 so we would have following peers:
Time to generate the certificates.
cryptogen generate --config=./crypto-config.yaml
The successful generation should result in a folder called crypto-config with a structure as shown below:
We now have necessary certificates and crypto materials for the various entities of our network however we have not yet configured or specified them to use.
This is the first part of the series on Hyperledger Fabric project. I am assuming here that you are familiar with the BlockChain technology in general and understand the problems that it solves.
While the primary focus of existing BlockChain technologies has been crypto-currencies there are multiple use cases that are not necessarily limited to the finance related applications. Hyperledger is a collection of various BlockChain projects with the primary goal of addressing the cross-industry needs and requirements. At present, they have decided to not try to define a standard for BlockChain but rather act as an umbrella for various open source implementation of BlockChain technologies. Hyperledger Fabric is one such project under this umbrella that has been contributed by IBM.
Here are some very high level goals of Hyperledger Fabric project:
Private and Permissioned. This is interesting for networks that would like to have finer control over who can participate in the network and also enables the possibility of using consensus algorithms that may not be as compute intensive as the one ( i.e. ‘Proof of Work’) used by Bitcoin.
Extensible & Pluggable architecture. The Hyperledger Fabric based BlockChain network consists of various components. It is one of the objective that the underlying algorithms and technologies used by these components should be easily replaceable based on the use cases.
Smart Contracts. Define a framework for writing the Smart Contracts. It is essentially the software that has read/write permissions to the distributed ledger. In Fabric a Smart Contract is called chaincode.
Privacy of participants in the network. There are scenarios where few participants in the network will want to transact privately such that other participants will not have details about the transaction.
Hyperledger Fabric Model provides more detailed information about these goals.
With key goals defined let’s talk about the actors in a typical Hyperledger Fabric network.
Orderer Nodes. As the name implies these nodes are responsible for providing the ordering of transactions. As per Fabric architecture the ordering algorithms can be easily replaced. At present the default implementation is based on Apache Kafka.
Peer Nodes. These nodes are responsible for executing and validating the transactions. This is where the business logic is executed using chaincode. These nodes also maintain the ledger (World State & Transaction Log).
Client Node. This is essentially a client application that connects to the peers and orderer nodes. The communication protocol is defined using gRPC which enables you to write the client applications in the language of your choice however for ease of development the project is providing SDKs written using various languages (NodeJS, Java, GoLang, Python etc)
Hyperledger Fabric wiki has an excellent documentation that goes in detail of concepts, goals and architecture. In the next few blog posts I would write about bootstrapping a Fabric network from the group up.