Consuming Blockchain Events via Oracle Functions and OCI Streams

Mark Rakhmilevich, and Tamer Qumhieh

Blockchains integrate with the outside world in two primary ways: 1) external systems can act as clients to trigger smart contract transactions in order to update some data on the distributed ledger or to query the ledger, and 2) blockchain can emit events that can be used to update ERPs or other systems of record or to trigger downstream actions.  Events published by the Oracle Blockchain Platform can come from the platform to signal a new block being created or a transaction commit, or they can be published directly from the smart contracts as a custom event based on the chaincode's business logic, e.g., PO and Invoice validation/matching conditions have been met and payment can be scheduled. OBP's REST API provides a mechanism to subscribe to events based on event type and name, and indicate a callback URL (webhook) to invoke for a specific event.

There are a number of ways to create these callback functions to integrate various back-office or downstream applications, and one of the most flexible and scalable mechanisms in Oracle Cloud is using Oracle Functions (Fn) and OCI Streaming services.  

To summarize the solution flow on this diagram, when an event is emitted from Oracle Blockchain platform, the Oracle Functions “Producer” Fn is triggered through its exposed API Gateway Endpoint (which is secured using mutual TLS between the API Gateway and OBP Rest Proxy.) The producer function reads the associated run-time configurations, calls out to OCI KMS to decrypt credentials and eventually connects to OCI Streaming service to publish the blockchain event. Each event type and name can trigger a different Fn and be published to a specific topic on the OCI Streams. This requires you to initially subscribe the Producer function API endpoint with Oracle Blockchain Platform as a callback URL to receive the event.  The step-by-step details of this integration pattern are described by my colleague, Tamer Qumhieh, in his 6-part blog series.  Read this series on the A-Team Chronicles blog to learn how to trigger Oracle Functions on blockchain events and forward the events via OCI Streams to any subscribing consumer application.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.