What is a Blockchain Oracle?
A blockchain oracle is a third-party service that provides external data to smart contracts, acting as a bridge between the blockchain and the outside world.
Blockchains and smart contracts cannot access off-chain data (data outside the blockchain network). However, for many contractual agreements, having relevant information from the external world is crucial for executing the agreement.
Blockchain oracles provide a link between off-chain and on-chain data, enabling this functionality. Oracles can expand the operational scope of smart contracts and are essential to the blockchain ecosystem. Without blockchain oracles, smart contracts would only be able to access data within their own network, severely limiting their utility.
It is important to note that a blockchain oracle is not the data source itself but rather a layer that queries, verifies, and authenticates external data sources before transmitting the data. Oracles can transmit various types of data, including price information, payment confirmation, or temperature data measured by sensors.
To fetch data from the external world, a smart contract must be invoked, and network resources must be consumed. Some oracles can not only send information to smart contracts but also transmit information back to external data sources.
There are many different types of oracles, and how a blockchain oracle operates depends entirely on its design purpose. This article will introduce some of these types.
What Are the Types of Blockchain Oracles?
Blockchain oracles can be categorized based on various characteristics:
-
By Source: Is the data sourced from software or hardware?
-
By Direction of Information Flow: Is it inbound (from external to the blockchain) or outbound (from the blockchain to external)?
-
By Degree of Trust: Is it centralized or decentralized?
A single oracle can belong to multiple categories. For example, an oracle that fetches data from a company website is a centralized, inbound, software oracle.
Software Oracles
Software oracles interact with online information sources and transmit this data to the blockchain. This data can come from online databases, servers, or websites—essentially any data source on the internet.
By being connected to the internet, software oracles can not only provide information to smart contracts but also transmit it in real time. As a result, they are the most common type of blockchain oracle.
The information provided by software oracles often includes foreign exchange rates, digital asset prices, or real-time flight information.
Hardware Oracles
Some smart contracts need to interact with the physical world. Hardware oracles are designed to retrieve information from the real world and supply it to smart contracts. This data can be transmitted via electronic sensors, barcode scanners, or other data-reading devices.
In essence, hardware oracles can "translate" real-world events into digital values that smart contracts can understand.
An example is a sensor that checks whether a truck carrying goods has arrived at a loading dock. If it has, the sensor relays this information to the smart contract, which can then execute decisions based on it.
Inbound and Outbound Oracles
Inbound oracles are designed to transmit information from external data sources to smart contracts, while outbound oracles send information from smart contracts to the external world.
An example of an inbound oracle is transmitting temperature data measured by a sensor to a smart contract. An example of an outbound oracle could be a smart lock: if funds are deposited into a smart contract address, the contract can use an outbound oracle to send this information to the smart lock's unlocking mechanism.
Centralized and Decentralized Oracles
A centralized oracle is controlled by a single entity and is the sole provider of information for smart contracts. However, relying on a single data source can be risky, as the validity of the smart contract depends entirely on the entity controlling the oracle. Additionally, any malicious interference by bad actors can directly impact the smart contract. The main issue with centralized oracles is the single point of failure, making smart contracts more vulnerable to exploits and attacks.
Decentralized oracles share some goals with public blockchains, such as avoiding counterparty risk. By not relying on a single data source, decentralized oracles improve the reliability of the information received by smart contracts. Smart contracts query multiple oracles to determine the validity and accuracy of data, which is why decentralized oracles are also called consensus oracles.
Some blockchain projects provide decentralized oracle services to other blockchains. Decentralized oracles are also useful in prediction markets, where social consensus can validate the outcome of certain events.
While decentralized oracles aim to be trustless, it is important to note that, much like trustless blockchain networks, they do not eliminate trust entirely but rather distribute it among many participants.
Contract-Specific Oracles
Contract-specific oracles are designed for a single smart contract. This means that deploying multiple smart contracts requires developing an equal number of contract-specific oracles.
These oracles are time-consuming and costly to maintain. Companies that need to pull data from various sources may find them impractical. On the other hand, contract-specific oracles can be designed from scratch for specific use cases, giving developers high flexibility to tailor the oracle to exact needs.
Human Oracles
Individuals with expertise in a specific field can sometimes act as oracles. These individuals can research and verify the authenticity of information from various sources and translate it for smart contracts. Since human oracles can cryptographically verify their identity, the likelihood of fraudsters impersonating them and providing corrupted data is relatively low.
The Oracle Problem
Since smart contracts execute decisions based on data provided by oracles, oracles are critical to the health of the blockchain ecosystem. The main challenge in designing oracles is that if an oracle is compromised, the smart contracts relying on it are also compromised. This issue is commonly referred to as "The Oracle Problem."
Because oracles are not part of the core blockchain consensus, they are unfortunately not covered by the security mechanisms provided by public blockchains. The trust conflict between third-party oracles and the trustless execution of smart contracts remains unresolved.
Additionally, man-in-the-middle attacks pose a threat, where malicious actors gain access to the data flow between the oracle and the smart contract, altering or forging the data.
Conclusion
A reliable mechanism that facilitates communication between smart contracts and the external world is crucial for increasing global blockchain adoption. Without blockchain oracles, smart contracts would be limited to data within their own networks, significantly restricting their capabilities.
In the future, decentralized oracles may introduce safeguards to eliminate many systemic risks in the blockchain ecosystem. Blockchain oracles remain a key component of blockchain ecosystem development and must be implemented in a secure, reliable, and trustless manner.