Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.72 KB

design.md

File metadata and controls

39 lines (27 loc) · 1.72 KB

BigchainDB - Hyperledger Fabric Integration

Problem Statement

How to use BigchainDB data in Hyperledger chaincode? What can be integration patterns to make this happen?

Solution

The approach is based on and similar to how Oraclize works for Ethereum.

Architecture

The following diagram depicts the high-level architecture of the solution.

arch diagram

Components

  1. DApp Frontend
  2. Chain Service - connects frontend to Hyperledger Fabric chaincode
  3. Hyperledger Fabric running chaincode
  4. Oracle - connects Hyperledger Fabric chaincode to BigchainDB
  5. BigchainDB - has the data

Workflow

  1. DApp calls the chain service with the asset id of the BigchainDB asset to be processed by Hyperledger chaincode.
  2. Hyperledger Fabric chaincode is called by chain service. This chain code has the built in functionality to call a REST API from one of its functions.
  3. The chain code runs the logic in it and calls the REST API on the oracle component.
  4. The oracle is a REST API based service which sits between Hyperledger Fabric and BigchainDB.
  5. The chain code call the oracle service with 2 parameters,
    1. the query to run on BigchainDB (asset id)
    2. the code to run after the query (as a callback)
  6. The oracle service calls BigchainDB API for the query
  7. Once the data is returned by BigchainDB, the oracle runs the callback with asset data as input.
  8. After callback execution, the oracle posts the result to chain service.
  9. The chain service sends the result to Hyperledger Fabric chaincode for storage or further processing.

This way the Hyperledger Fabric chaincode does not have to depend and wait for the query to complete on BigchainDB. The entire logic runs in a deterministic way.