Hyperledger Composer is an application development framework tool used for creating blockchain applications and smart contract that can finally get executed in platforms such as Hyperledger Fabric Blockchain. Composer mainly emphasis on delivering a business solution quickly using a business-centric terminology. Using business use case like assets, transactions, participants composer has to build certain API to invoke transaction that creates, update and delete assets and transfer between the participants that occur within the business networks. With the help of a hyper ledger composer, it becomes easy to integrate to the blockchain with the current business process and system of records.

Hyperledger composer mainly helps to work with the current Hyperledger infrastructure, by using some pluggable consensus protocols in the blockchain, which will confirm that the transaction is valid according to the protocol implemented by parties on the network.

The composer uses a web browser-based User Interface called Composer Playground. The playground is available in both online and offline versions. In the online version, we can directly use the playground, there is no need for any installation. On the other hand, in offline we can use them as our local host network, where editing and testing of sample business networks are made easily possible.





How to install a development environment

Installing the components needed to RUN Fabric.

Please go through the blog for Installing prerequisites: https://www.blockchainexpert.uk/blog/installing-hyperledger-composer-playground

Or you can use the below steps for Installing the components needed to RUN Fabric.

Step 1:

Firstly we need to install CLI tools. The most important tool we need is composer-cli which is useful in a development environment.

Note that don't use sudo or su command use the below command as a normal user.

npm install -g composer-cli@0.20

Here we are using version 0.20. You can download the latest version available.

Install other npm node packages

npm install -g generator- hyperledger -composer

npm install -g composer-rest-server

npm install -g yo

Step 2:

Install the composer playground offline to run and test a business network.

npm install -g composer-playground@0.20

Step 3:

In the next step install hyper ledger fabric. This installation will help you to create a local environment for the business network.

Run the below command by making a directory as fabric-dev-servers





mkdir ~/fabric-dev-servers && cd ~/fabric-dev-servers



curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz

tar -xvf fabric-dev-servers.tar.gz

unzip fabric-dev-servers.zip

./downloadFabric.sh



After downloading fabric now you can start fabric:

./startFabric.sh

Starting Hyperledger Fabric

For stopping fabric: ~/fabric-dev-servers/stopFabric.sh Then create a peer admin card using the command ./createPeerAdminCard.sh







Open composer playground

Test your Blockchain application on the composer playground. The Composer playground will help to create a .bna file

https://www.blockchainexpert.uk/blog/installing-hyperledger-composer-playground

Or you can manually create .bna file and can import

How to deploy a .bna file in Hyperledger Fabric using Composer playground

Here taking a sample bna file from composer playground animal tracking-network.

Install the PeerAdmin card to .bna file that you have created by using the command:

composer network install --card PeerAdmin@hlfv1 -a animaltracking-network.bna







composer network start composer network start -c PeerAdmin@hlfv1 -n animaltracking-network -V 0.2.6-deploy.2 -A admin -S admin







Composer card import composer card import -f admin@animaltracking-network.card











Interfacing with blockchain using composer:

Hyperledger composer uses a Node.js that can expose a business network as a REST API. To develop web-based application REST API is used. To launch the REST Server simply type: