Ethereum brought to life the idea of smart contracts – which were initially proposed by Nick Szabo in the early 90s. After the introduction of blockchain, smart contracts were designed to run on this new technology, where they autonomously and transparently execute a function when specific conditions are met. Thanks to their fundamental trust-less feature, smart contracts have eliminated the need for third-parties, making transactions frictionless and more affordable.
Even though they work automatically, smart contracts have to be fed an input so as to generate the desired output. This is where the concept of oracle comes into play. Essentially, an oracle in this context is a data feeder that provides smart contracts with inputs, consequently determining the output.
How it works
Think of a gamble between two people; Brad and Sam. Suppose they both place their wagers on the outcome of a basketball game. Brad bets on team A while Sam bets on team B. Both Sam and Brad agree on terms of the bet and lock their funds in a smart contract agreement.
For the bet to be settled and the funds released to the winner, the smart contract has to depend on a trusted oracle to feed it the necessary data – in this case, the results of the basketball game. At the end of the game, the oracle queries a reliable data source to find out the winning team, after which the data is relayed to the smart contract. The funds are then sent to either Brad or Sam, depending on the game’s outcome.
The Oracle Problem
From the cited instance above, smart contracts must have access to off-chain data – data that is stored outside the network – for them to be used in real-world cases. To bridge the gap between off-chain data and smart contracts, centralized oracles have been tasked with verifying and authenticating the external data, or rather the input that guides the execution of smart contracts agreements.
However, centralized oracles betray the decentralized tenet of the blockchain revolution. Even worse, they are vulnerable to manipulation, which ends up compromising the entire contract. This problem has incentivized blockchain developers to come up with decentralized oracle solutions in the spirit of maintaining data integrity. As such, decentralized oracles leverage the abilities of blockchain by acting as a layer that queries, authenticates, and protects external data from manipulation before it’s fed as input into a smart contracts agreement.
Types of Blockchain Oracles
Blockchain oracles come in various forms which include:
Blockchain software oracles are the most common type of data authenticators. They verify information from such online sources as websites, online public databases, or any other data source connected to the internet.
These oracles are considered to be the most powerful type of blockchain oracle due to their inherent interconnectedness with the internet. This is especially true considering the proliferation of the internet in almost all spheres of life.
As such, software oracles are relied on to provide the most up-to-date information to smart contracts. Software oracles are, therefore, best suited for use in verifying asset exchange rates, digital asset prices, and flight information in real-time.
Hardware oracles are tasked with translating real-world data into a digital form that can be interpreted by smart contracts. For this reason, hardware oracles rely on electronic data readers like barcode scanners, that translate information into verified digital values before being loaded as input into a smart contract.
A good example of their use is in the supply chain industry, particularly the tracking of goods. When sending goods to a certain location, they are tagged with an RFID tag whose data is read by a scanner and fed into the smart contract agreement.
Inbound and Outbound Oracles
Inbound oracles transmit information from external sources to a smart contract, whereby upon receiving the data, the contract initiates the path of execution. From the example above on the basketball game, the source of information providing the final results of the game can be classified as an inbound oracle.
Once the information is loaded into the smart contract, the terms of the bet are executed. As such, inbound oracles can be termed as “contract execution triggers.” They can be used in asset trading whereby if an asset reaches a specific price, the contract will then execute the buying or selling of the asset.
Outbound oracles are the direct opposite of inbound oracles in that they relay information to external sources. A good use case scenario of an outbound oracle can be found in a smart lock that is opened by depositing funds. Once it’s verified that the funds have been deposited in the designated address, the smart contract sends this information through an outbound oracle, which then relays the data to an external mechanism that eventually unlocks the smart lock.
As the name suggests, consensus-based oracles work by collaborating data from multiple sources. For example, in the basketball game example cited above, a consensus-based oracle would work by verifying the game results from several sources. If all the sources provide the same data, it ascertains the accuracy and, therefore, the terms of the smart contract can be executed.
As far as data integrity is concerned, consensus-based oracles stand as a viable solution to data manipulation. Think of a smart contract agreement that relies on a single data source. Counterparties could alter the information – resulting in unfair settlement of the contract. However, when using consensus-based oracles, any discrepancies in the data due to manipulation can be noted and resolved.
For instance, if the compromised data source provides different information from the other verified sources, the smart contract can be programmed to the agreement based on the data from the other sources whose information is in sync and correct.
Oracles, whether centralized or decentralized, play a vital role in bringing blockchain into the real world. They widen the scope of blockchain’s access to information, bringing its capabilities to various use cases. Decentralized oracles, in particular, safeguard data integrity, eliminating the systematic risk from the blockchain ecosystem. This ensures contracts are executed securely and in a trust-less manner, facilitating the adoption and maturation of blockchain technology.