Perform analytics on blockchain transactions

Summary

This code pattern uses IBM Db2 federation capabilities to perform SQL analytics on a sample blockchain insurance application using Hyperledger Fabric. This code pattern uses the sample blockchain insurance application. Apache Zeppelin notebook will be used to perform analytics by querying the blockchain using Db2 and SQL.

NOTE: This code pattern can either be run locally, or connected to the IBM Blockchain Platform.

Description

This code pattern showcases the use of blockchain in insurance domain for claim processing. The pattern leverages IBM Db2 federation capabilities to perform SQL analytics on a sample blockchain insurance application using Hyperledger Fabric. The code pattern also uses Apache Zeppelin notebook which is used to perform analytics by querying the blockchain using IBM Db2 and SQL.

In this application, we have four participants: insurance, police, repair shop, and the shop. Furthermore, each participant will own its own peer node. The insurance peer is the insurance company providing the insurance for the products and it is responsible for processing the claims. Police peer is responsible for verifying the theft claims. Repair shop peer is responsible for repairs of the product while shop peer sells the products to consumer. The value of running this network on the IBM Blockchain Platform is that you can easily customize the network infrastructure as needed, whether that is the location of the nodes, the CPU and RAM of the hardware, the endorsement policy needed to reach consensus, or adding new organizations and members to the network.

After completing this code pattern, you’ll understand how to:

  • Create a Kubernetes Cluster using the IBM Kubernetes Service.
  • Create an IBM Blockchain service, and launch the service onto the Kubernetes cluster.
  • Create a network, including all relevant components, such as Certificate Authority, MSP (Membership Service Providers), peers, orderers, and channels.
  • Deploy a packaged smart contract onto the IBM Blockchain Platform by installing and instantiating it on the peers.
  • Use the connection profile from IBM Blockchain Platform to create application admins, and submit transactions from our client application.
  • Configure a Db2 Federated Server to Access the Blockchain.
  • Query Blockchain via Zeppelin Notebooks using Db2 and SQL to perform analytics on blockchain transactions.

Flow

flow

  1. The blockchain operator creates a IBM Kubernetes Service cluster (32CPU, 32RAM, 3 workers recommended) and an IBM Blockchain Platform 2.0 service.
  2. The IBM Blockchain Platform 2.0 creates a Hyperledger Fabric network on an IBM Kubernetes Service, and the operator installs and instantiates the smart contract on the network.
  3. The Node.js application server uses the Fabric SDK to interact with the deployed network on IBM Blockchain Platform 2.0.
  4. The React UI uses the Node.js application API to interact and submit transactions to the network.
  5. The user uses React UI to interact with the blockchain insurance application to create business transactions.
  6. To perform business queries on the blockchain, the user interacts with Zeppelin notebook as a front end to Db2 federation to perform SQL queries against blockchain network.

Instructions

Get the detailed instructions in the README file. These steps will show you how to:

  1. Create IBM Cloud services
  2. Build a network – Certificate Authority
  3. Build a network – Create MSP Definitions
  4. Build a network – Create Peers
  5. Build a network – Create Orderer
  6. Build a network – Create and Join Channel
  7. Deploy Insurance Smart Contract on the network
  8. Connect application to the network
  9. Enroll App Admin Identities
  10. Run the application
  11. Create business transactions on blockchain application
  12. Configure Db2 Federation Server and Zeppelin Notebook
  13. Perform analytical SQL queries