The blockchain can only read the information that exists on it. He cannot access information outside of himself or metadata about himself. The blockchain functions as a computer that is not connected to the Internet. Such a closed architecture minimizes vulnerabilities and provides security, but also limits its use.
For blockchains that are used only for calculations (according to Coinmarketrate.com, these are such as Bitcoin, Litecoin, Ripple), this limitation is not a problem. For blockchains designed to run smart contracts and applications (such as Cardano, Ethereum and Polkadot, etc.), this is a serious limitation. The ability to interact with the outside world and use information is the key to unlocking the full potential of decentralized applications. Without it, all decentralized applications (dApps) will be limited only to the information available on their own blockchain.
For example, consider the case of the market forecasting whether the price of ETH will rise to 5,000 by the end of 2021. No information on the Ethereum blockchain fixes the price of ETH in US dollars, so the prediction market would not be able to verify this condition.
Smart contracts are executed separately and independently on each node. Thus, in an application using random numbers, each node can determine a different random number and get a different result (see Figure 1). Multiple results will not allow the block to reach its conclusion, as consensus cannot be reached. In addition, it violates the deterministic property of the blockchain – the ability to repeat all transactions and come to the same result.
What is an oracle?
Oracles offer solutions to the above problems. They transfer data off-chain (outside of the blockchain) to the blockchain so that various applications and smart contracts can access them. Oracles connect the blockchain with the real world, the Internet and with each other.
If blockchain were a computer, then oracles would be modems that allow them to interact with the Internet and with each other.
Oracles also help solve problems like the random numbers mentioned above. Instead of computing nodes generating random numbers individually, oracle runs a simulation of random numbers and publishes it in the blockchain. Computing nodes use this published number to achieve the same result. Thus, the finality of the block is achieved and the deterministic nature of the blockchain is preserved.
There are two broad types of Oracle blockchain:
- On-chain oracles act as bridges between blockchains and allow other blockchains to read and use blockchain information. For example, the aggregator of a decentralized multi-chain exchange (DEX) needs price channels from decentralized exchanges running on Ethereum, Cardano and other blockchains to determine the best available price. To this end, on-chain Oracle can travel DEX on Ethereum, Cardano and other platforms to find the best price for the aggregator.
On-chain Oracle can also be a DApp that provides services to another DApp. For example, Uniswap (a decentralized protocol for automatic market creation) knows the price between any two assets through its liquidity pool. All dApps that need a price relationship between two assets can use this data.
- Off-chain oracles act as middleware connecting the blockchain to the non-blockchain world. For example, let’s say the delivery route of the goods is recorded in the blockchain. Here, the off-chain protocol is connected to sensors that read the short-range communication (NFC) tag of the product at various stations. Then this data is transferred to the blockchain, where it is recorded.
They can be classified in other ways:
Incoming and outgoing oracles: Incoming oracles transmit information from outside the blockchain to the blockchain. Outgoing Oracle does the opposite, it transfers data from the blockchain to the external environment.
Software, hardware and people
Software oracles receive data from the Internet, other blockchains and dApps, APIs, and so on. Hardware Oracle can connect an Internet of Things (IoT) device that reports real-world data to the blockchain. A person can also act as an oracle, as is the case with the Augur prediction market. There the user can bet that a certain outcome will happen.
The Oracle Issue
Decentralization is one of the main philosophies of public blockchains, so they are not at risk of an attack from a single point. Using a centralized oracle for data entry undermines the purpose of a decentralized blockchain.
Attackers do not have to attack blockchain nodes if they can manipulate Oracle used to inject false data into the blockchain. To continue the previous example: a malicious agent controlling Oracle made a bet that the price of ETH would remain below $5,000 in 2022. Thus, he will never allow the oracle to send a price exceeding $5,000 to the blockchain in order for the smart contract to be executed correctly.
Quote data from one source may be affected by a flash memory failure, which leads to a cascading effect when other applications access this data.
To mitigate this problem, Oracle’s decentralized solutions combine data from multiple sources, and use a consensus mechanism to minimize the risk of false positives. Operators who transmit data to the aggregation algorithm are stimulated to report correct information, and are punished for incorrect information. For each correct data report, the contract or the user requesting the data lists a certain value to the protocol. At the same time, the cost is distributed among the operators who provided the data.
Operators bet on a certain value in the protocol: when a consensus is reached rejecting the operator’s data, a predetermined value is removed from the operator’s bid. As in the case of consensus in the blockchain, Oracle reports the correct data as long as 51% of the participants provide the correct information.
Usage examples
To understand the ubiquitous use of the solution, let’s look at some usage examples.
Decentralized Financing (DeFi)
DeFi applications have extensive data needs to provide financial solutions efficiently. For example, the Maker Protocol, which provides loans secured by DAI, relies on price data from Oracles. This allows him to determine how much DAI per unit of cryptocurrency needs to be issued as collateral. It also uses Oracles to ensure that already released DAI are always sufficiently secured.
Operational compatibility
Compatibility protocols can have Oracle’s own solutions or rely on existing ones. This allows information to be freely transferred between different blockchain protocols to ensure coordination. For a multi-chain aggregator of decentralized exchanges (DEX), information must be freely available to offer users the best price.
Supply chains
One of the applications of blockchain technology is to record the full history of the product, which can be independently verified by the consumer. This can be used, for example, to independently confirm that a product originates from a certain country, or to determine its carbon footprint.
To achieve this completely automatically and without conflicts, Oracle must be used in conjunction with a reporting mechanism such as Near Field Communication (NFC) tags. Thus, the entire path of the goods along the supply chain can be entered into the blockchain. Any interested party can subsequently verify this independently and be sure of the reliability of the data.
Prediction Markets
Prediction markets allow users to place bets on the outcome of an event. For example, the result of a football, basketball match, or the winner of an election. The Oracle is obliged to report the results of the event. This allows you to pay out winnings on bets, since the blockchain cannot independently know what event happened in the real world.
Gaming / Gambling
Gambling often relies on random numbers to provide a certain degree of luck and excitement for players. Games can use random numbers provided by oracles. They determine the chances of loot loss, the frequency of misses, the frequency of hits, the frequency of critical hits and other similar game mechanics.
For unique drops, oracles can also check the number of items submitted using NFT (Non-interchangeable Tokens) and confirm their historical drop rate. In gambling, players can individually verify that a deck of cards, a roll of dice, a spin, or any other mechanism used is evidently random, and how it has behaved historically.