Table of Contents
Hyperledger Composer is an open tool and a framework for making applications on the blockchain, easier. Composer gives you the ability to model you business network and deploy it in a blockchain solution in weeks rather than in months.
Hyperledger Composer:
Composer gets you up and running with REST API’s for you to integrate your existing systems and data with your blockchain applications.Hyperledger Composer has a support for the existing Hyperledger Fabric blockchain infrastructure and run time, which supports different types blockchain consensus protocols to ensure that transactions are validated according to the rules and policies put in place by the business network participants.
The Insertion Problem:
After you have created your business network and want to take it further and get it up and running for an industrial implementation. There was something we noticed during the insertion of a single record into the ledger. A single insertion in the REST API through a postman call would takes us about 2.3 seconds. When implemented into a real scenario. A submit button click in our Laravel based front hand application took 3 seconds before they could receive a response from composer in the HTTP header. Now the explanation to this is obvious but at time we didn’t think of it.
Explanation:
We all know how the blockchain works. Every transaction that you send to the blockchain first go through the consensus protocol defined and once its valid it is added to the block. Now before every block is added to the blockchain. The block has to wait a little to get as many transactions registered in itself as it can because adding a single block for every transaction would be very impractical.
Keeping this in mind we tried sending 50 transaction at once and that gave us the same 2 seconds waiting time before it gave us a success for all of those transaction at once. Hyperledger composer has a default block timeout of 2 seconds. Its a good thing when you are processing 100 records in 2 seconds but its not when u have to send a single record and wait for its success.
Solution:
There are multiple work a rounds to this solution, one of them being queuing records on your end and then sending them together to the blockchain or changing the default block timeout to a value of your choice which is less than 2 seconds. You can even set the block timeout to something in milliseconds.
If you want to learn about how to modify the block parameters in Hyperledger Composer then click here.
Another solution can be to shift your entire code from composer to fabric. It will be a little complicated to shift it but once shifted. Fabric is evolving day by day and brings in new features for there users to facilitate them.
If you want to create your business model to Hyperledger Composer or want your current composer model improved contact our blockchain development company.