Ontology Oracle
Oracle network and mechanism
Last updated
Oracle network and mechanism
Last updated
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.
Ontology 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.
With reference to the illustration above, the infrastructure consists of two major parts-
On-chain
Off-chain
The Oracle node and the data source are two parts of the Oracle network that exist off-chain. The nodes are linked to the Ontology 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.
The Oracle contract primarily collects and stores the data sent by the node, making it available for other smart contracts to invoke and access.
The data flow within the Oracle network, as illustrated above, can be described as follows:
The client issues data requirements using an Oracle data request to the Oracle contract
Oracle contract updates the received information in a ledger that functions like a database
An Oracle node picks up on this request and fetches this data using the RPC interface
The node fetches data from external data sources using HTTP API
The node serializes the received data based on the client request obtained earlier and invokes the Oracle contract to transmit the data
Other smart contracts on client side can then invoke this Oracle contract to access this data