In IBM MQ Bridge to blockchain Part 1 post, we talked through the steps for setting up a local Hyperledger Fabric network that we then connected to with the version 904 IBM MQ Bridge to blockchain.

In this post we’ll talk through a different option for creating a blockchain network, this time with a Kubernetes cluster that runs in IBM Cloud.

As a reminder, we tested the 904 bridge with two example networks:

  • A Local Hyperledger Fabric network built with Docker and the Fabcar sample.
  • A Kubernetes container cluster network with the Example02 sample.

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

Work through all the steps in these IBM Blockchain tutorials:

  1. Prepare and set up a cluster with the IBM Container service.
  2. Bootstrap your blockchain network.
  3. Interact with your blockchain (Step 1 only).
  4. 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 script that you ran in the ‘Bootstrap your blockchain network’ tutorial. You can see that chaincode named Example02 is deployed and then instantiated.

The script calls the 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

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.

Configuring the IBM MQ Bridge to blockchain to connect to your Kubernetes blockchain network

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:

$ bx cs workers blockchain
ID                        Public IP        Private IP      Machine Type   State    Status   Version   
kube-hou02-pa48...61-w1   111.222.333.444   free           normal   Ready    1.7.4* 

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 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.

Next steps

To drive your deployed chaincode (Example02) see the IBM MQ Knowledge Center topic Running the IBM MQ Bridge to blockchain client sample, and the Message formats for the IBM MQ Bridge to blockchain topic where example JSON messages are shown for driving the Example02 chaincode along with the example JSON replies.

See Configuring IBM MQ for use with blockchain for more information on the MQ Blockchain bridge in general.

Join The Discussion

Your email address will not be published.