Automate business processes via blockchain events  

Take action on transaction events using Hyperledger Composer

Last updated | By Ishan Gulhane, Kevin Hoyt

Description

Congrats! You’ve made it to the third in a series of code patterns that show you how to get started creating a blockchain application. In this pattern, you’ll learn how to emit events from the blockchain network so that external applications can subscribe to them and take action. As you’ve seen, blockchain’s trusted and immutable shared ledger is the foundation for innovative business solutions. Applications and external systems often need to know when something happens to the shared ledger. This pattern will show you how to programmatically generate and receive those notifications from the blockchain network.

Overview

Updated to support Hyperledger Fabric V1.1 and Hyperledger Composer V0.19

Now that you know how to create a Hyperledger Fabric network (the first pattern) and execute a smart contract on it (the second pattern), you’re ready to take on events!

Imagine that you’ve listed a car for sale in the product auction network and you’re dreading the effort of tracking the auction process for the car. Hyperledger Composer provides a novel approach to automate the manual task of tracking the auction process by emitting event notifications. Transactions within Composer can be written to emulate CRUD operations on your assets to emit events when required. In the car auction case, you could listen to the “OfferEvent” event to get notified about the offers for the car, and have a printer listen to the “PrintBillOfSale” event to print details of the sale.

This pattern is an extension of the pattern to create a smart contract among a set of participants in a product auction network. In this pattern, you’ll learn how to emit events from a blockchain network and subscribe to them from external web applications.

Flow

  1. Start the Hyperledger Fabric network
  2. Generate and deploy the Business Network Archive
  3. Start and connect the Hyperledger Composer rest server to the deployed business network, and start the web application

Instructions

Find the detailed steps for this pattern in the README. Those steps will show you how to:

  1. Generate the Business Network Archive (BNA).
  2. Deploy the Business Network Archive on Hyperledger Composer running locally.
  3. Start the web UI.
  4. Perform the transactions, and emit and handle events.

To complete this pattern, you should be familiar with the previous pattern to create a smart contract among a set of participants in a product auction network.

Related Blogs

Two “edgy” AI TensorFlow models for you!

The global Call for Code is well underway, we want to share some visual recognition models which could help you. These AI models can operate on the edge, which could be particularly useful for this years’ theme: disaster preparedness. How could visual recognition help in relief work? From satellite and drone imagery analysis, to classifying...

Continue reading Two “edgy” AI TensorFlow models for you!

Leveraging the power of AI at Unite Berlin

Last week, from June 19 – 21, we were at Unity’s premiere in Berlin: Unite 2018. This conference brought together Unity’s video game and development community. Unity touches 770 million gamers all over the world and is the market leader for consumer AR and VR use cases and is also rapidly emerging as the market...

Continue reading Leveraging the power of AI at Unite Berlin

Related Links

GitHub

Check out the source code for Hyperledger Composer V0.19.3.

Architecture center

Learn how this code pattern fits into the Blockchain Reference Architecture