Deploying a Hyperledger Composer blockchain business network to Hyperledger Fabric.


I developed a simple Blockchain App as part of the Hackathon in India Dapp conference held at Bangalore in May 2019. The Idea was to Design a private Blockchain to Decentralize Flight information Database of the Airlines.

Private Permissioned Blockchains is the new Buzzword, With Linux Foundation’s Hyperledger project the transactional networks of today are completely revolutionized and this project has created standard methods for establishing identity on the network, executing transactions, and storing data.

All the code can be found on my Github here

Hyperledger Composer is a set of collaboration tools for building blockchain business networks that make it simple and fast for business owners and developers to create smart contracts and blockchain applications to solve business problems. Built with JavaScript, leveraging modern tools including node.js, npm, CLI and popular editors, Composer offers business-centric abstractions as well as sample apps with easy to test devops processes to create robust blockchain solutions that drive alignment across business requirements with technical development. Source

The Steps involved in making the App

Hyperledger Fabric is private and permissioned. Rather than an open permissionless system that allows unknown identities to participate in the network the members of a Hyperledger Fabric network enroll through a trusted Membership Service Provider (MSP).

Simplified Hyperledger Fabric Architecture

Setting up Development environment ==> Click

Defining Model:

Asset==> Flight details like Flight Number, Location, Working state, Flight Type, EmployeeId of the updater, Description.

Participants==> Employees responsible for updating the information.

Transaction==> Updating Location, Updater, Working state and Flight number.

To get Skeleton code and proper file structure run:

yo hyperledger-composer:businessnetwork

The Transaction logic is pretty simple, We are just changing the old values to new values and updating the employeeId.

Permissions.acl is a file to assign rights and duties to the participants, peers and admins. For Simplicity I have given all the rights to Admin and System.

Then we create the Banana file(.bna) using:

composer archive create -t dir -n .

In the same directory as the above files we’ll get a airline-network@0.0.1.bna file which is used to deploy the model on the running instance of hyperledger fabric for a single organisation.


Before continuing make sure that all the previous Network cards are removed from your wallet run: Source

rm -fr ~/.composer

We need to build a connection profile, creating a connection.json file to define and specify all of the information required to locate and connect to the Hyperledger Fabric network, for example the host names and ports of all of the Hyperledger Fabric network components.

I’m creating a single peer( the request port is 7051, Here we have specified our single CA( using the hostname localhost and the CA port 7054, Here, Our single orderer node ( using the hostname localhost and the orderer port 7050 and we also label this as The orderers object can contain multiple orderer nodes.

I have also specified the total organisation the peers the CA the orderer and channels along with client section and the timeout length to wait before committing.

Now we look for the Private and public key of the admin which were generated after running ./ We then copy those keys to our project directory, And now we are ready to create our Business network card for the Hyperledger Fabric administrator.

composer card create -p connection.json -u PeerAdmin -c -k 114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457_sk -r PeerAdmin -r ChannelAdmin

Next, We import the Business card into our wallet by running

composer card import -f PeerAdmin@Airline-network.card

Installing the Hyperledger Composer business network onto the Hyperledger Fabric peer nodes

composer network install -c PeerAdmin@Airline-network -a airline-network@0.0.1.bna

Starting the Blockchain

composer network start --networkName airline-network --networkVersion 0.0.1 -A admin -S adminpw -c PeerAdmin@Airline-network

When a blockchain business network is deployed, you must create at least one participant who will be a blockchain business network administrator. This participant is responsible for onboarding other participants into the blockchain business network. Here, we are specifying that we want to create a single blockchain business network administrator called admin.

-S specifies that our blockchain business network administrator admin will use an enrollment secret of adminpw to request a certificate and private key from the CA (Certificate Authority). When you specify this option, the name specified for the business network administrator must be an existing enrollment ID for a user that is already registered with the CA.

Importing the business network card for the business network administrator:

composer card import -f admin@airline-network.card


composer network ping -c admin@airline-network
Results for Network Ping

Now we have successfully deployed blockchain business network to an instance of Hyperledger Fabric for a single organization, including generating the necessary Hyperledger Composer configuration.

Let’s generate a REST server:

REST Server configuration

NOTE: Specify if you want to enable event publication over websockets=Yes

We can Generate A skeleton Angular 4 Application:

yo hyperledger-composer:angular
Angular 4 Application
REST server and npm start

This will create a proxy to the REST server and an app.js running npm start on that folder, And ultimately serve the Angular Application on

Angular 4 Application

We can add Assets, Participants and can invoke a Transaction all from this Angular 4 application,

Adding an Asset AI123 From Bengaluru due to arrive in Delhi.

Updated by emp01

With Functional Working State

Adding a Employee with EmployeeID emp01

I have also added another employee with EmployeeID of emp02

Invoking a Transaction and Committing it to the ledger

Invoking Transaction

After the Commit we have Flight No: AI456, Location: Delhi, Working State: Non Functional and UpdatedBy: emp02

Committed Transaction

For any Queries and Doubts leave a comment if you liked the blog clap clap and clap!


Deploying a Hyperledger Composer blockchain business network to Hyperledger Fabric. was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.