In my journey with Blockchain in last year and half, I had the privilege to attend/deliver scores of conferences, expert talks and hackathons. In all my interactions with the developers and architects, I received request for getting a consolidated view of the resources available to learn and play with Blockchain using Hyperledger Fabric and Hyperledger Composer.

As an effort towards assisting in learning, I am trying to present a consolidation of few resources available to get started with Blockchain technology using Hyperledger Fabric and Hyperledger Composer.

This write-up is aimed at guiding developers towards code patterns/code-repositories available to developers for experimenting with code available on github repositories, contributed by different experts across the Blockchain ecosystem.

Blockchain learning resources in form of published Code-patterns/Journeys-
https://developer.ibm.com/code/journey/category/blockchain/

1. Build a complete blockchain application on Hyperledger Fabric using Hyperledger Composer

Blockchain is changing the way businesses conduct transactions. This secure, distributed, and open technology is lowering costs, speeding up processes, and building a new level of trust in secure interactions. When something as big as blockchain emerges, developers who understand and can implement the technology are in the driver’s seat. But first you have to learn it.

For anyone wondering how to get started with blockchain, this developer journey is for you. This journey is a composite, comprising a set of granular developer journeys that take you through the process of building a working blockchain application step by step.

Start with the first journey in the series, Build a blockchain network, in which you’ll learn how to create your first blockchain network using Hyperledger Composer. You’ll create a Business Network Archive (BNA) file that enables you to define a model; for example, the participants, tradeable assets, and allowable transactions. You’ll then deploy the network on Hyperledger Fabric, the blockchain framework implementation hosted by the Linux Foundation. For this journey, you’ll run Hyperledger Fabric locally.

Next, move on to Create and execute blockchain smart contracts. As the name suggests, you’ll build a smart contract that defines the “who” and “what” with respect to managing transactions. You’ll learn how to add multiple participants and add access control to your blockchain application by creating an interactive, distributed, product auction demo network. You’ll get an introduction to access control lists, which control sharing and privacy and are automatically enforced by the Hyperledger Fabric Composer runtime.

When you complete the developer journeys in this series, you’ll discover how useful a tool Hyperledger Composer can be. It gives you the ability to quickly model your current business network, including your existing assets and the transactions related to them.

This is your chance to climb on the blockchain train and build the skills that every business will need. Watch for additions to this blockchain series. Work your way through the full composite developer journey and make yourself indispensable

Build a blockchain network

  1. Install the Network Dependancies: cryptogen, configtxgen, configtxlator, peer
  2. Configure the network:
    • Generate the network artifacts.
    • Start the network

Create blockchain smart contracts

  1. Install and instantiate the chaincode.
  2. Query and invoke the chaincode.
  3. View transactions and chaincode logs.

https://developer.ibm.com/code/journey/build-your-first-blockchain-application/

2. Create and execute smart contracts within a blockchain application using Hyperledger Composer

Note: This developer journey is the second in a series of journeys designed to get you started with blockchain. For an overview of the series, see Build your first blockchain application.

In the first journey of the series, you learned how to build a blockchain network. Now you’re ready to learn how to create and execute a smart contract within your blockchain application.

Blockchain is designed for multi-party business transactions, and organizations that use blockchain depend on trusted automatic transactions to do business. One of the most useful aspects of blockchain is its decentralization. Because it’s a decentralized system that exists between all permitted parties, there’s no need to employ intermediaries. In effect, you “cut out the middleman,” save time, and prevent potential disagreement about transactions.

Blockchain creators realized that the decentralized blockchain ledger could be used for self-executing or smart contracts. Smart contracts are used to exchange money, property, shares, or anything of value in a transparent, conflict-free way. Smart contracts not only define the rules and penalties around an agreement in the same way that a traditional contract does, but they also automatically enforce those obligations. No intermediary is required for a smart contract to be completed.

A good way to understand smart contracts is to compare the technology to a vending machine. Ordinarily, to complete a contract you’d go to an attorney, pay that attorney a fee, and wait to receive the document in question, whether a house closing agreement, a divorce decree, or any other “official” documentation. With the smart contract model, you simply drop a token into the vending machine–that is, the ledger–and your document (or candy bar) is provided to you, or deposited into your account. It’s a straightforward process requiring no additional intervention from anyone.

This developer journey will show you how to use Hyperledger Composer to create a smart contract. You’ll execute the contracts on the blockchain app that you built in the first journey of this series. If you’ve already completed the previous journey, you know how useful Hyperledger Composer is for developing blockchain apps. Now you’ll take your blockchain skills to the next level by embedding and executing smart contract business terms.

  1. Install and instantiate the chaincode
  2. Query and invoke the chaincode
  3. View the transactions and the chaincode logs

https://developer.ibm.com/code/journey/create-and-execute-blockchain-smart-contracts/

3. Build a regulatory application that automates a smart contract deployed on a Sbusiness network

Regulatory compliance is a high-focus area in which developers are looking to build applications that automate and standardize processes used to enforce and execute compliance. Blockchain presents an opportunity to do just that. You can use Hyperledger Composer to easily build a regulatory compliance application and build logic in a smart contract that is deployed on a business network. This journey focuses on an FDA compliance use case. Get creative and apply it to your own use case of managing regulation compliance.

So in focusing on this use case, imagine that a supplier will transfer the food products to an importer who verifies that the supplier, country, and food type all match the correct identifiers. At the port of entry, the supplier is again checked against a list of known suppliers in a database (managed by the regulator). If the supplier is of type exempt, then products transfer to the retailer. If the supplier is non-exempt, the products are checked against a list of known food products in the database (managed by the regulator). If the food is an exempt product, then it transfers to the retailer. If the food is non-exempt, the importer must conduct the hazard analysis (either independently or by using a third party). The supplier provides the hazard analysis report to the regulator. The regulator reviews compliance and transfers the products to the retailer. In this journey, we capture the regulatory compliance logic for the FDA Foreign Supplier Verification Program in a smart contract deployed on a business network.

This Hyperledger Composer journey shows how to model food supplier verification regulatory requirements for a distributed business network. Keep in mind that a business network definition consists of model (.cto), script (.js), and ACL (.acl) files packaged and exported as an archive (.bna) file. The archive file is then deployed to a Hyperledger Fabric network.

  1. Install Hyperledger Composer development tools
  2. Configure and start Hyperledger Fabric network
  3. Generate the Business Network Archive file
  4. Import the BNA file into Hyperledger Composer Playground

https://developer.ibm.com/code/journey/implement-fda-food-supplier-verification-program-on-hyperledger-composer/

4. Create your first blockchain network using Hyperledger Composer

Blockchain is changing the way businesses conduct transactions. This secure, distributed, and open technology is lowering costs, speeding up processes, and building a new level of trust in secure interactions.

When something as big as blockchain emerges, developers who understand and can implement the technology are in the driver’s seat. But first you have to learn it.

In this developer journey, the first in a series of “hello world” blockchain journeys, you’ll learn how to build a blockchain network using Hyperledger® Composer. You’ll create a Business Network Archive (BNA) file that enables you to define a model; for example, the participants, tradeable assets, and allowable transactions. You’ll then deploy the network on Hyperledger Fabric, the blockchain framework implementation hosted by The Linux Foundation®. For this journey, you’ll run Hyperledger Fabric™ locally.

You’ll discover how useful a tool Hyperledger Composer can be. It gives you the ability to quickly model your current business network, including your existing assets and the transactions related to them. As part of your business network model, you’ll define the transactions that can interact with assets. Business networks also include the participants who interact with them, each of which can be associated with a unique identity, across multiple business networks.

This is your chance to climb on the blockchain train and build the skills that every business will need. Complete this developer journey, watch for future blockchain journeys, and make yourself indispensable.

  1. Install Hyperledger Composer development tools
  2. Start Hyperledger Fabric
  3. Generate the Business Network Archive file
  4. Deploy the Business Network Archive using Composer Playground
  5. (Alternative method) Deploy the Business Network Archive on Hyperledger Composer running locally

https://developer.ibm.com/code/journey/implement-fda-food-supplier-verification-program-on-hyperledger-composer/

5. Create a blockchain app to display and interact with a network through a web interface

This journey shows how to build a blockchain application using Hyperledger Composer. The application presents a decentralized energy network in which residents who are producing energy through solar panels or other means can sell excess energy to fellow residents. The transactions would be based on coins in each resident’s account, with a pre-determined rate of exchanging coins for energy. The network includes banks to exchange coins for a fiat currency (USD) and utility companies, which can buy or provide energy through the network. The journey uses an Angular framework for the interface to create and shows how to interact with the network using a REST API. The application allows the user to create participants (residents, banks, utility companies) on the network with their account balances and to execute transactions between residents, resident and bank, or resident and utility company. The application performs atomic transactions between participants and updates balances per transaction.

This application demonstrates the basic idea of a decentralized energy network and can be expanded in numerous ways, including adding specific permissions and channel, setting up real-time transactions among participants, and even integrating with IoT to read from power meters and distributing energy.

  1. Administrator interacts with decentralized energy UI comprising Angular framework
  2. Application processes user requests to the network through a REST API
  3. Requests are implemented to the blockchain state database on Hyperledger Fabric v1
  4. REST API is used to retrieve the state of the database
  5. Angular framework gets data through GET calls to the REST API

https://developer.ibm.com/code/journey/decentralized-energy-hyperledger-composer/

6. Create Hyperledger Fabric chaincode on LinuxONE using Hyperledger Composer

With so many resources being poured into blockchain technology to drive it forward and create new offerings, it’s hard to know where to begin and how to integrate blockchain with existing business processes. This developer journey shows you how to start to implement the development/business integration. You’ll learn how to use Hyperledger Composer’s development tools, including Node.js, npm, CLI, and popular editors, to create a development environment for Hyperledger Fabric, a blockchain framework implementation. In the environment setup, you’ll create a small business network running Hyperledger Fabric v1.0.

The environment runs on LinuxONE technology. Yes, it can run on various platforms, but LinuxONE was chosen because of the isolation, availability, scalability and encryption it provides. Running a blockchain network on LinuxONE can produce performance gains while decreasing security risks through cross-memory communication to existing Systems of Record (for example, SCM or ERP) or transactional middleware (such as CICS®, IMS™, DB2®, or batch systems).

You’ll register for guest access to the LinuxONE Community Cloud, run a script that creates your environment, and then interact with Hyperledger Composer and create and deploy a blockchain application. When you complete this journey, you’ll have opened the door to blockchain development on the mainframe, a valuable combination for any developer to have.

  1. The user requests access to LinuxONE Community Cloud so they can create a SLES Linux guest in which to run their environment
  2. LinuxONE Community Cloud offers a variety of configurations. The user selects the configuration required to support the environment and start it. When this step is complete, the user logs into the system through SSH
  3. The items required for the developer journey, a setup script and a Hyperledger Composer business network artifact, are stored in a GitHub repository. To use them, the user clones the GitHub repository to the Linux guest local file system
  4. The setup script calls DockerHub to pull down specific Hyperledger Fabric images. When the pull is complete, an npm install of Hyperledger Composer begins that will equip the guest with Hyperledger Composer and associated tools. When complete, the script installs and starts the Composer Playground, a browser-based user interface for Hyperledger Composer. The user also runs verification steps to become familiar with tooling and confirm all components are in place
  5. After importing the business network archive file to the Composer Playground, the user begins developing chaincode. When the working chaincode is tested, the Composer Playground is connected to the running Hyperleder Fabric project through a Connection Profile. The user then deploys the chaincode to blockchain

https://developer.ibm.com/code/journey/run-blockchain-technology-on-a-linux-mainframe/

7. Create a web-based to-do list application using Hyperledger Fabric V1.0

This developer journey helps you understand how developers perform common transactions of creating, reading, updating and deleting against a Hyperledger Fabric blockchain. It also helps you migrate from Hyperledger Fabric V0.6 to Hyperledger Fabric V1.

This web-based client is designed around Polymer 2 Release Candidate, which acts as a polyfill for assorted web components specifications. These specifications include Custom Elements, Shadow DOM, HTML Imports, and HTML Templates. As Hyperledger Fabric supports cross-origin resource sharing (CORS) out of the box, the web client communicates directly via HTTP/JSON.

As requests arrive on Hyperledger Fabric, they are mapped to a specific smart contract written in Go. There are two types of requests that can be made. The first is an invoke request, which will take place asynchronously on Hyperledger Fabric, returning only a transaction identifier. The second is a query request which will return some value. This project uses invoke requests for create, update, and delete operations, and query requests for read operations.

The to-do list application that you will create is designed to help you understand how common transactions needed by business processes can be adapted to use blockchain. Remember: blockchain does not equal Bitcoin! (Although it might be said that Bitcoin is one of the first true blockchain applications.) As a distributed ledger, blockchain’s distinct characteristics, such as decentralization, consensus, and encryption, have broad-reaching implications to many businesses and organizations, including finance, transportation, health care, and more.

  1. The user interacts with the to-do client application in their browser.
  2. When the user performs any action, the application calls the server application API where the registered admin interacts with the Hyperledger Blockchain Network.
  3. Reading or writing the ledger is called a proposal. The proposal is built by the to-do app server (through the SDK) and then sent to a blockchain peer.
  4. The peer communicates to its to-do chaincode container (CC). The chaincode will run/simulate the transaction. If there are no issues, it endorses the transaction and sends it back to the to-do application.
  5. Using the SDK, the to-do app sends the endorsed proposal to the ordering service. The orderer packages many proposals from the whole network into a block.
  6. The orderer broadcasts the new block to peers in the network.
  7. The peer validates the block and writes it to its ledger. The transaction has now taken effect and any subsequent reads will reflect this change.

https://developer.ibm.com/code/journey/create-a-to-do-list-app-using-blockchain/

8. Deploy an asset-transfer application on Hyperledger Fabric v1.0

In this developer journey, you’ll learn how to migrate from Hyperledger Fabric v0.6 to v1.0. The Marbles application that you’ll build demonstrates a method of transferring marbles between many marble owners using Hyperledger Fabric. You’ll create the app using Node.js and the Go programming language; the backend for the app is written in Go running in a blockchain network. The chaincode will create a marble and store it in the chaincode’s managed state. The chaincode itself can store data as a string in a key/value pair setup. You’ll “stringify” JSON objects to store more complex structures.

The attributes of a marble are as follows:

  • id (a unique string that will be used as a key)
  • color (string, CSS color names)
  • size (int, size in mm)
  • owner (string)

You will create a web-based UI that can set these attribute values and store them in a blockchain. The marble is created in the blockchain storage, or ledger, as a key value pair. The key is the marble ID, and the value is a JSON string that contains the attributes of the marble. To interact with the chaincode, you’ll use the gRPC protocol to a peer on the network. The details of the gRPC protocol are handled with the Hyperledger Fabric Client SDK.

  1. The administrator interacts with Marbles, our Node.js application, through a browser.
  2. The client-side JavaScript code opens a websocket to the backend Node.js application and instructions are sent to the application from the browser.
  3. The proposal accesses the ledger to simulate a transaction. This proposal is built by Marbles (using the SDK) and then sent to a blockchain peer.
  4. The endorser (process on the peer) will endorse (or sign) the transaction if there are no issues.
  5. The SDK collects all the signed proposals and, if the policy is fulfilled, sends the transaction with the signed endorsements to the ordering service. The orderer service orders the transactions, creates a block, and delivers it to the appropriate peers.
  6. The peer validates the block and writes it to its ledger. The transaction has now taken effect and any subsequent reads will reflect this change.
  7. https://developer.ibm.com/code/journey/deploy-an-asset-transfer-app-using-blockchain/

    Further please refer to the Blockchain for Dummies book for understanding more about Blockchain, the download link is – https://public.dhe.ibm.com/common/ssi/ecm/xi/en/xim12354usen/XIM12354USEN.PDF

Join The Discussion

Your email address will not be published. Required fields are marked *