Unlike blockchain, the world outside the distributed network is not at all deterministic, and it is likely that one of the parties or both may face unforeseen circumstances that will affect the terms of the smart contract. A smart contract is a way of making a deal by unambiguously specifying the parties and conditions involved. But what if some details about the past, present, or future are unknown or occur outside the blockchain protocol?

The answer to this question is oracle. Oracles are the crucial link between the real world and the ethereal digital world, translating the non-deterministic off-chain data into deterministic data on-chain. Smart contracts need oracles to resolve details that cannot be precisely known at the time the contract is written. When it is necessary, the oracle will allow smart contracts to update the terms of their execution by obtaining information from the outside world.

Basically, an oracle is a third-party service that provides external data when needed and is designed for use with smart contracts. Oracles are trusted data sources or entities that provide information or sign claims about the state of the world for smart contracts. Before we dive deeper, we have to point out two things for you:

Oracles don’t make predictions about the future but report events that had occurred by the particular date or/and specific place; Oracles can be smart contracts at the same time. Oracles can be considered as a part of multi-signature contract where for example the original trustees sign a contract for future release of funds only if certain conditions are met. Before any funds get released an Oracle must sign the smart contract as well. Thus, an oracle can be an individual or a group of people associated with the execution of the initial contract.

Oracles integrate with the blockchain through smart contracts, allowing you to manipulate an asset or agreement for an asset programmatically. Without any human notary involved, oracles are essential in smart contracts to make them ‘externally aware’ to ensure they fulfill their contractual criteria. Oracles can be set up for both public or private blockchains.

There are different types of oracles based on the type of use:

By type of transmitter

Software Oracles. Software oracles handle information available online. An example could be the temperature, stock quotes, exchange rates, prices of commodities and goods, flight or train delays, etc. The data originates from trusted online sources. The software oracle extracts the needed information and pushes it into the smart contract;

Software oracles handle information available online. An example could be the temperature, stock quotes, exchange rates, prices of commodities and goods, flight or train delays, etc. The data originates from trusted online sources. The software oracle extracts the needed information and pushes it into the smart contract; Hardware Oracles. Some smart contracts need information directly from the physical world, for example, a car crossing a barrier where movement sensors must detect the vehicle and send the data to a smart contract. Another use case is RFID sensors in the supply chain industry. The biggest challenge for hardware oracles is the ability to report readings without sacrificing data security. For example, there is a project Oracalize on the market that proposes a two-step solution to the risks, by providing cryptographic evidence of the sensor’s readings and anti-tampering mechanisms rendering the device inoperable in the case of a breach.

By type of input/output

Inbound Oracles. These provide the smart contract with data from the external world. Example use case will be an automatic buy order if the USD hits a certain price;

These provide the smart contract with data from the external world. Example use case will be an automatic buy order if the USD hits a certain price; Outbound Oracles. These provide smart contracts with the ability to send data to the outside world. An example would be a smart lock in the physical world which receives a payment on its blockchain address and needs to unlock automatically.

By type of execution

Consensus-Based Oracles. Prediction markets rely heavily on oracles to confirm future outcomes. Using only one source of information could be risky and unreliable. To avoid market manipulation prediction markets, implement a rating system for oracles. For further security, a combination of different oracles may be used, where for example 3 out of 5 oracles could determine the outcome of an event;

Prediction markets rely heavily on oracles to confirm future outcomes. Using only one source of information could be risky and unreliable. To avoid market manipulation prediction markets, implement a rating system for oracles. For further security, a combination of different oracles may be used, where for example 3 out of 5 oracles could determine the outcome of an event; Decentralized oracle services. These services also draw data from multiple sources and oracle distribution with the main advantage being that they are decentralized. The disadvantage is that a decentralized network must be maintained and the correct incentive mechanism to support the network and avoid centralization. ChainLink is an example. ChainLink is blockchain middleware that allows smart-contracts to access real-world data. Nodes are incentivized to keep running the ChainLink network through rewards of LINK tokens.

But like everywhere, there are potential problems with oracles.

Hacking. How do you know the information presented by an Oracle has not been hacked? Possible solutions include:

Provide cryptographic proofs and audits that the data hasn’t been tampered with. However, a hacker could target the data source that feeds the oracle instead of the oracle itself;

Query multiple oracles and seek consensus. Again, the problem here is that if the topic in question is a niche one where only one, two, or a handful of oracles exist the probability that the consensus view is wrong may be too high for some smart contracts.

Errors happen. Even with the most technologically advanced companies in the world such as Google, errors happen: So how can you ensure that smart contracts are acting on correct information? One method is to financially incentivize users to correct oracles where they see errors and financially punish oracles for wrong answers. A second method is to ensure the process for obtaining and manipulating the data is audible by users. This method requires that users can quickly review and audit both the process and the data used by the oracle to provide its output, without recourse to an expert, which may not always be possible. Also, this method doesn’t ensure the source data is correct nor does it guarantee that the oracle is sourcing the data from the best places. This approach is an area of ongoing debate and research and still in need of improvement. Also, there can be a model in which trusted party has the final decision that is based on data provided by oracles. Government agencies, exchanges, banks can act as these trusted parties.

The ability for smart contracts to obtain information from the real world opens up a new range of possible applications. The oracle ecosystem will develop rapidly as a reliable way to connect the digital world with the real world. It is the oracle that will be able to solve the problems of communication between the blockchains, as well as ensure the wider application of smart contracts in various industries interested in the use of decentralized networks.

References