What Are Blockchain Oracles and How Do They Work?
article-147

What Are Blockchain Oracles and How Do They Work?

Basics

Blockchain oracles act as intermediaries between blockchains and the outside world by providing smart contracts with external information that they cannot access on their own. This function is critical for many contractual agreements that require information from off-chain sources to execute.

Oracles play a vital role in the blockchain ecosystem because they expand the scope in which smart contracts can operate beyond their network. Without oracles, smart contracts would have limited functionality and could only access data within their network.

It is important to note that blockchain oracles are not data sources themselves but rather layers that authenticate, verify, and query external data sources before relaying the information. The data transmitted by oracles can take many forms such as price information, payment completion, or sensor measurements.

To retrieve off-chain data, the smart contract must be invoked and network resources must be utilized. Some oracles are capable of not only relaying information to smart contracts but also sending it back to external sources.

Blockchain Oracle Examples

Suppose that Emily and David place a bet on who the winner of the US presidential election will be. Emily believes that the Republican candidate will win, while David 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, 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 Emily or David, 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.

What Types of Blockchain Oracles Exist?

Blockchain oracles have various classifications depending on their characteristics. One oracle can fit into multiple categories. For instance, an oracle that retrieves data from a company website is a centralized inbound software oracle.

Source: Is the Data Obtained From Software or Hardware?

  • Software oracles are an essential type of blockchain oracle that retrieves data from online sources and transmits it to the blockchain. They can obtain information from a vast range of sources on the Internet, such as databases, websites, and servers. Since software oracles are connected to the internet, they can transmit information in real time, making them a popular choice for smart contracts. Software oracles can provide a wide range of information, including exchange rates, digital asset prices, or real-time flight information.
  • Hardware oracles are utilized to obtain information from physical devices and transmit it to the blockchain, enabling smart contracts to connect with the physical world. These oracles interpret real-world events using sensors, barcode scanners, and other data-reading devices and convert them into digital values that smart contracts can comprehend. For instance, a hardware oracle can detect if a truck carrying goods has arrived at a loading dock, which it then communicates to a smart contract. Based on this information, the contract can take action accordingly.

Direction: Is the Information Inbound or Outbound?

Oracles can be classified as inbound or outbound, depending on the direction of the information flow.

  • Inbound oracles transmit information from external sources to smart contracts.
  • Outbound oracles send information from smart contracts to the external world.

A sensor that measures temperature and relays the data to a smart contract is an example of an inbound oracle. In contrast, an outbound oracle can be exemplified by a smart lock that unlocks when funds are deposited to an address, with the smart contract sending this information through an outbound oracle to the mechanism that unlocks the lock.

Trust: Is It Centralized or Decentralized?

  • Centralized oracles are controlled by a single entity and can pose risks due to a single point of failure. Malicious interference from bad actors can impact the smart contract, and the effectiveness of the contract relies entirely on the controlling entity.
  • Decentralized oracles aim to avoid counterparty risk by not relying on a single source of truth. They use multiple oracles to increase the reliability of information and can be referred to as consensus oracles. Some blockchain projects provide decentralized oracle services to other blockchains, and they can be useful in prediction markets where social consensus can verify the validity of outcomes.

While decentralized oracles aim to achieve trustlessness, they do not eliminate trust but distribute it between many participants, similar to trustless blockchain networks.

Other Types of Oracles

  • Contract-Specific Oracles
    • When using a contract-specific oracle, is designed to be used by one smart contract. This can result in the need to develop several oracles when deploying multiple smart contracts. While this approach offers flexibility for tailored use cases, it is also costly and time-consuming to maintain. Companies that require data from various sources may find it impractical.
  • Human Oracles
    • Individuals with specialized knowledge in a particular field can also function as oracles. They can investigate and validate the credibility of information from various sources and convert that data into smart contracts. Because human oracles can use cryptography to verify their identity, the risk of a fraudulent individual posing as an oracle and providing corrupted data is relatively low.

An Important Problem to Know About Oracles

Ensuring the accuracy of data used in smart contracts is a vital role played by oracles. However, the integrity of a smart contract is at risk if the oracle is compromised. Oracles are not part of the blockchain consensus, and this makes them vulnerable to attacks. The conflict between third-party oracles and trustless smart contract execution is a challenging issue that remains unsolved. Malicious actors can also conduct man-in-the-middle attacks, which involve intercepting data transmitted between the oracles and the contract and altering or falsifying it.

Conclusion

For blockchains to achieve widespread adoption, there needs to be a trustworthy method for smart contracts to interact with external information. This is where blockchain oracles come in, as they allow for secure communication between the blockchain and external data sources. Without oracles, smart contracts would be limited to using only internal information, severely limiting their capabilities.

Decentralized oracles can provide important safeguards to reduce risks in the blockchain ecosystem. Their implementation securely and reliably is essential for the continued growth of the blockchain ecosystem. Overall, blockchain oracles are a critical component that is necessary for the broader adoption and use of blockchain technology.

Oracle