Simple definition of Blockchain Oracles
- An oracle is, simply put, a translator for information provided by an outside platform.
- Oracles allow developers access to read real-world data & external systems from within a smart contract.
- Blockchain oracles are third-party services that provide smart contracts with external information. They serve as bridges between blockchains and the outside world.
- Oracles provide the necessary data to trigger smart contracts to execute when the original terms of the contract are met.
- These conditions could be anything associated with the smart contract - temperature, payment completion, price changes, etc. These oracles are the only way for smart contracts to interact with data outside of the Blockchain environment.
Example of a Blockchain Oracle
- Suppose that Alice and Bob place a bet on who the winner of the US presidential election will be. Alice believes that the Republican candidate will win, while Bob believes that the Democrat will be the winner. They agree on the terms of the bet and lock their funds in a smart contract, which will release all the funds to the winner based on the results of the election.
- Since the smart contract cannot interact with external data, it has to depend on an oracle to feed it the necessary information – in this case, the results of the presidential election. After the election is over, the oracle queries a trusted API to find out which candidate has won and relays this information to the smart contract. The contract then sends the funds to Alice or Bob, depending on the outcome.
- Without the oracle relaying the data, there would have been no way to settle this bet in a way that couldn’t be gamed by one of the participants.
The Oracle Problem
- Since smart contracts execute decisions based on data provided by oracles, they are key to a healthy blockchain ecosystem. The main challenge with designing oracles is that if the oracle is compromised, the smart contract relying on it is also compromised. This is often referred to as The Oracle Problem.
- Since oracles are not part of the main blockchain consensus, they are unfortunately not part of the security mechanisms that public blockchains can provide. The trust conflict between third-party oracles and the trustless execution of smart contracts remains a mostly unsolved issue.
- Man-in-the-middle attacks can also be a threat, where a malicious actor gains access to the data flow between the oracles and the contract and modifies or falsifies the data.
Articles on Blockchain Oracles
Videos on Blockchain Oracles