Quantcast
Channel: mattumd – developerWorks Recipes
Viewing all articles
Browse latest Browse all 10

Build Blockchain Applications with Hyperledger Fabric and Composer on IBM Cloud

$
0
0
  1. Hyperledger Fabric and Composer Overview

    Hyperledger is a set of open source tools and blockchain subprojects resulting from cross- industry collaboration. We will present two main components in this recipe – Hyperledger Fabric and Hyperledger Composer.

    If you like to explore blockchain development with an alternative platform like Ethereum (with Solidity programming), Blockchain Developer Guide- Introduction to Ethereum Blockchain Development with DApps and Ethereum VM, Building Ethereum Financial Applications with Java and Web3j API through Blockchain Oracles, Harness the Power of Distributed Storage IPFS and Swarm in Ethereum Blockchain Applications, and Building Enterprise Blockchain-as-a-Service Applications Using Ethereum and Quorum are highly recommended.

    For more hands-on tutorials and exercises on other projects of Hyperledger like Sawtooth or Iroha, visit Comprehensive Hyperledger Training Tutorials page to get the outline of our Hyperledger articles.

    Hyperledger Fabric Overview

    Hyperledger Fabric is the cornerstone of the Hyperledger projects hosted by The Linux Foundation. It is a permission-based blockchain, or more accurately a distributed ledger technology (DLT), which was originally created by IBM and Digital Asset. It is designed as a modular framework with different components, such as the orderer and Membership Services Provider (MSP). It is also a flexible solution, offering a pluggable consensus model, although it is currently only providing permissioned, voting-based consensus, with the assumption being that any current Hyperledger networks will be operating in a  partially trustworthy environment.

    Hyperledger Composer Overview

    Alongside blockchain frameworks such as Fabric or Iroha, the Hyperledger project provides us with tools such as Composer, Hyperledger Explorer, and Cello. Composer provides a tool set to help build blockchain applications more easily. It consists of CTO (a modelling language), Playground (a browser-based development tool for rapid testing and deployment), and a command-line interface (CLI) tool. Composer supports the Hyperledger Fabric runtime and infrastructure, and internally the composer’s APIs utilize the underlying Fabric API. Composer runs on Fabric, meaning the business networks generated by Composer can be deployed to Hyperledger Fabric for execution.

  2. Deploy Blockchain-as-a-service Applications with IBM Cloud

    IBM Cloud (https://www.ibm.com/cloud/), previously known as IBM Bluemix, provides an enterprise blockchain platform as a flexible blockchain-as-a-service (BaaS), which is based on the open source Hyperledger Fabric. The customer can easily create, deploy, and manage a secure enterprise blockchain on IBM Cloud without caring about the underlying infrastructure.

    IBM Cloud is an expensive service for a developer who wants to learn. Therefore, instead of deploying a custom example which requires a premium plan, we present here one of the samples—Marbles—provided by IBM from its free starter plan.
    The application will create a marble (a glass ball used as a children’s toy) and store it in the blockchain by invoking Chaincode. We will create a UI that creates or updates the marble’s attributes and stores them in the ledger. The Hyperledger Fabric Client SDK will call the network Chaincode through the RPC protocol.

    To run this sample in the IBM Cloud, we need to create an IBM Cloud account and select the blockchain service:

    IBM Clouds and Blockchain Hyperleder Development

    Select the Starter Membership Plan, which is free:

    IBM Clouds and Blockchain Hyperleder Development

    Once created, you’ll need to launch the network and set up the toolchain for Marbles. For that, browse to the IBM Blockchain GitHub link at https://github.com/IBM-Blockchain/ marbles/blob/master/.bluemix/README.md , and click Get Marbles. You should see a page similar to the following one, where you should click Create to create the Marbles sample toolchain:

    IBM Clouds and Blockchain Hyperleder Development

    During setup, it will ask you for your GitHub login. Enter all the required login information, and click Authorize IBM-Cloud.

    Once GitHub’s code is set up in IBM Cloud, click Create to continue to the next step—Delivery Pipeline:

    IBM Clouds and Blockchain Hyperleder Development

    Click on Delivery Pipeline and it will start deploying the Marbles application to the blockchain:

    IBM Clouds and Blockchain Hyperleder Development

    Once completed, click on the Marbles Node.js application:

    IBM Clouds and Blockchain Hyperleder Development

    You should see the web interface of the Marbles application launched in the browser:

    IBM Clouds and Blockchain Hyperleder Development

    Login as admin, and a welcome demo page will pop up. You can select Express or Guided
    setup. Let’s click the Express button:

    IBM Clouds and Blockchain Hyperleder Development

    The Marbles application is now loaded:

    IBM Clouds and Blockchain Hyperleder Development

    Try to add one Marble by clicking the Ava add (+) button. Add the marble, and then click
    Create:

    IBM Clouds and Blockchain Hyperleder Development

    You should see that a new green Marble is added to Ava:

    IBM Clouds and Blockchain Hyperleder Development

    Congratulations! You have just run a sample Hyperledger Fabric blockchain application on the IBM Cloud platform!

     

    IBM Cloud is a powerful platform with built-in services that can easily be integrated into your blockchain project. For instance, we can utilize Watson, which is IBM’s AI solution, to analyze and customize application data to share among authorized network participants.

    After finishing this recipe, you can move on to Building A Blockchain for Letter of Credit Using Hyperledger Fabric and Composer and Ultimate Guide for Building A Blockchain Supply Chain Using Hyperledger Fabric and Composer tutorials that cover more advance topics on Hyperledger Fabric.

    This recipe is written in collaboration with Brian Wu who is a senior Hyperledger Developer at DC Web Makers in Washington DC.

The post Build Blockchain Applications with Hyperledger Fabric and Composer on IBM Cloud appeared first on developerWorks Recipes.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images