From community submissions. Author: Vallery Mou


Content

  • What is an oracle on a blockchain?

  • Example of using oracles

  • Varieties of oracles

    • Software oracles

    • Hardware oracles

    • Incoming and outgoing oracles

    • Centralized and decentralized oracles

    • Contract-based oracles

    • Oracle Man

  • Problematic aspects of oracles

  • Conclusion


What is an oracle on a blockchain?

Oracles are third-party services that provide smart contracts with communication with external sources of information, i.e. act as a bridge between blockchains and the outside world.

Blockchains and smart contracts cannot access data off-chain (outside the network). However, for many contracts, it is vital to be able to extract relevant information from the outside world in order to comply with the terms of the agreement.

In such circumstances, oracles come into play as they provide communication between external and internal sources. Oracles are a vital element of the blockchain ecosystem as they extend the capabilities of smart contracts. Without oracles, smart contracts will be extremely limited in that they can only access data within their network.

It is worth noting that the oracle itself is not a data source, but rather one of the layers that requests, verifies and authenticates all readings from external sources, and then relays this information. The data transmitted by oracles comes in many forms: price information, successful completion of a payment, or temperature measured by a sensor.

To request data from outside, you need to activate a smart contract and spend network resources on it. Some oracles also have the ability to not only transmit information to smart contracts, but also send it back to external sources.

There are many different types of oracles, but how it works depends entirely on what it is intended for. In this article we will look at some of these varieties.


Example of using oracles

Suppose Alice and Bob are betting on who will win the US presidential election. Alice believes that the Republican candidate will win, and Bob believes that the Democratic representative will win. They agree to the terms of the bet and lock a certain part of the funds in a smart contract, which provides the winnings to the winner based on the election result.

Since the smart contract cannot interact with external data sources, it is completely dependent on the oracle to provide it with the necessary information, in this case, the result of the presidential election. After the election is over, the oracle makes a request to the trusted API to find out which candidate won and passes this information to the smart contract. The contract then sends the funds to Alice or Bob, depending on the outcome.

If it were not for the activity of the oracle, which relays data packets, there would be no way to determine the winner without third-party intervention.


Varieties of oracles

Oracles on a blockchain can be classified based on a number of different qualities:

  • Source – Does the data come from software or hardware?

  • Direction of information – incoming or outgoing?

  • Trust – Centralization or Decentralization?

One oracle can fall into several categories at once. For example, an oracle that receives information from a company's website is a centralized, software-based oracle.


Software oracles

Software oracles interact with online information sources and transmit it to the blockchain. This information can come from online databases, servers, websites, in fact, from any data source on the Internet.

The fact that software oracles are connected to the Internet allows them to not only provide information for smart contracts, but also broadcast it in real time. This makes them one of the most common oracles on the blockchain.

Basically, the data that software oracles rely on includes: exchange ratings, digital asset prices, real-time flight information, etc.


Hardware oracles

For some smart contracts, interaction with the real world is a necessity. Hardware oracles are designed to take information from the physical world and make it available to smart contracts. Such information can be transmitted from sensors, barcode scanners and other information reading devices.

At its core, a hardware oracle “translates” real events into digital values ​​that can be read using smart contracts.

An example would be a sensor that checks whether a truck carrying goods has arrived at the loading bay. If so, it passes the information to the smart contract, which can then make a decision based on that.

If you would like to learn more about this topic, we recommend that you read the following article: Blockchain Technology Use Cases: Supply Chains.


Incoming and outgoing oracles

Incoming oracles extract information from external sources and transmit it to smart contracts, while outgoing oracles act in the reverse order, i.e. The data they receive from the smart contract is transferred by the oracle to an external source.

For example, the incoming oracle tells the smart contract what temperature the sensor is measuring, and the outgoing oracle regulates the operation of the smart lock. If funds are credited to the address, the smart contract sends this information through an outgoing oracle to the mechanism, which unlocks the smart lock.


Centralized and decentralized oracles

The centralized oracle is controlled by one legal entity or individual and is the only supplier of information for the smart contract. Using only one source can be risky because the effectiveness of the contract is entirely dependent on the controlling entity. In addition, any malicious intervention by a fraudster will have a direct impact on the smart contract. The main problem with centralized oracles is the presence of a single point of failure, which makes contracts more vulnerable and less resistant to attacks.

Decentralized oracles, as well as public blockchains, share the same goals in attempting to avoid counterparty risk. They increase the reliability of the information provided by eliminating a single source of truth. A smart contract requests information from multiple oracles at once to determine the validity and accuracy of the data, for this reason, decentralized oracles can also be called consensus oracles.

Some blockchain projects provide decentralized oracle services for other blockchains. Decentralized oracles can also be useful in prediction markets, where the validity of a certain outcome can be confirmed based on social consensus.

While decentralized oracles have the goal of achieving trust, they, like trustless blockchain networks, do not completely eliminate the need to trust someone, but rather distribute it among many participants.


Contract-based oracles

A contract-oriented oracle is a type of oracle that is intended to be used exclusively within a single smart contract. This means that if one wants to deploy multiple smart contracts, a proportionate number of contract-centric oracles must be developed.

Such oracles are considered very labor-intensive and expensive to maintain. Companies that want to extract data from multiple sources may find this approach highly impractical. On the other hand, because this type of oracle can be developed from scratch to suit a specific use case, its developers have high flexibility in specifying the necessary requirements for the oracle.


Oracle Man

Sometimes, experts in a particular field can also act as oracles. Their responsibilities will include studying and verifying the authenticity of information received from various sources and transferring already processed data to smart contracts. Since human oracles can verify their identity using cryptography, the likelihood of a fraudster authenticating on their behalf and providing altered data is relatively low.


Problematic aspects of oracles

Because smart contracts make decisions based on data provided to them by oracles, they are key to the healthy operation of the blockchain ecosystem. The main problem faced when developing oracles is that the risk of possible negative impacts on the oracle directly affects the operation of the smart contract that is based on it. This is often referred to as the "oracle problem".

Unfortunately, oracles are not part of the security mechanisms of public blockchains because they are in no way related to the consensus of the blockchain network. Trust conflict between third-party oracles and unreliable execution of smart contracts is still an unsolved problem.

A man-in-the-middle attack can also pose a threat when an attacker gains access to the data flow between the oracles and the contract, and modifies or falsifies the transmitted data.


Conclusion

A reliable mechanism that facilitates communication between smart contracts and the outside world is vital for public acceptance of blockchain technology on a global scale. Without oracles, smart contracts will only rely on information that is already in the networks, which significantly limits their capabilities.

Decentralized oracles have great potential to introduce security mechanisms that could remove much of the systemic risk from the blockchain ecosystem. Oracles continue to be one of the most important building blocks that must be implemented in a secure, reliable and trusted manner for the further development of blockchain technologies and the ecosystem as a whole.