What are Smart Contract Oracles: An Explanation
Before discussing oracles, it is essential to first define what smart contracts are.
Simply put, smart contracts are effective computer programs stored in the Blockchain to execute certain operations automatically. They enable people to exchange goods and services for a particular value, once the predefined conditions are met.
But what are smart contract oracles?
In traditional society, an “Oracle” was a person/intermediary through which the deity would speak. The term would also be used to refer to people known to give wise decisions or authoritative opinions.
In crypto world, oracles are codes that link Blockchain with the actual world. They are an agent that collects and authenticates actual-world happenings before submitting facts to the smart contracts.
Of course, this begs for the question: why would a decentralized platform (meant to eliminate intermediaries) rely on third-party oracles? Well, as you will see in the subsequent section, oracles are the crux for the utilization of real-world data in smart contracts.
Why smart contract oracles?
First, it is true that smart contracts are programmed to be self-contained. External authority is not required to make a decision. A deal is autonomously and automatically executed once the predefined conditions are met.
But come to think of it, what happens if some information about the present, past or the future is unknown? For instance, what will be tomorrow’s exchange rate of BTC/USD? Will your flight from Europe to Africa land on time? It is sunny now, but how will the weather be like next week?
This is where the oracles come in handy. Smart contracts rely on oracles to resolve aspects that cannot precisely be predetermined at the point of coding a smart contract. In other words, it is the oracles that make the smart contracts to be street smart.
Think of it as a vending machine that will instantly dispense hot coffee if the oracle says that the temperatures are extremely low at that time. Or as a flight insurance agency that would instantly payout once the oracle communicates that a flight will delay by four hours. By connecting to the real world, smart contracts functionality is enhanced.
To drive the point home, consider this practical example:
- If Jackson works 60 hours from August 2 through August 30, then pay him a salary.
- If France beats Croatia in the world cup final, then send 0.07 BTC from James to Seth.
But how will the smart contract determine if Jackson worked for 60 hours in August 2018? How will smart contracts know if France won the world cup? All the right answers point to oracles.
So, how do oracles determine the truth?
Truth is a provable fact. The truth may be subjective depending on the consulted source. While the above examples are straightforward, the case can be different when you think of a smart contract that operates when the temperature drops in a particular city.
In such cases, the Oracle ought to know which weather sensors to consult in that area. In any City, weather can vary vaguely by location while in some Cities, for instance, San Francisco; the weather can dramatically change depending on your closeness to the coast.
The transaction parties need to precisely communicate with the Oracle in advance on how to determine the weather. Then, after the oracle supplies that information, it elaborates exactly on how it settled on that weather and everyone will be capable of authenticating the same. Thus, oracles offer transparency.
Types of Oracles
Different kinds of oracles conduct various functions. Let’s explore the common ones:
1) Software and Hardware
Software oracles get data feeds from online sources such as websites or application programming interfaces (APIs). For instance, a software oracle can share election outcome data with a smart contract after which the smart contract works as programmed according to the election result.
On the other hand, hardware oracles fetch data from the physical world via sensors and scanners. For example, a hardware oracle can collect data from a fruit shipment RFID sensor into a smart contract which executes and pays the fruit supplier on delivery.
2) Inbound or Outbound
Inbound oracles can be hardware or software. Their distinctive characteristic is that they access data outside the Blockchain and give it to a smart contract. For example, an inbound Oracle can share results of a soccer game to a smart contract to execute payment for the bet winner.
Just as the name suggests, outbound oracles send data from the Blockchain network to the outside world. A good example here would be an outbound Oracle sending a signal to a smart lock in a vacation home to open; once a renter sends payment to their Blockchain wallet address.
3) Centralized or Decentralized
Centralized oracles are simply single oracles that give data to a smart contract. The problem with using centralized oracles is that they are susceptible to downtime. They may also be insecure since they are vulnerable to critical issues that can compromise a whole smart contract.
Nonetheless, the savior here is decentralized oracles whose integrity is verified through smart contracts. Just like how Ethereum and Bitcoin are structured, decentralized oracle networks are programmed in a manner that they cannot easily be corrupted. Therefore, they are trustless.
What are the challenges that oracles need to overcome
Just like any other technology, Oracles have their own share of challenges too. They are vulnerable to hacking, error, and corruption.
To get rid of corruption, programmers should ensure the oracle’s ability and reputation to earn payments in the long-run is more valuable as compared with the possible gains from dishonesty in the short-term.
Oracles should earn or lose money according to their performance. In other words, oracles, ought to be compensated for honesty and penalized for lying.
What about hacking? Yes, it is true that data feeds that smart contracts depend on can be hacked. The viable solution here is to get consensus from various oracles.
The third challenge is that oracles can make mistakes even when they are not corrupted or hacked. This issue can be solved by incentivizing people to watch out and correct any possible errors. Platforms such as Augur can be helpful here.
Conclusion
In a nutshell, if a smart contract is the “brain” of a Blockchain network, then oracles are the “eyes and ears.” To make appropriate judgment smart contracts need to consult and an oracle whether the conditions from the physical world are met.
That said, smart contracts oracles could just be the feature that will unlock the potential of Blockchain technology. The entry of companies specializing in the development of oracles will go a long way in boosting capabilities of the already robust Blockchain networks.
Some of the notable organizations in this sector include Oraclize, ChainLink, Reality Keys, Delphi Systems, Witnet, Concurrence, Augur, and Gnosis, and of course, MonitorChain.