Off-chain Data using Peer Channel Based Event service
Problem : Performance Issues / Heavy Rich Queries of On-chain data
Even though Hyperledger Fabric supports rich queries with state database as CouchDB to query on-chain data , It is always costlier to query local peer . With volume of data growing in Blockchain , it is not wise to query on-chain data as it would introduce performance issue.
Solution: Peer Channel Based Event Service to rescue(off-chain data)
Hyperledger Fabric provides feature of Peer Channel Based Event service(PCBE) that exposes block getting committed to the Ledger. Using PCBE , we could wire up a service that listens to latest block and transform the data from on-chain to off-chain (Datastore). The transformed data can be utilized in several ways such as analytics, reporting, querying through off-chain rather than on-chain etc,. PCBE also ensures that it returns block that is being asked for any time i.e. it is assures block/message guarantee . An off-chain system would ideally look like below in production grade enterprise blockchain system.
Summary:
Peer Channel Based Event Data is effective way to pull on-chain data to off-chain , This could also be applied when the application is running in production mode as it provides a technique to pull the blocks from 0 to n . This is an effective mechanism to query /performing analytics of blockchain data outside blockchain .
Reference:
https://hyperledger-fabric.readthedocs.io/en/latest/peer_event_services.html
https://github.com/hyperledger/fabric-samples/tree/master/off_chain_data