What Are Blockchain Oracles and How Do They Work?
![](https://cdn.prod.website-files.com/62cd593e955c2638cf28f54d/64928b7bc63f0d9660582aa9_31Gae1fyRk7nSKDvbw0LUDxSxHaJZg81dZytcEtUNiAp8fB-WBId5HdzK8kqicSUs7xHf94GsxuhWOtiGLAIVH-Rr2chNNUX9ZUFziAgCtzLvfmegflB_c3JbCeL7ioLSYpxTdCyWz_8PzQuAUKPFO0.png)
What is a Blockchain Oracle?
A blockchain oracle is an independent third-party service that provides smart contracts with data (on-chain) from the outside world (off-chain). Blockchain oracles serve as the bridge between the digital world of blockchain and the physical world, providing smart contracts with the real-world data they need to execute. Without blockchain oracles, smart contracts would be limited to data within the blockchain network, significantly limiting their use and virtually paralyzing the network.
The Role of Blockchain Oracles in Smart Contracts
Smart contracts are self-executing contracts that automatically perform actions when predetermined conditions are met. However, for many contractual agreements, having relevant information from the outside world is vital to execute the agreement. This is where blockchain oracles come into play.
Since smart contracts cannot interact with external data on themselves, they have to depend on an oracle to feed it the necessary information.
Different Types of Blockchain Oracles
Blockchain oracles can be classified based on various qualities, including the source of data, the direction of information, and the level of trust.
Software Oracles
Software oracles interact with online information and data sources to transmit them to the blockchain. The information can be obtained from various online sources like databases, servers, and websites. Any data source available on the internet can be used. Information typically provided by software oracles can include exchange rates, digital asset prices, or real-time flight information.
Hardware Oracles
Hardware oracles gather data from the real world and transmit it to smart contracts. This data can come from various sources, such as electronic sensors and barcode scanners. Information-reading devices. For example, a car crosses a barrier where movement sensors detect the vehicle and send the data to a smart contract.
Inbound and Outbound Oracles
Inbound oracles transfer data from outside sources to smart contracts, while outbound oracles transfer data from smart contracts to the outside world. An example of an inbound oracle tells a smart contract what temperature a sensor measures. An example of an outbound oracle can be considered a smart lock. If funds are deposited to an address, the smart contract sends this information through an outbound oracle to a mechanism that unlocks the smart lock.
Centralized and Decentralized Oracles
A single entity controls a centralized oracle and is the sole information provider for the smart contract. Decentralized oracles aim to achieve the same goal as public blockchains: eliminating counterparty risk. They enhance the accuracy of data used in smart contracts by obtaining information from multiple sources instead of depending on a single source.
Consensus-based Oracles
Consensus-based oracles employ a consensus algorithm and multiple oracles to ensure the accuracy and reliability of data in smart contracts. By gathering information from several sources, such as news websites, they verify the authenticity of the data before it is added to the blockchain. It helps to ensure that the information stored on the blockchain is trustworthy.
Compute-enabled Oracles
Compute-enabled oracles are used for computations that are too complex or resource-intensive to be done on the blockchain. These oracles can generate verifiable computations of randomness, often used when randomness needs to be computed off-chain due to network throughput limitations or economic disincentives. For instance, non-fungible tokens (NFTs) are often minted in sets, with users minting their NFTs randomly. Using oracles to generate these verifiable random functions (VRFs) ensures the minting process is random, fair, and verifiable via mathematical algorithms.
How Do Blockchain Oracles Work?
Blockchain oracles are external data sources that provide information to smart contracts. They bridge the blockchain and the real world, enabling smart contracts to interact with data outside their network.
Oracles follow a simple process to provide data to the blockchain:
Data Source: The oracle receives data from a selected source. This could be an online information feed, a sensor, or other data providers.
Data Verification: The oracle verifies the data to ensure its accuracy. This step is crucial to prevent the execution of smart contracts based on false information.
Data Transmission: After verification, the oracle sends the data to the blockchain. The smart contract can then use this data to execute its code.
The Importance of Oracle Reputation & Trust
Users and developers can monitor and filter between blockchain oracles based on their historical performance. This is possible because oracles sign and deliver their data onto an immutable public blockchain ledger. Therefore, their performance history can be analyzed and presented to users through interactive dashboards. This makes the reputation and trust of an oracle key to its selection and popularity.
Since smart contracts execute based on the data provided by blockchain oracles, the integrity of the smart contract depends on the reliability of the oracle. If the oracle provides inaccurate or malicious data, it could lead to the incorrect execution of the smart contract, which could have serious consequences.
The Oracle Problem
While blockchain oracles play a crucial role in the functioning of smart contracts, they also present a significant challenge known as the "Oracle Problem." This problem arises from the fact that while blockchains are decentralized and reduce the possibility of single points of failure, using blockchain oracles introduces potential centralization and single points of failure back into the system.
This highlights the security and trust issues associated with using oracles. Since smart contracts execute based on the data provided by oracles, the integrity of the smart contract relies on the accuracy and reliability of the oracle. If oracles are not properly decentralized, they could become vectors for attacks seeking to gain from manipulating data choke points in the network.
The authenticity and security of the data need to be verified just the same as blockchains through decentralized rounds of consensus on newly formed blocks. The data needs to be updated frequently so that the smart contracts do not contain false information and manipulated data.
Solving the Oracle Problem
The oracle problem is a major challenge in the blockchain space. It refers to the difficulty of ensuring the reliability and integrity of oracles. Blockchains can't natively access off-chain data by design, and this limitation necessitates the use of oracles, but it also introduces potential security risks.
Oracles are critical because most smart contract use cases, like DeFi, require knowledge of real-world data and events happening off-chain. Therefore, solving the oracle problem is of utmost importance. This involves creating decentralized oracles to prevent data manipulation, inaccuracy, and downtime.
Decentralized Oracles
Decentralized oracles are a solution to the oracle problem. Most blockchain networks use decentralized oracles to mitigate the risk of data corruption. They eliminate the single point of failure associated with centralized oracles. These oracles source data from multiple providers, which is only considered valid if there is consensus among the providers.
A Decentralized Oracle Network (DON) combines multiple independent Oracle node operators and reliable data sources to establish end-to-end decentralization. This approach reduces the risk of manipulation and increases the reliability of the data.
Chainlink is a notable example of a DON. It uses multiple layers of decentralization to ensure the reliability and security of its oracles. Chainlink Price Feeds, for instance, use this multi-layered decentralization approach to provide accurate and reliable data to smart contracts.
Conclusion
Blockchain oracles play a vital role in the blockchain ecosystem and the functionality of smart contracts, providing the crucial link between smart contracts and the outside world, enabling them to interact with real-world data. While they present a few challenges, solutions are being developed to ensure their reliability and trustworthiness. As blockchain technology continues to evolve, the role of oracles is becoming increasingly important.