Blockchain Oracles Explained
Last Updated: 19th December 2018
A blockchain oracle is a third-party information source that has the sole function of supplying data to blockchains which permit for the creation of smart contracts. A smart contract at a fundamental level is simply a self-executing piece of code; smart contracts evaluate incoming data from an oracle and initiate a flow of execution depending on the information received.
To illustrate, consider that Alice and Bob initiate a wager on what the temperature will be on a Saturday. Alice believes that the temperature will be 20 °C or above, conversely, Bob believes that the temperature will be 19 °C or below (to the nearest whole number). They design a smart contract (which they will both send funds to) that pays out to the winner depending on what the temperature is. In order for the smart contract to determine the temperature, and thus, pay out to the winner, it must query a trusted source, or an oracle, and use the result to begin a path of execution. After querying a local news website for the weather, the value returned is a temperature reading of 24 °C on the Saturday. The smart contract then executes on its conditions and sends all the funds to Alice.
Types of Oracles
Oracles provide additional functionality to smart contracts by providing a means for them communicate outside of a decentralized blockchain network. Blockchain oracles can take on numerous forms, some of those forms include but are not limited to:
- Software oracles
- Hardware oracles
- Inbound oracles
- Outbound oracles
- Consensus based oracles
Software oracles – This form of oracle typically includes online sources of information that are easily accessible, for example, websites and public databases. They typically provide information such as: temperature readings, public transport information and the current price of various financial assets. Software oracles are perhaps the most powerful type of oracle because of their inherent interconnectedness to the internet; this connection allow software oracles to supply the most up-to-date information to smart contracts.
Hardware oracles – This form of oracle is typically tasked with sending data to smart contract as a result of an occurrence in the physical world. For example, in supply chain management, if an object with an RFID tag was to arrive at a particular warehouse, this data can then be sent to a smart contract. As a result, hardware oracles can facilitate for the tracking of goods along the supply chain.
Inbound oracles – This form of oracle has the function of simply supplying data to smart contracts. The supplied data is external to the smart contract and upon receiving information, will begin a path of execution. The news website supplying temperature readings in the example above would be classed as an inbound oracle.
Outbound oracles – These oracles communicate smart contract data to an external source. Using our previous example, once Alice has been identified as the victor of the wager, the smart contract can communicates this information to the wallet provider in order to automatically update her balance to reflect an increase in funds. In this instance, the smart contract itself is operating as an outbound oracle.
Consensus based oracles – The function of this oracle type is to query multiple oracle sources, and based on the consensus of them, arrive at an outcome. For example, instead of using one website as an oracle source in the previous example, a total of 4 could have been used. If all the oracles return the same temperature reading, the smart contract can successfully execute.
Oracles Require Trust
However, even with the demonstrable advantages offered by oracles, there exists one disadvantage:
- Oracles require trust
Oracles require trust – The data sources from which oracles use to obtain, and then transmit information to smart contracts, must be seen as credible. Using the previous example, if Alice had somehow gained access to the local news website, it would then be trivial for her to return a temperature reading of 24 °C, therefore allowing her to win the wager. In short, if the data being supplied to smart contracts by oracles prove to be faulty, there exists security concerns as to the validity of the executing smart contract.
Conversely, a possible remedy for this problem would be to request data from multiple oracles as opposed to a single one. If an oracle returned a temperature reading of 24 °C, but 4 other oracles returned a value of 18 °C, additional conditions could be programmed into the smart contract to resolve the conflict. The smart contract may choose to accept only the majority value, in this case 18 °C, which would result in Bob being the victor of the wager. On the other hand, the smart contract can be programmed to not execute at all ,and therefore, require the intervention of both Alice and Bob.
Conclusion
To conclude, blockchain oracles are a third-party information source that supply data to smart contracts. They increase the scope of what blockchain protocols can do by providing a means for them to communicate outside of their own network.
Oracles require a level of trust that is contradictory to the trustless and decentralized nature of blockchain-based protocols. As a result, smart contracts require an increased level of complexity, such as, sourcing data from multiple oracles in order to mitigate the amount of trust placed in any one oracle.