About Streaming Blockchain Events
A chaincode in the blockchain can publish events in one of two ways. One is by using the Hyperledger Fabric SDK, and the other is by using the Blockchain Platform REST API. However, these two approaches have the following limitations:
- Hyperledger Fabric SDKs are in Java or Node.js only.
- You must patch the Hyperledger Fabric SDKs before using them with Oracle Blockchain Platform.
- Event notifications are not guaranteed to be delivered.
- Consumers of the REST API must have credentials in the blockchain founder instance.
To avoid those limitations, use the Oracle Blockchain Platform REST API with a relay app. The relay app can be a serverless function. It receives an event payload in JSON format from the blockchain and reformats the event payload to be compatible with Apache Kafka API. The relay app obtains authentication credentials from Oracle Vault and then sends the event to Oracle Streaming Services. Multiple event consumers can then subscribe to Oracle Streaming Services and start receiving events that they are authorized to receive.
Architecture
This diagram shows how you can set up reliable and secure blockchain event notifications for multiple event consumers using the tools and services within Oracle Cloud Infrastructure.
This is how the event flows from the blockchain platform to the event consumers:
- Chaincode in the blockchain calls the API Gateway with the event as payload. You manually subscribe the API Gateway URL to blockchain events.
- The API Gateway passes the request to the Event Relay App. The Event Relay App is an application that you write. It performs the following functions:
- Re-formats the event for the Streaming Service API.
- Retrieves Streaming Service credentials from Vault.
- Sends the event to the Streaming Service API.
- The Streaming Service makes sure that event is delivered to the authorized consumer apps.

Description of the illustration architecture-blockchain-event-streaming.png
Before You Begin
About Required Services and Roles
To implement this Solution, you require an Oracle Cloud Infrastructure account.
Your user account must have sufficient permissions to create and deploy the following services:
-
Oracle Blockchain Platform
-
Oracle Functions
-
Oracle Cloud Infrastructure Vault
-
Oracle Cloud Infrastructure Streaming
-
Oracle Cloud Infrastructure Registry
-
Oracle Cloud Infrastructure Gateway
See Common Policies for information about policies required for access.
See Learn how to get Oracle Cloud services for Oracle Solutions to get the cloud services you need.