Cipher Oracle

Oracle network and mechanism

More and more dApps now depend on outside world triggers. Here's a hypothetical scenario: A flight is scheduled to arrive at 10:00 AM. An insurance smart contract has been set in place which will be triggered if the flight is delayed, and all the beneficiaries of the insurance policy should receive 100 tokens as compensation.

A scenario such as this one involves many variables, and a dApp that implements a smart contract such as this will require a lot of outside world data such as flight information, insurance policy related data, relevant account information to actually carry out the transaction, etc.

dApps are becoming richer and are trying to encapsulate as much functionality as possible. As a result, more and more real world data needs to be processed, such as logistic information, stock prices, weather data, sports statistics and scores, etc.

Cipher Oracle is designed to deal with this issue of smart contracts not being able to interact with the outside world. It essentially plays the role of data transporter, making it possible for smart contracts to fetch outside world data.

Cipher Oracle Framework

Oracle infrastructure

With reference to the illustration above, the infrastructure consists of two major parts-

  1. On-chain

  2. Off-chain

Off-chain (Oracle Operator and Data Source)

The Oracle node and the data source are two parts of the Cipher network that exist off-chain. The nodes are linked to the Cipher network and listen for requests from the Oracle contracts. All nodes process the data requests independently. These nodes will support more blockchain networks in the future.

The operation carried out by the nodes consists of two important tasks:

  • Data crawling

  • Data analysis

The node fetches data from the data sources via external APIs and after processing and analyzing the response writes the data into the Oracle contract after serializing it into the format specified by the user.

On-chain (Oracle Contract)

The Oracle contract primarily collects and stores the data sent by the node, making it available for other smart contracts to invoke and access.

Oracle data and workflow

Oracle network data flow

The data flow within the Cipher network, as illustrated above, can be described as follows:

  1. The client issues data requirements using an Oracle data request to the Oracle contract

  2. Oracle contract updates the received information in a ledger that functions like a database

  3. An Oracle node picks up on this request and fetches this data using the RPC interface

  4. The node fetches data from external data sources using HTTP API

  5. The node serializes the received data based on the client request obtained earlier and invokes the Oracle contract to transmit the data

  6. Other smart contracts on client side can then invoke this Oracle contract to access this data