Category Archives: Blockchain fabric

Hyperledger workshop for z Systems customers

IBM and Vicom Infinity hosted a small group customer workshop for Hyperledger/blockchain.

During this workshop we explained basics of Hyperledger and blockchain services, use cases, then hosted hands-on labs to experience deploying Hyperledger fabric onto LinuxONE community cloud and ran marbles app demo, followed by Hyperledger Fabric-composer lab that clients could code/deploy actual blockchain network and run sample transactions.


Attached is the materials from the workshop.

Fabric to Marbles Lab – Alex Kim_revised 0516

Get your own Mainframe Hyperledger fabric and demo app running in no time

If you are considering implementing a blockchain applications with Hyperledger Fabric, where would you start from and where do you want to deploy it on?

There are various platform choices to run a Hyperledger fabric and its applications. You can have it on your own laptop/server, or a virtual/real machine on a cloud. But when it comes to an ‘enterprise grade’ platform, nothing compares to IBM z Systems™ and IBM LinuxONE™ for its highest level of security, scalability, high availability and performance.


IBM announced Enterprise-ready Blockchain service for Hyperledger Fabric v1.0 on its Bluemix cloud during Interconnect 2017 conference in March 2017. There are many informative sessions that are recorded and you can watch most of them online. You can find a good summary from this blog. I personally liked Ross Mauri’s keynote about blockchain service on HSBN and many others. He goes into the very key of security benefits of IBM HSBN services and explores the technical aspects of it too.


Now, you may already know but there is a free blockchain development environment for Hyperledger Fabric v1.0 available through IBM Bluemix™. If you are an application developer, IBM Bluemix for Hyperledger services is a good place to start and deploy blockchain as you don’t have to worry about maintaining complex infrastructure of blockchain services. It also comes with pretty good tools and SDK that you can jump right into development with other Bluemix services. But if you are an explorer who wants to try your own blockchain infrastructure on IBM z Systems™ or IBM LinuxONE™ without getting into your company’s mainframe, there is a way – and I will walk you thru step-by-step instruction how to implement Hyperledger Fabric v0.6 and run sample demo app(marbles) in ten minutes or more(depends on your skills and wait time for getting community cloud ready) .

First, you want to apply for a free 120-day LinuxONE server available through IBMLinuxONE Community Cloud here. Once you have an access to the server(or one of your on premise Linux on z Systems), follow the steps below to get the fabric running in no time.  I’ve tested it with SLES12 SP1 and RHEL 7.2, but if you experience any issues, please add comment below and I will try to answer as much as I can.


Thanks, and enjoy!

Yongkook(Alex) Kim


[1] Install/setup Hyperledger Fabric

Following steps will guide you to install/run Hyperledger Fabric on your server. You can either run it with {a single peer + membership services} OR {four peers + membership services}


1.1 Switch user to root:

During the lab, all the commands will be entered as ‘root’ user id unless specified otherwise. If you are not currently switched to root yet, please enter: ‘sudo su –‘  at the shell command line.

1.2 Pre-requisites (details in above link for installation guide)

git version 2.12 or higher (source management tool, git information)

Docker version 1.12 or higher (git information)

Docker-compose version 1.11.2 or higher  (follow steps in below site for s390x)

About Docker:

Docker is a container/virtualization technology and a key component of Hyperledger. It is not required to know during the lab but it is important to understand basics operations if you want to continue working with Hyperledger.

If you want to learn more about Docker, please refer to

There is a very nice all-inclusive playground website you can learn and try on Docker technology in here:

1.3 Clone docker-compose files and bring up the fabric

Change directory to where you want to copy Hyperledger fabric configuration files. For this lab go to /data:

Please enter ‘ cd /data ’,

and then enter ‘ git clone

Now you will see ‘git’ is cloning files from github site down to your local directory. Once you get prompt back, change directory to /data/fabric-images/docker-compose/

Enter ‘cd fabric-images/docker-compose


Once changed the directory,  enter ‘  .

-> make sure you enter dot(.) and space. This will check what HW platform the fabric will be running on. We are running on z Systems(s390x). Now bring up the fabric by entering following.

Enter ‘ docker-compose -f four-peer-ca.yaml up

Docker-compose is a command to invoke multiple docker images to bring up, and connect them together to make a ‘service’ or ‘services’. Note that you are bringing up a Hyperledger network with four peers and one membership services. You can also just have one peer + membership services if you specify ‘single-peer-ca.yaml’ instead of ‘four-peer-ca.yaml’.

Now you will see a lot of messages scrolling and most of time it is hard to see – not to worry about them for now. Once you see dockercompose_baseimage_1 exited with code 0(1st screenshot), and about a minute or so later you will see a message ‘Discovery knows about:’ for each peer.

Now Hyperledger fabric is ready to take an action! Let’s verify if the fabric is working with a quick command line interface commands.

1.4 Testing and verifying your local network using CLI interface


Now you have the Hyperledger fabric running, you want to test it out. There are many ways to test the network – command line interface(CLI), RestAPI tool like PostMAN, running a sample app and HFC SDK and we will show you each of cases.

Leave above shell window open, then open another shell window.

From command shell, enter ‘ docker ps ’, and now you will see there are four peers(vp0_1~vp3_1) and one membersrvc running as docker containers.

Enter ‘ docker exec -it dockercompose_vp0_1 bash

It will let you enter vp0 peer docker container with bash shell prompt.

Enter l following for a user “test_user0” to enroll who is already hardcoded in the membersrvc.yml file:

peer network login test_user0 -p MS9qrN8hFjlE

Deploying an example chaincode by entering following commands in sequence:

peer chaincode deploy -u test_user0 -p -c ‘{“Args”: [“init”,”a”, “100”, “b”, “200”]}’

peer chaincode invoke -u test_user0 -n ee5b24a1f17c356dd5f6e37307922e39ddba12e5d2e203ed93401d7d05eb0dd194fb9070549c5dc31eb63f4e654dbd5a1d86cbb30c48e3ab1812590cd0f78539 -c ‘{“Args”: [“invoke”, “a”, “b”, “10”]}’

peer chaincode query -u test_user0 -n ee5b24a1f17c356dd5f6e37307922e39ddba12e5d2e203ed93401d7d05eb0dd194fb9070549c5dc31eb63f4e654dbd5a1d86cbb30c48e3ab1812590cd0f78539 -c ‘{“Args”: [“query”, “a”]}’


Check out the Query Results after the last command. You can change the value for the second command and verify value changes using the 3rd command again.

[2] Running Marbles App

Assuming you completed the first lab successfully, we will deploy a sample app called ‘Marbles’. It’s a very intuitive GUI based blockchain app to create/trade marbles. Marbles represent assets, and whenever an asset gets created and traded, a new block will be created and shown in the console. You can ask your peers to connect to your website and simulate multi-user based blockchain network communication.

Following steps will guide you to install/run Marbles app demo for Hyperledger on your server. You can install Marbles app either locally or at the IBM Bluemix easily with instruction described in github below, but to minimize errors we will provide you an docker image already integrated with all components needed.

FYI, our implementation of Marbles app is a bit different from the original IBM Marbles. We(Vicom Infinity) modified GUI so that we can simulate four-peer blockchain network. We actually had a good summer intern spent a few weeks to work on it – he had no prior blockchain experience. Since HSBN and IBM Bluemix came with four peer networks, I thought to having four users may help people playing roles on each peer.

Again, this is the lab based on Linux for IBM z Systems™ or IBM LinuxONE ™, so the binary file for docker image is for s390x architecture. It was tested with SLES12 SP1 as well as RHEL7.2 and Ubuntu Xenial Xerus. If you like to get a docker image for x86, please contact us.

2.1 Map port 3000 to open and listen

Since we are using Docker container for the app and it connects to a local fabric also on docker containers, we will make marbles app to use host network and interface external ip address/port. To enable it we will need to enter following iptables command. If you like to know more about why please refer to this web site (

iptables -I INPUT  -p tcp -m tcp – -dport 3000 -j ACCEPT

(note for two dashes for – -dport)

2.2. Run marbles app using docker run

Now enter following command to download already installed marbles app from the docker hub, and invoke webservices.

From any directory enter:  docker run – -net=host likepunk/marbles (note for two dashes for – -net)

You will see following start-up logs. Wait until you see a message like —Websocket Up—

2.3. Play Marbles!

Now bring any web browser and type IP address of your server with port number 3000. If you don’t know your host server ip, then type following: ip addr show|grep eth0

Now connect to your marbles app using the ip shown above with port 3000 at the brower:

http://<your ip>:3000  and you will see Marbles web page shows as following:


Click on ‘CREATE’ on the center then create a marble asset of your choice

You can see a large green marble gets created, at the same time a new block is added to the blockchain. You can see it in action by clicking ‘VIEW TX BLOCKS’. It will show you details of the block(chaincode ID, payload etc).

Now try to switch ID to INFINITY(or ask other people to connect using another browser/PC or mobile device), and create marbles. You can move marbles by drag&drop.

Explorer further more with trading menu. To get more information about it please see below github site. There is also a newer version of Marbles app works with Hyperledger Fabric v1.0.



Extra Information/Debugging

If you experience an error that complains about Chaincode not being deployed in the fabric logs or Marbles app showing it can’t find the Hyperledger fabric, try insert following into ‘four-peer-ca.yaml’ file under fabric-images/docker-compose :


The error is due to the fabric takes too long to get the chaincode deployed unto its peer(timeout). As we are referencing the code from github, depends on the network condition it may exceed default time that was set to time out to wait. This never happened to me until there was an outage at AWS cloud a few months ago – I can’t prove anything but just strange it happened right after the outage(and git is one of the user of Amazon AWS =).

Once edited and saved, stop prior docker processes and remove all of the containers from cache by entering:


# docker stop $(docker ps -a -q)

# docker rm -f $(docker ps -a -q)


After you get the prompt back, type following commands to bring up the fabric as well as run marbles demo(you will need two shell screens).


# docker-compose -f four-peer-ca.yaml up

# docker run – -net=host likepunk/marbles