Configuring a Hyperledger Fabric network built with a Kubernetes cluster and Example02 chaincode

Download the Example02 chaincode from GitHub (this was automatically deployed in the previous steps, but you can take a closer look to find out how this happens).

How the Example02 chaincode is deployed in the IBM Blockchain tutorials

Look at the create_all.sh script that you ran in the ‘Bootstrap your blockchain network’ tutorial. You can see that chaincode named Example02 is deployed and then instantiated.

The create_all.sh script calls the chaincode_install.sh script from the create folder, which in turn calls

kubectl create -f ${KUBECONFIG_FOLDER}/chaincode_install.yaml.

Check the contents of the chaincode_install.yaml file to find the location of the chaincode that you want to deploy.

In this case, the location is github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02/.

If you would like to deploy your own chaincode you need to update the command section within the chaincode_install.yaml file. You can either clone and deploy from your own github location or deploy from a local location.

Once the chaincode is up and running in your Kubernetes cluster, you can start configuring your IBM MQ Bridge to blockchain.

You need several parameters from your configuration file to allow the bridge to successfully connect to your Example02 blockchain network.

First you need the location and port for each of the blockchain entities. You can get the host and ip address for the CA, Orderer, Peer, and EventHub for your instance of Kubernetes, by running the following command and extract the Public IP address:

You can find the default ports for each blockchain entity that is used in the example deployment, in the kube_configs/blockchain-services.yaml file. The “nodePort” in each case is the publicly facing port that your IBM MQ Bridge to blockchain will connect through. The port numbers are:

CA: 30000

Orderer: 31010

Peer: 30110

EventHub: 30111 (the port against the peer for “name: events”)

Next you need the OrgMSPId and OrgName values. You can find them in the create_all.sh script where the channels are defined: PEER_MSPID="Org1MSP".

Finally you need the enrolment credentials to connect to the CA with. These are “admin:adminpw”, as defined in the sampleconfig/cas/ca.yaml file.

You should now be able to configure your MQ Bridge to blockchain to connect to your blockchain Kubernetes instance.