Skip to Content

Build Business Blockchain using SCP , Hyperledger Composer and SCP Cloud Connector

Hello All,

Welcome to my blog , this blog is about how we can build Business Blockchain application on Hyperledger fabric using Hyperledger Composer framework and generate rest server which can be connected easily with SAP Cloud Platform using Classic SAP Cloud Connector and finally how seamlessly a application which runs on SAP Cloud Platform can interact with those API. Here i have taken a very simple example “Asset Transfer Between Participants” .


Asset Transfer Between Participants – In This Business Network we will have multiple participants and assets (It can be anything, E.G A mobile is a asset and it is holding by participant A) and Asset can be transferred to any participant in the Business Network.


Technical Architecture

As a Prerequisite you should know how business blockchain works , what is the difference between Business Blockchain and Crypto currency like Bitcoin , Ethereum  etc. In business blockchain we don’t deal with Proof of Work so mining is not require so don’t need high computation power also.  In Below Picture you will get some basic difference between Crypto currency blockchain and Hyperledger fabric.

Before going forward i would like to give little bit introduction about Hyperledger fabric and Hyperledger Composer or Fabric’s Composer.

What is Hyperledger fabric ?

Hyperledger Fabric is a blockchain framework implementation and one of the Hyperledger projects hosted by The Linux Foundation. Intended as a foundation for developing applications or solutions with a modular architecture, Hyperledger Fabric allows components, such as consensus and membership services, to be plug-and-play. Hyperledger Fabric leverages container technology to host smart contracts called “Chaincode” that comprise the application logic of the system. Hyperledger Fabric was initially contributed by Digital Asset and IBM, as a result of the first hackathon. Most Importantly SAP Cloud Platform Blockchain as a service (BAAS) is also based on Hyperledger fabric.

What is Hyperledger Composer ?

Fabric Composer is a new open-source application development framework, which simplifies the creation of Hyperledger Fabric blockchain applications. The tool aims at helping users to create blockchain applications based on Hyperledger Fabric without needing to know the low-level ( Go Programming )details involved in blockchain networks. If we want to build our blockchain application directly on Hyperledger fabric we have to write our Chaincode in GO or Java Programming Language which is comparatively different than JavaScript  where in composer its quite easy to code smart contract using Model file (.cto) and angular JavaScript.

To Build this demo i have used On-premise Hyperledger fabric which is Installed and running on Ubuntu 16.04 and on top of that i have installed Hyperledger Composer and Yoman . After building and deploying Business Blockchain (.bna) application into fabric i have generated composer rest api which i have connected with SAP Cloud Platform with help of Classic Sap Cloud Connector then built one  Sap ui5 application using Web IDE and deployed the ui5 application into SAP Cloud Platform.


Click here  you will get cool guide to setup your Hyperledger fabric and Composer dev environment for Linux and Mac both. Before setting up the Dev environment as a prerequisite you have to Download Prerequisite.

Lets get into stuff .

Step 1: First we have to create business network using yoman which will be creating intial structure of application (.cto , logic.js ) . In .cto file we define our asset , participant and transaction . In logic.js file we define our chaincode or smart contract or business logic for each transaction . In .acl (we have to create permission.acl file explicitly inside root project folder ) file we define security permission for each object.

yo hyperledger-composer:businessnetwork


Give all the details like name , description , license , author etc after that it will generate basic template of your business application.

Step 2: We have to define business network , mainly we need to model our .cto file as per our business model , in logic.js we have to put logic as per our need  and permission.acl file we have to define . I have used Visual Studio Code IDE for defining .cto , logic.js and permission.acl file as it supports fabric’s composer plugin.

To make it super duper simple our business network will consist one transaction which will be triggered when asset transfer will be happened between participant .

Below picture describe the model file , we have user participant type , comodity asset type and a transaction called trade.



Here is our Chaincode / Smart contract /Business Logic for transaction trade , which just change the asset owner for particular asset.



I kept my permission.acl file also very simple everything is permitted . this permission.acl file we have to create explicitly .

Once we are done with this three file we have to generate deployable .bna file .

Step3 : To generate deployable .bna file from the project root directory use command in terminal .

composer archive create -t dir -n .

Upon successful command it will create .bna archive file inside root project folder.

Now before deploying we have to make sure our Hyperledger fabric is running , admin card is created and Chaincode is instatiated.

Step 4: Start Hyperledger fabric if its not running .

go to fabric-tools folder and run the shell script

Upon Successful start you will get screen like below .

Now If card is not present we have to create business network card by running shell script

Now we have to install composer runtime for this business network here we instantiate our chaincode also implicitly .

composer runtime install --card PeerAdmin@hlfv1 --businessNetworkName devaucnw

Now we can deploy our deployable .bna file into Hyperledger fabric.

Step 5: To deploy the business network, from the businessnetwork directory, run the following command:

composer network start --card PeerAdmin@hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile devaucnw@0.0.1.bna --file networkadmin.card

Step 6: Our Deployment is successful , now we have to  import the network administrator identity as a usable business network card, to do that  run the following command:

composer card import --file networkadmin.card

To check that the business network has been deployed successfully, run the following command to ping the network:

composer network ping --card admin@devaucnw

Step 7: Generate composer rest server for this Business network (devaucnw) so we can easily integrate with our ui5 application.

To generate composer rest server type following commands


Give all the details as below

Our Fabric and Composer part is ready now we have to configure composer rest api with Sap Cloud Connector. As i am running linux inside my vmware workstation player i can access api explorer from my primary os by addressing in url, and base Api path will be for me


Below is my Cloud Connector Configuration.

Lets Look at my destination in Sap Cloud Platform Connectivity Service.

Whole Project is hosted On Github .

Now lets test the Deployed Application on  Sap Cloud Platform.

Lets Create Participants and Assets by clicking on Asset and Participants tile.

Same way we can create Asset , here for example i have created a asset One Plus 6T mobile and Kandarp S is owner for this asset.

Now we will go back to Dashboard and perform a transaction where asset will be transferred to Nitin

After Successful trade asset owner should be changed , so lets go back to asset list and check the owner.


I hope you enjoyed the coolest integration between Sap Cloud Platform and On-Premise Hyperledger Fabric . New Idea , suggestion , comments are always welcome which will definitely encourage me to write more story on Blockchain and Sap Cloud Platform.



You must be Logged on to comment or reply to a post.
  • Hi Sudip,


    thanks for sharing!

    Can you tell us why you setup the Hyperledger Fabric on a localhost instead of using the blockchain service in the SAP cloud plattform or why you haven't setup the service in the Cloud Foundry?

    Thanks and regards

    • Hello Andreas,

      BaaS (Blockchain as a service) is not released yet officially for developer account (trial) in cloud foundry . Second if you want to have On-Premise Blockchain platform and want to integrate with S/4 then it make more sense because via cloud connector and SAP CPI you can achieve those or you want to just run standalone application on SAP CP. And finally composer is one of the coolest framework I believe its very easy to write chaincode because its js .




      • Thanks again for your reply!


        Blockchain is considered as more secure then a centrally stored database because of several peers. What I don't understand is how can you setup several peers with the SAP blockchain offering? I can imagine that one peer can be setup in the SAP CP but what about the others? If there's just one peer and the SAP cloud plattform gets hacked an intruder can also change the whole blockchain and no other peer denies the new blockchain because it was modified.

        • Hi Andreas,

          SAP CP's BaaS is Offering Pilot service to customer to test chain code in single blockchain, its not   for productive use i guess yet . Yes though it is based on fabric there is no peer handling stuff which we have in Hyperledger Fabric . And regarding security as of now if api key get leaked and if chaincode is buggy then there will be definately chances . But again Its a Pilot as per my knowledge in Business Blockchain you can define each peer's authorization and in upcoming SAP's offering definately we will be hearing something like that .



    • Hello Guilherme , Thanks for asking , SAP's BaaS (Blockchain as a Service) which is part of SAP Cloud Platform 's Cloud foundry is based on Hyperledger Fabric , Hyperledger fabric is not intended for building crypto currency nor it focuses on that. It solely intended for Business Blockchain and how we can solve Business Problem using Blockchain Technology .

      • Hi both,

        I guess the question of Guilherme was more in terms of wheter SAP is providing APIs or docs to support smart contracts automatically connect to SAP systems.

        • May be let him come with him reply , if that is the case then yes it supports smart contract and we can write that in go language and invoke chain code by rest api call .

  • Hyperledger fabric should be able to be deployed on the SAP Cloud Foundry as Docker is enabled. Check this:

    I tried to deploy hyperledger fabric on the Cloud Foundry but my trial account has 0 resources. I guess there's something wrong with the Cloud Foundry trial. This is the command that should work:

    cf push hyperledgerPeer --docker-image hyperledger/fabric-baseimage

    The error I receive is that there's no route available in my companys quota


      Hi Andreas,

      Thanks for sharing the blog i just went through the blog and wondered in that blog why they used productive cf and made complicated deployment  where BaaS service is available in CF . I just registered for SAP Blockchain Early Access Program  so i can have BaaS enabled in my trial account . Its better to have it as service which makes more sense for full cloud solution .




  • Hello Sudip,

    That's more informative and a beginner can understand easily. Did you tried or research on integrating SAP Block Chain with SAP ERP system assuming that with standard transactions can we do using Blockchain? Will that be effective at all?


    Chanukya Reddy

    • Hi Chanukya,

      SAP Blockchain or more specifically (BaaS) is based on Hyperledger fabric  which is part of SAP Cloud Platform 's Cloud Foundry service easily can be integrated with SAP Business Suite like S/4Hana or ECC , though i am not abap developer but i strongly feel rest api call is possible from ABAP programme . Currently i guess SAP's BaaS doesn't offer peer handling or wallet management kind of stuff (It is still in Pilot Phase ) , which means distinguish between multiple user is not possible but it offers many thing like you can write your chain code in instance and it provide rest api to invoke the chaincode , currently chaincode testing is possible through rest api call . Hopefully by end of feb 2018 it ll offer peer handling and many more thing.  Click  SAP Blockchain Roadmap to get latest update.




  • Hi Sudip,

    It is great you share this blog. I need to do some demo like you did for some internal purpose in short period. Can I set up the enviroment in Win 10? What you mentioned is based on Mac. I am not sure I can follow it in a short time.





    • Hi Gavin,


      Thanks , I have setup this dev environment on ubuntu 16.04 , which is installed on vmware player . So you can install vmware player in your windows and do the same . Click here for prerequisite in ubuntu and then proceed with next step . The windows version is available but not advisable from Hyperledger community .





      • Hi Sudip,

        very informative post. If I have to make use of the SAP blockchain's hyperledger service for this on windows platform, then can you please advise on what would be the steps for creating an asset transfer scenario?





        • Hi Saritha,

          i have seen others being successful with their windows setup, mostly through virtualbox, but it has never worked for me. ubuntu is easier way to go and you will pick up some linux goodies along the way in the spirit of open source. i can't swear by SAP's cloud access, though, but i'm sure the team is interested in having more participants there.

          thx, greg


          • Hi Greg,

            Thank you for the inputs. I have never explored it on a Linux platform and have tested the features on SAP blockchain trial accounts which are simpler in setting up as baseline, but again from a understanding functional perspective, things do not look that simpler.

            Anyways, will give it a try.




  • Hello Sudip,

    I like what you did here! Great job. I noticed you used Fabric 1 and reused the MSP; did you kept the SOLO consensus?

    When you use Loopback, the port used is 3000, but all the services are enabled as paths; do you know of a method to limit the consumption in SCP? We are thinking to create a reverse proxy to manage the paths we want (transactions only).

    Thank you, Jaime.

    PS. Have you done anything with HLF 1.1?

    • Hi jaime,

      Sorry for late reply , Yes I used Fabric 1 . Yes we can limit the consumption . If you are talking about limiting the path , then definately we can only enable those path which is only asset , participants , transaction and wallet related we can disable the system path in cloud connector.


      If you want to make other custom policy then my approach would be go with SAP Cloud platform Api management  management and design the policy for each rest api .

      And If you want disable some access for normal peer considering 3-4 kind of business user are present in your business network and you have implemented multi user with wallet and passport then in access control language define the authorization rule for accessing each resource as per your requirement.






  • I tried to follow this tutorial unfortunately when I try to startFabric, I receive the below error message


    administrator@ubuntu:~/fabric-tools$ ./
    Development only script for Hyperledger Fabric control
    Running ''
    FABRIC_VERSION is set to 'hlfv1'
    FABRIC_START_TIMEOUT is unset, assuming 15 (seconds)

    #Detect architecture
    ARCH=`uname -m`
    uname -m

    # Grab the current directory
    DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd
    dirname "${BASH_SOURCE[0]}"


    ARCH=$ARCH docker-compose -f "${DIR}"/composer/docker-compose.yml down
    /home/administrator/fabric-tools/fabric-scripts/hlfv1/ line 26: docker-compose: command not found


    ====== Could you please help on this. Thanking you in advance


    • HI

      please check if Docker is installed and running.




      Sarbjeet Singh

  • Hi,

    My bna application is installed and running successfully on Fabric running in Oracel VM.

    I am able to access REST services using http://localhost:3000/explorer/, but when trying to run using IP address of VM, it is not working. It says says site cannot be reached.

    Also, using localhost, I am unable to access http://localhost:3000/api/. Any idea why this might happen?




    • Hi Please check first what is IP address of your linux box inside vm, and also check NAT settings weather you will be able to access the IP address from host machine or not. can you post screenshot.

      • Hi Sudip,

        I have set up hyperledger on premise in windows 10. Now I am trying to connect to cloud via the cloud connector. However I am not able to correctly configure the internal host and port. Where should I look for correct host and port numbers to connect successfully.




    • Hi Prajakta,


      Have restart REST server or what's the output of  composer network ping ?