Public Repository

Last pushed: 2 years ago
Short Description
Hyperledger peer for ClefOS on s390x
Full Description

Notice regarding the Linux Foundation's Hyperledger project

The openblockchain project is IBM's proposed contribution to the Linux Foundation's Hyperledger project. We have made it available as open source to enable others to explore our architecture and design. IBM's intention is to engage rigorously in the Linux Foundation's Hyperledger project as the community establishes itself, and decides on a code base. Once established, we will transition our development focus to the Hyperledger effort, and this code will be maintained as needed for IBM's use.

While we invite contribution to the openblockchain project, we believe that the broader blockchain community's focus should be the Hyperledger project.

Openchain - Peer

The steps for running a sample application using this container are described on this page. If you do not have access to a z Systems machine with Linux installed, you can obtain a 90 day LinuxOne cloud instance on the IBM LinuxONE Community Cloud in just minutes.


This project contains the core blockchain fabric. Further information:


  1. Your firewall rules may require updating to allow traffic on ports 4243, 5000, and 30303
  2. Depending on the number of peers you start you may need to enable memory overcommit: sysctl vm.overcommit_memory=1

Building the project

Assuming you have followed the development environment getting started instructions

Testing your container

This section describes the steps to exercise the container.

Starting the Daemon

Hyperledger interacts with the daemon to create containers on the fly so it needs some specific options when invoked:

docker daemon -D -g /var/lib/docker -r=true --api-enable-cors=true -H tcp:// -H unix:///var/run/docker.sock

Where -

Option Description
-D Enter debug mode (optional but you get lots of messages)
-g /data/docker Root of the Docker runtime
-r=true Restart container if daemon is restarted
--api-enable-cores Enable cross origin requests
-H Daemon socket(s) to connect to

Starting the First Peer

We give this peer the id of vp1. The OPENCHAIN_VM_ENDPOINT environment variable specifies the IP address (referred to later as <ipaddress>) found by issuing (assuming the docker daemon created the docker0 interface):

ifconfig docker0
docker0   Link encap:Ethernet  HWaddr 56:84:7a:fe:97:99  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::5484:7aff:fefe:9799/64 Scope:Link
          RX packets:832417 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1088069 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:197601454 (188.4 MiB)  TX bytes:2226944975 (2.0 GiB)

Use this address to start the first peer:

docker run --rm -it --name=vp1 -e OPENCHAIN_VM_ENDPOINT=http://<ipaddress>:4243 -e OPENCHAIN_PEER_ID=vp1 -e OPENCHAIN_PEER_ADDRESSAUTODETECT=true brunswickheads/openchain-peer obc-peer peer

Obtain this peer's IP address (referred to later as <vp1ip>) by using:

docker inspect --format '{{ .NetworkSettings.IPAddress }}' vp1

Starting the Other Peers

We can then start 1 or more peers with IDs of vp2, vp3, ... in other sessions. The IP address specified in OPENCHAIN_VM_ENDPOINT is that (<ipaddress>) and OPENCHAIN_PR_DISCOVERY_ROOTNODE is that of the first peer (<vp1ip>).

docker run --rm -it -e OPENCHAIN_VM_ENDPOINT=http://<ipaddress>:4243 -e OPENCHAIN_PEER_ID=vp2 -e OPENCHAIN_PEER_ADDRESSAUTODETECT=true -e OPENCHAIN_PR_DISCOVERY_ROOTNODE=<vp1ip>:30303 brunswickheads/openchain-peer obc-peer peer


To deploy we can start another container and run obc-peer commands.

Start a Peer running bash

docker run --rm -it -e OPENCHAIN_PEER_ADDRESS=<vp1ip>:30303 brunswickheads/openchain-peer bash

Deploy Chaincode

At the prompt:

obc-peer chaincode deploy -p -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'

Then use the $NAME (<name1>) it returns to begin querying and invoking chaincode:

bash> export NAME1=<name1>
bash> obc-peer chaincode query -l golang -n $NAME1 -c '{"Function": "query", "Args": ["b"]}'
bash> obc-peer chaincode invoke -n $NAME1 -c '{"Function": "invoke", "Args": ["a", "b", "3"]}'
Docker Pull Command