An oracle has long described a person through whom a deity speaks, or a person known for giving wise or authoritative decisions or opinions, but in the cryptoverse, oracles have a different definition. Oracles are code connecting a blockchain with the real world. They provide the data that smart contracts need in order to execute successfully.
Oracles are, ironically, an intermediary in a technology that is supposed to eliminate intermediaries. Oracles are also smart contracts themselves.
Smart contracts are computer programs stored on a blockchain. A common use oracles is to let people exchange things of value automatically when a triggering event occurs. But at the time these exchange agreements are created, some detail about the future is unknown. To know when the triggering event has occurred, the smart contract needs an oracle to supply that unknown detail.
Consider these examples of smart contracts:
- If Allie works 80 hours from June 4 through June 15, then pay her salary.
- If the Warriors beat the Cavaliers in game two of the NBA Finals, then send 0.05 bitcoin (BTC) from Jason to Victor.
- If Maddie loses American Idol, then send 0.5 ether (ETH) from Karen to Rhonda.
But how will the smart contract know if Allie worked 80 hours, if the Warriors won, or if Maddie lost? With the help of an oracle.
How Oracles Determine the Truth
Truth is subjective, however. “No” you’re probably thinking, “Truth is objective. It’s a provable fact.” But the truth can vary depending on what source you consult and when. In the examples above, the answer should be straightforward. But what about a smart contract that executes when the weather drops below a certain temperature in a certain city?
The oracle would need to know which temperature sensor or sensors in the region to consult. The weather in any city can vary slightly by location, and in some cities, like San Francisco, it can vary dramatically depending on how close you are to the coast. The parties to the transaction need to tell the oracle in advance exactly how it should determine the weather. Then, when the oracle later supplies this information, it will describe exactly how it determined the weather and anyone will be able to verify it. Thus, oracles provide transparency.
Types of Oracles
Different types of oracles perform different functions.
Software or Hardware
Software oracles retrieve data from the internet from sources such as application programming interfaces (APIs) or websites. A software oracle could provide an election result to a smart contract, for example. The smart contract would then execute as programmed based on the election result.
Hardware oracles retrieve data from the physical world: from scanners and sensors, for example. A hardware oracle could bring data from an RFID sensor in a mango shipment to a smart contract that would execute and pay the mango supplier for delivery.
Inbound or Outbound
Inbound oracles can be software or hardware oracles. Their key feature is that they obtain information from outside the blockchain and provide it to a smart contract. An inbound oracle could provide the result of a basketball game to a smart contract to pay the winner of a bet.
Outbound oracles send information from the blockchain to the outside world. They could tell a smart lock on a vacation home to unlock after its blockchain address receives payment from a renter.
Centralized or Decentralized
Decentralized oracles are networks of oracles whose integrity is verified using smart contracts. They don’t require trust because they are programed in such a way that corruption and theft are not profitable, similar to how blockchains like bitcoin and ethereum are structured.
Centralized oracles are single oracles that provide information to a smart contract. However, centralized oracles are vulnerable to downtime, and they are considered insecure because of their susceptibility to serious problems that can compromise an entire smart contract.
Can We Trust Oracles?
The three big problems oracles can be susceptible to are corruption, hacking and error. We don’t want an oracle participating in a high-value prediction market to be able to earn more from colluding with a bad actor than from collecting fees for providing an honest service.
To prevent this problem, programmers must make the oracle’s reputation and ability to earn payments in the long run more valuable than the potential gains from dishonesty in the short run. We want oracles to earn or lose money and improve or worsen their reputations based on their performance. In other words, oracles should be rewarded for telling the truth and punished for lying.
Oracles can be required to stake a large sum of money on the accuracy of the data they feed to smart contracts. In addition, smart contracts can be programed to rely on answers from the consensus of multiple oracles instead of just one (though there’s still some risk here in that multiple oracles could be compromised).
A second problem is that oracles, or the data feeds they rely on, could be hacked. Again, an imperfect solution is to seek consensus from multiple oracles.
And a third problem is that even non-corrupted, non-hacked, well-intentioned oracles can make mistakes. A possible solution here is to incentivize people to watch out for these mistakes and correct them.
One platform that tries to do this is Augur. This decentralized oracle and prediction market platform allows people to earn REP (reputation) tokens for disputing or confirming the outcome of any Augur market. The users who report accurate results earn a financial reward. REP tokens give holders votes in resolving predictions in Augur’s market. They also pay the holder half the trading fees that market generates, meaning they work a bit like dividend-paying stocks. The holder can also potentially earn money if the value of their Augur tokens increase over time.
Relying on oracles and smart contracts saves human effort and reduces the number of parties involved in settling transactions. Compared to paper contracts, this system saves time and money.
Despite the potential problems or challenges in relying on oracles, the value of using oracles and smart contracts is gaining more and more acceptance. Big names in this space include Oraclize, ChainLink, Concurrence, Augur, Gnosis, Reality Keys, Delphi Systems and Witnet. As interest in smart contracts grows, the utility and value of oracles will lead to even greater innovations and safeguards.
Recent articles by Eric C. Jansen: How to Store Cryptocurrency Safely
Disclaimer: The information in this article is for informational and educational purposes only. Investing in ICO’s, cryptocurrencies or tokens is highly speculative, and the market is largely unregulated. Anyone considering it should be prepared to lose their entire investment.