If you’re developing a Hyperledger Composer based solution for your use-case then at some point you’ll have to make changes to the underlying Hyperledger Fabric settings to optimize your solution’s performance. Perhaps the most important of these settings are the Block Parameters, or the Block Size & Block Timeout fields.

Simply put, these Block Parameters define when a new block is going to be added to the blockchain. There are 2 conditions for that, either the size of the transactions that are being bundled into a single block reaches that of the Block size, or if the defined Block timeout is reached (the time starts when the first transaction is received for a new block)

Lets get straight into it. For this tutorial we’re assuming you’re using the default fabric-dev-servers to fire up your fabric for Hyperledger Composer.

To make this work, you’ll need a couple of Fabric binaries called cryptogen and configtxgen. These can be found in the bin folder of fabric-samples directory. For simplicity, just copy these two from there and paste in fabric-dev-servers/fabric-scripts/hlfv12/composer folder.

Now, open the configtx.yaml file in this directory and go down to the Orderer portion of the file which would look something like this:

Here, make your desired changes to Batch Timeout, MaxMessageCount, AbsoluteMaxBytes or PreferredMaxBytes. Once you’ve made your changes save the file and exit.

Now, delete the Crypto-Config folder in this directory. This folder contains all the cryptographic material related to your network, but we’re going to build it again after making our changes so all these values will be new.

Once that is done, run the following commands from the terminal in the same folder.

./cryptogen generate --config=./crypto-config.yaml
./configtxgen -profile ComposerOrdererGenesis -outputBlock ./composer-genesis.block
./configtxgen -profile ComposerChannel -outputCreateChannelTx ./composer-channel.tx -channelID composerchannel

You have successfully generated a new network according to your desired Block settings! Now we have to integrate the changes with composer.

There will be a new formed crypto-config folder in your directory now. Change directory to


and copy the name of the file that ends with _sk like 200dfcb9e7f76fc8cd94b393ac480f597e262486297943653f8ef25e668f4d07_sk
Now go back into the composer folder and open the docker-compose.yml file.

In this file, there are CA configs at the top and there you have to find this line

command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/200dfcb9e7f76fc8cd94b393ac480f597e262486297943653f8ef25e668f4d07_sk -b admin:adminpw -d'

and change the ca.keyfile here with the name of the keyfile that we just copied. Remember, the filename must end with _sk. Once this done, save & exit.

Now for the final step, go to


and copy the name of the keyfile there.Again it would be ending in _sk.

Once you’ve copied it, go back to the composer folder and go one directory up to the hlfv12 directory. Now open the createPeerAdminCard.sh script in an editor, and look for a line like this towards the end of the file


and replace the value of the key file (_sk) with the one that you copied. After doing that save the file and you’re ready to go!

Delete your existing card directory by doing

rm -rf ~/.composer

And then run the createPeerAdminCard script by doing


Once your card is successfully created, start your fabric network by doing


and now you can install your Business Network on Fabric!

If you’re still confused about any part related to changing parameters in Hyperledger Composer, feel free to contact our Blockchain development company .

Tags: , , ,