Oracle

An oracle is a third-party service that provides the real-world data needed by smart contracts to execute.   

Published

What is an Oracle?

An oracle is a third-party service that provides the real-world data needed by smart contracts to execute.

The Long Definition

An oracle is a service that delivers data from off-chain sources to smart contracts. Off-chain data sources are those outside a blockchain.

Oracles connect blockchains to these external data sources. The goal is to provide the smart contract with the information needed to execute it based on its specific set of conditions. In this way, they function as bridges– information flows from the real world to the blockchain through them.

Bridges can be two-way. Therefore, more recent oracles also allow data to flow out of a blockchain to external systems.

what is an oracle

Blockchain Oracles Explained

To understand oracles, you must first understand their purpose.

Smart Contracts

One of the most defining features of a protocol is its ability to run smart contracts. These contracts are self-executing agreements on a blockchain. Unlike regular contracts, the terms of such agreements are directly written into code.

This code automatically executes when a specific set of conditions are met. There’s no need to trust a middleman, like a lawyer, to execute the contract. Instead, the program reads data and determines whether the conditions of the contract are met.

Smart contracts have lots of uses. For instance, they are extensively used in decentralized finance to facilitate trades. Trading uses on-chain data. This is data the protocol can easily access and interpret.

Smart contracts can also be used in betting, insurance, supply chain management, voting, healthcare, etc. And here’s where the need for oracles arises.

Blockchain Isolation

Blockchain infrastructure is designed in such a way that the system is free from outside control/influence. This means that the network is isolated from the real world. It cannot directly interact with systems outside the network. This isolation ensures the security and integrity of the protocol.

However, this can be a problem. In some cases, a smart contract requires data from external sources in order to execute. However, since the blockchain cannot connect to external systems, smart contracts are essentially blind to real-world data and events.

smart contract demonstration

Take this scenario for instance.

At the start of the World Cup, Joe bets Joel on who will win the tournament. They both lock up $50 in a smart contract as wagers. Joe backs England while Joel backs Argentina, which goes on to win. So, the smart contract should automatically release $100 to Joel. But how does it know that the conditions of the bet have been fulfilled?

Well, there’s no direct way to know. The smart contract on its own cannot read news websites or check results to know that Argentina won. This is where oracles come in.

An oracle provides a path for data to flow from off-chain sources to the smart contract. In this case, the results of the tournaments will flow from official news sources through the oracle into the smart contract. The smart contract will then know that Argentina won and thus, release the money to Joel.

Types of Oracles

Oracles can be classified based on their infrastructure, direction of information, and ownership/control.

Infrastructure

Based on their infrastructure, oracles can be software or hardware. Software oracles are programs written to interact with online information sources and transmit their data to the blockchain. These are the most common types of oracles.

On the other hand, hardware oracles are devices specifically designed to derive information from the physical world. This information is then processed and made available for smart contracts. These include specialized information reading devices.

For example, a temperature sensor that provides the room’s temperature to a smart contract is a hardware oracle.

blockchain oracle demonstration

Direction of Information

Based on the flow of information, oracles can be inbound or outbound. Inbound oracles allow information to flow from off-chain sources to smart contracts. A good example is an oracle that tells a smart contract which team won the World Cup. Most oracles are inbound.

But as blockchain applications have grown, there has grown the need for outbound oracles. These are oracles that deliver information from smart contracts to off-chain sources.

Ownership/Control

Oracles can be centralized or decentralized. Centralized oracles are controlled by a single entity/individual. This entity acts as the source of information. It feeds the oracle with the data needed by the smart contract.

Such centralization is quite risky. For one, it goes against the blockchain’s principle of decentralization. The individual controlling the oracle can intentionally supply false information in order to benefit themselves.

Centralization also provides a single point of failure. The single source is more vulnerable and less resilient to attacks by hackers.

This is why most blockchains prefer decentralized oracles. These don’t rely on a single source of information. Instead, the smart contract gets information from multiple oracles with multiple data sources. That way, the integrity of the system is ensured.

This is because the odds of multiple oracles colluding to provide the wrong information is negligible. Multiple oracles also make it harder for hackers to target the system.


Want to join the Dypto journey? Follow our socials!