Blockchain Oracles Explained: Decentralized Oracles in DeFi
Oracles deliver real-world data to smart contracts that operate on blockchain technology — safely, reliably, and back again.
Updated February 4, 2022 • 4 min read
Oracles provide external data to smart contracts that operate on blockchain technology. They are essentially a form of communication between the outside world and the world of blockchain. Because blockchains and smart contracts are closed systems — where there are rigid processes for connecting to external data sources — oracles present a way of securely providing off-chain data to a blockchain network’s on-chain environment. Here, we discuss a few different types of oracles and cover the potential challenges that oracles face within their role of executing smart contracts.
Blockchain Oracles Explained: Why Do We Need Oracles?
Before we dive into what oracles actually are, it is helpful to understand why they were created and the problem they aim to solve. Oracles are complex computerized systems that connect data from the outside world (off-chain) with the blockchain world (on-chain).
Most blockchains have native cryptocurrencies that are used to transfer value, enable the operations of the protocol, or facilitate governance. Some blockchains also enable smart contracts: computer programs that run within a blockchain protocol and execute a predetermined set of actions automatically when certain conditions are met in a traceable and irreversible manner. Smart contracts are executed without a third party, and can be designed to carry out almost any contract imaginable.
For example, if you were purchasing a house with cryptocurrency, a simple smart contract might be drafted for the sale. It would say something like “if person A sends the required funds to person B, then the deed for the house is transferred from person B to person A.” Once the conditions of the smart contract are met, it is irreversibly executed according to its coded programming. There is no need to rely on traditional third parties to initiate or execute the contract.
However, there needs to be a way for blockchains and on-chain smart contracts to make use of external, off-chain data in order for smart contracts to have any real-world applications. In the above example of a real estate transaction, off-chain data might be proof of successful payment, or proof of receipt of the deed. And as blockchains are self-contained systems, this is where oracles come into play.
Blockchain Oracles: Providers of External Data
Oracles present a way for a blockchain or smart contract to interact with external data. They act like an application programming interface (API) to the world outside of blockchain. There are many cases where outside data needs to be communicated to the closed blockchain system — particularly when smart contracts are connected to real-world events. Crypto oracles query, verify, and authenticate external data and then relay it to the closed system. That authenticated data would then be used to validate a smart contract.
Inbound Versus Outbound Oracles
Oracles establish a two-way line of communication with blockchains: data can be sent in, or transferred out. While outbound oracles can bring blockchain data to the outside world, it’s more common for inbound oracles to bring off-chain — or real-world data — to the blockchain. The imported information can represent almost anything — from asset price fluctuations, to weather conditions, to proof of successful payments.
A frequent programmable scenario for inbound oracles could be: “If an asset hits a certain price, then place a buy order.” As another example, imagine person A bets person B that it’s going to rain for one week straight. The bet amounts would be locked in a smart contract, an oracle would provide accurate and immutable weather data reporting, and the funds would be delivered to person A or person B — depending on if the data showed that it rained for one week straight.
In contrast, outbound oracles inform the outside world of an event that took place on-chain. For example, a smart contract might be programmed to unlock an internet-enabled smart lock on a rental unit in the real world if a cryptocurrency payment is received at a specific crypto wallet address.
Software Versus Hardware Oracles
Most crypto oracles process digital information, though this isn’t always the case. Software oracles deliver data from digital sources such as websites, servers, or databases, while hardware oracles deliver data from the real world. Software oracles can deliver real-time information such as exchange rates, price fluctuations, or flight information. Hardware oracles can deliver and relay information from camera motion sensors, radio frequency identification (RFID) sensors, thermometers, or barcode scanners.
The Oracle Problem: Centralized Oracles
Centralized oracles are controlled by a single entity and act as the sole provider of data for a smart contract. They require contract participants to place a significant amount of trust in one entity. They also represent a single point of failure, which can threaten the security of a smart contract: If an oracle is compromised, so is the smart contract. The accuracy and effectiveness of smart contracts rely heavily on the quality of data they are provided with — and thus oracles retain a significant amount of power over smart contracts.
The whole reason that smart contracts were invented was to avoid counterparty risk and an over-reliance on third parties. Oracles enable contracts to be executed between trustless parties, but (especially when they become over-centralized) they can risk becoming the middlemen they sought to replace. Known as the oracle problem, the preservation of privacy, security, and fairness — and avoiding over-centralization that could damage the relationship between smart contracts and blockchains — then becomes the key challenge that oracles face.
Decentralized oracles try to achieve trustlessness and deterministic results that rely on cause- and-effect rather than on individual relationships. They seek to achieve these results in the same way a blockchain network does: by distributing trust among many network participants. By leveraging many different data sources, and implementing an oracle system that isn’t controlled by a single entity, decentralized oracle networks have the potential to provide an increased level of security and fairness to smart contracts.
Centralized oracles themselves can become just as compromised and susceptible to manipulation as any other third party. For this reason, many blockchain projects — including Chainlink (LINK), Band Protocol (BAND), Augur (REP), and MakerDAO (builders of DAI) — are developing (or have developed) decentralized oracles. The potential for decentralized oracles to solve the oracle problem and greatly expand the use cases of smart contracts across many different markets is an exciting and ongoing development for cryptocurrencies and for the blockchain space overall.
Cryptopedia does not guarantee the reliability of the Site content and shall not be held liable for any errors, omissions, or inaccuracies. The opinions and views expressed in any Cryptopedia article are solely those of the author(s) and do not reflect the opinions of Gemini or its management. The information provided on the Site is for informational purposes only, and it does not constitute an endorsement of any of the products and services discussed or investment, financial, or trading advice. A qualified professional should be consulted prior to making financial decisions. Please visit our Cryptopedia Site Policy to learn more.
Is this article helpful?