Architecture of a Hyperledger Fabric Based DApp

March 12, 2019 By: Himanshu Malviya

As Blockchain for business gathers steam, different frameworks have come up to cater to varied business requirements. While the underlying use of Blockchain-based ledger to store data immutably remains consistent across platforms, the architecture of each framework varies significantly.

Hyperledger Fabric, Quorum, Ethereum are some of the frameworks under active development. Of these, Fabric has been developed to provide a foundation for developing applications or solutions with a modular architecture.

One of the major distinctions of Fabric is that it underpins for a permissioned blockchain unlike the multitude of permission-less blockchain frameworks. Its architecture, therefore, merits a closer inspection.

A typical implementation of Hyperledger Fabric begins with the setting up of nodes. The number of nodes depends upon the number of organizations (separate entities) participating. Each organization has a certificate authority and each node of the organization may or may not have a copy of the ledger depending on the type of node. Apart from all these, a specific set of ordering nodes has to be deployed to take care of communication between nodes. All deployments including certificate authority and databases for each node take place in separate docker containers.

The Three Fundamental Types of Nodes

Committing Node: Maintains ledger and state. Commits transactions. May hold smart contract (chaincode).

Endorsing Node: Specialized committing peer that receives a transaction proposal for endorsement, responds granting or denying endorsement. Must hold smart contract.

Ordering Nodes (service): Approves the inclusion of transaction blocks into the ledger and communicates with committing and endorsing peer nodes. Does not hold the smart contract. Do not hold the ledger.

Implementation of Permissioned Nature of Blockchain

For interacting with the network, identity needs to be created which is issued by the Certificate Authority. The identity is created using the private key of the particular node and a public certificate of the certificate authority. The security artifacts are generated using the cryptogen tool.

The certificates follows X.509 standard and the infrastructure is analogous to Public Key Infrastructure.

Hyperledger Fabric also provides the facility to implement any other method to establish identity.

Flow in Hyperledger Fabric

Once a network has been setup, and smart contracts have been installed, the following chain of events occur for a successful event.

  • Client application sends a transaction proposal using organization specific REST APIs.
  • The fabric runtime receives a transaction proposal and sends it to the endorsers for execution.
  • Endorsers execute the transaction and prepare read/write sets and send it back to the SDK.
  • On verification of endorsement policy, read/write sets are sent to orderer nodes.
  • The orderer nodes collect transactions, prepare blocks and send it to committing nodes.
  • The committing nodes append it to the blockchain database.

Hyperledger Tools for Development

Hyperledger Foundation also provides two pluggable tools to speed up development.

Hyperledger Composer: The smart contracts (chain code) which contain the business logic can be developed using Composer and deployed as a packaged BNA (Business Network Archive) file. The integrated modeling language provided considerably speeds up development. Moreover, Composer helps in the easy development of the rest server to interact with the network.

Hyperledger Explorer: This tool can be integrated with a running blockchain network to have a blockchain explorer functionality. The tool provides view-only access to all blocks as well as other information about the network. The transaction data, however, remains encrypted.

Chatbot Aria

Hello, I am Aria!

Would you like to know anything in particular? I am happy to assist you.