Deploy Business Network Archive (.bna) files to your IBM Blockchain
Let me get real with you for a moment! The world of business and networking is dynamic and changes every minute of your workspace. Your performance either boosts or breaks. That being said, it is highly recommended and rather essential for business associates to create a stable and reliable Business Network Definition to experience a profitable and sustainable growth in business.
So in this post, I’m going to tell you how you can instantly create an effective Business Network Archive (.bna) using IBM Blockchain Platform.
What is a Business Network Archive?
Creating an effective Business Network Archive is very important for deploying and updating Business Networks. Before a business network definition can be deployed it must be packaged into a Business Network Archive (.bna) file. The composer archive creates command is used to create a BNA file from a root folder on disk. Once this .bna file has been created, it can be deployed to a runtime using the composer network deploy command using a suitable Connection Profile. This connection profile can be easily created using the IBM Blockchain Platform.
What is IBM Blockchain Platform?
IBM Blockchain Platform is basically a developer tool that will help you create a Business Network Definition, which can then be packaged up into a .bna file (Business Network Archive). This helps create a developer environment which allows you to deploy .bna files to a local or IBM Blockchain Platform Service on IBM Cloud for development and sharing.
Before You Start: Prerequisites
You will first need to install the preliminary Composer Development Environment to create the required business network archive (.bna) file. You can search on the Internet and read about the installation of Installing Hyperledger Composer. This Hyperledger documentation also provides guidance on writing your business network.
You will also need access to an Enterprise Service instance on IBM Cloud. For this you will have to register an account at Bluemix.net and then create a service via the IBM Blockchain Service.
How to create a connection.json file for your IBM Cloud Blockchain Service?
First and foremost you will need to create a directory to store your Bluemix connection details,
When you set up the Local Development Environment you should keep in mind that you already should have created part of this directory structure. If you are developing on a Mac, for example, you will already have a directory structure.
You can search for “Installing a development environment” if you have yet to do this.
Always remember that each connection profile should contain a jsonfile.
Now create a new directory under the .composer-connection-profiles, for the IBM Cloud Service instance. This will be the name of the profile that you will use when working with Hyperledger composer and your IBM Blockchain Platform service.
mkdir -p ~/.composer-connection-profiles/bmx-hlfv1
The directory structure you create should look like /Users/myUserId/.composer-connection-profiles/bmx-hlfv1
Now create a file in this newly created directory using your favorite editor and name it connection.json.
You can use the following as a code template for your jsonfile.
From your IBM Blockchain Platform dashboard on IBM Cloud, select “Overview” from the navigation menu on the left panel. Then click on the “Service Credentials” option to display the information for the members of the channel where you want to deploy your business network archive.
Essential IBM Blockchain options and customizations
Once you have set up your connection.json file on your Blockchain Platform, you will need to know more about the important and relevant tweaks and modifications of various important options.
You may have multiple orderers in your Service Credentials, but only one orderer is required for your connection.json file. Just replace the orderer url values in the template like mentioned below.
Modify this “url” value with your service credentials and information.
CA (Certificate Authority)
Now modify the Certificate Authority value in your connection.json with both the url and the caName in the Certificate Authorities section.
Now we need to set the url for each Peer requestURL and eventURL. This is quite simple, just modify the connection.json file and replace the url attribute with the url value with the eventUrl found in your Service Credential.
Your event URL should look similar to this, although your ports and host address should be different.
For each orderer and peer on the IBM Blockchain Platform, there is a tlsCACerts attribute which all contain the same certificate. This attribute is a dummy value by default. You will need to replace this dummy value in the connection.json file template with the tlsCACerts value. It should look like this.
How to prepare peers by uploading the certificate to provide administrative authority?
One important prerequisite for taking this forward is that you must perform this step first before creating your channel. You won’t be able to start the business network without doing so.
First, you should request certificates for an identity that is a member of your Membership Service Provider (msp). This should be an attribute registrar containing attributes for enrollIdand For example:
Saurabh Mukhekar is a Tech Blogger from Pune, India. He is also thinker, maker, life long learner, hybrid developer, edupreneur, mover & shaker. He’s captain planet of BlogSaays and seemingly best described in rhyme. Follow Him On Facebook