Introduction to Blockchain Oracles + How Blockchain Oracles work?

In this Blockchain tutorial, we will learn about the concept of Blockchain Oracles. And we will discuss different types of blockchain oracles and illustrate the following set of topics.

  • Why Do We Need Oracles ?
  • What are Blockchain Oracles
  • How Blockchain Oracles work
  • Types of Blockchain Oracles
  • Blockchain Oracle Services
  • What is Oracle Problem

Why Do We Need Oracles?

Before learning the concept of oracles, we need to understand why oracles are required. Also, what major issue do they help to solve in the blockchain?

In one of the previous tutorials, we have discussed the use of smart contracts in blockchains.

Smart contracts are simple computer programs that work within the blockchain network and execute a specified set of activities when a certain condition is satisfied.

Moreover, they can be implemented without the involvement of any third party for their execution.

But, smart contracts have the basic limitation of being unable to access any external data. And real-world applications normally require some external (off-chain) data for their work. So, to overcome this issue, the idea of oracles was introduced in the blockchain.

An oracle is an external source of data that supplies data to smart contracts on the blockchain. We will learn about oracles in more detail further in this tutorial.

Also, check: Blockchain Architecture

What are Blockchain Oracles

The blockchains are isolated systems with no direct access to the actual world. Due to this, smart contracts cannot access any external data sources. But, in real-world applications, we might require real-world data to implement some business logic in smart contracts.

For example, a real estate transaction application will require some off-chain (external) data for the implementation of a transaction.

Blockchain Oracles
Blockchain Oracles

Now, oracles can be used to deliver external data to smart contracts in certain instances. An oracle is an interface that allows smart contracts to receive data from an external source. Oracles are trusted entities that send off-chain data to smart contracts through a secure connection.

A blockchain oracle is a layer that verifies and authenticates external data sources before transmitting that information. The successful completion of a transaction, price information, or sensor data are some examples of data delivered by oracles.

To fetch data from some external source, a smart contract must be used and some network resources should be utilized. However, some oracles can transmit data back to external sources as well as relay it to smart contracts.

Read: Types Of Blockchain

How Blockchain Oracles work

The oracles utilized a variety of methods to write data into a blockchain, depending on the type of blockchain.

For example, in Bitcoin, an oracle can write data in a specific transaction in that blockchain. And a smart contract can monitor that transaction and read data from it.

Similarly, some techniques include storing data in the storage of a smart contract. Now, this data can be subsequently accessed by other smart contracts on the blockchain via smart contract requests. In the Ethereum blockchain, this task is achieved using message calls.

So, different blockchains utilize oracles in different ways. But, let’s discuss some of the fundamentals of how an oracle works in the blockchain ecosystem.

  • The whole process starts when a smart contract requests an oracle for external data. Once this request is executed by an oracle, the required data is requested from the data source. Now, these data sources can be any external off-chain data provider.
  • Requesting data from the data source can be done in a variety of ways. For example, using APIs given by the data source, accessing a web service, reading from a database, or requesting data from another blockchain.
How Blockchain Oracles work
How Blockchain Oracles work
  • After this, the required data is submitted to a notary, that generates a cryptographic proof (typically a digital signature) of the desired data. And this cryptographic proof is used to ensure the validity of the requested data. In the end, the requested data with its proof of validity is transferred to the oracle.
  • Optionally, the requested data, along with its proof of validity, can be stored on a decentralized storage system. Moreover, it can be subsequently used for verification by the smart contract/blockchain.
  • And at last, the data is forwarded to the smart contract, along with proof of validity.

Read: Consensus in Blockchain

What is Oracle Problem

Before moving forward, let’s recall one main feature or benefit of using blockchain. That is decentralization, it’s the decentralized nature of the blockchain which makes it more secure, reliable, and efficient.

Now, let’s look at the usability of blockchain oracles. The blockchain oracles help to feed data into the blockchain from some source. And a source can be any node, service, or API, and this ruins the entire purpose of blockchain. This lays the foundation for the oracle problem on the blockchain.

Now, using centralized oracles would signify that the smart contract is controlled by a single entity. Because the whole data is coming from a central source.

And this will result in making the centralized oracles prone to concerns about upgrades, lack of maintenance, or being hacked. And any of this could lead to terrible outcomes.

When it comes to the oracle problem, there are two key factors to consider. They are, indeed.

  • By default, a blockchain cannot access external data on its own.
  • Central oracles eliminate the value of a smart contract while also offering significant security risks.

So, when it comes to smart contracts and blockchain, the oracle problem is concerned with attributes like the reliability & credibility of oracles.

And the Oracle Problem can be defined as a disagreement between the third-party oracles and the trustless smart contracts execution in terms of security, authenticity, and trust.

Read: Decentralization in Blockchain

Types of Blockchain Oracles

So, till now, we got a clear idea about the concept of blockchain oracles and why they are required.

Nowadays, there are various types of blockchain oracles available varying from basic software oracles to complicated hardware aided oracles.

Now, these various types of oracles are classified based upon a different number of factors.

  • Direction of information: Is the flow of data or information inbound or outbound?
  • Data Source: Is the data coming from software or hardware?
  • Trust: Is the data source centralized or decentralized in nature?

Based upon all these factors, we can categorize oracles into different types. Moreover, a single oracle can be classified into these categories. Let’s try each type of blockchain oracle in detail.

Types of Blockchain Oracles
Types of Blockchain Oracles

Inbound Oracles

This category is used to represent oracles that accept data from external services and input it into the smart contract.

One common example of an inbound oracle is the one that feds some sensor-generated data into the smart contract for some implementation.

Outbound Oracles

This type of oracle is also known as a reverse oracle and is used to transfer data from blockchain smart contracts to the real world.

Now, there can be 2 situations while using outbound oracles. The first is when generated data from one blockchain is sent to another blockchain smart contract. And the second is when an external hardware device needs to perform a task in response to a transaction.

Software Oracles

These types of oracles are responsible for collecting data from the online services available over the internet.

Now, these services may include websites, servers, or online databases. By this, we are using the web as a source of data or information.

This type of oracle is typically used to obtain data like weather information, financial data, travel information from third-party sources. Moreover, these oracles are often known as standard or simple oracles.

Hardware Oracles

As its name suggests, the hardware oracle is used to get data from hardware sources like IoT devices and sensors. These types of oracles can be used in any situation that requires real-time data from physical devices.

Meanwhile, this technique necessitates a tamper-proof or tamper-resistant mechanism for hardware devices.

These oracles are particularly good at turning real-world data into digital values. The best example of a hardware oracle can be seen in the food supply chain, where if one type of food goes through the supply chain, the information is automatically transmitted to the smart contracts in charge, who subsequently take appropriate action depending on the data.

Centralized Oracles

Oracles that are managed by a single entity are known as centralized oracles. This means they are the only ones who supply data or information to the oracle.

Using only one central source for information can be dangerous because the smart contracts will solely depend upon the entity operating that oracle. The fundamental concern with centralized oracles is that they have a single point of failure, making contracts more vulnerable to attacks.

Decentralized Oracles

The decentralized oracles were mainly developed to fulfill the decentralized requirement of a blockchain. Because blockchain systems like Bitcoin and Ethereum are completely decentralized and require oracle services to be similarly decentralized.

These types of oracles help to transfer data to smart contracts in a more reliable manner. As smart contracts do not require to depend on a single source of information.

Moreover, to evaluate the legitimacy and correctness of the data, the smart contract can request various oracles.

Read: Methods of Decentralization in Blockchain

Blockchain Oracle Services

Now, in this section, we will look at some different oracle services available over the internet. These oracle services act as a bridge between the smart contract and the real world.

And these services helps to feed data into a smart contract so the smart contract can perform some task based upon that data.

The chainlink is a decentralized oracle network built on top of the Ethereum blockchain. Chainlink has its own token, LINK, which is essential to its operation.

It serves as a channel between smart contracts and the data they require off-chain. Chainlink is a fully decentralized platform for oracles, which are critical to the trustworthiness of smart contracts.

In this, the oracles who do well are rewarded with LINK tokens, while those that perform poorly lose their tokens.

2. Provable

Provable is the world’s longest-running blockchain oracle service, which provides a secure data-transport layer. It allows smart contracts to access data via Web APIs. Since 2015, Provable has been providing this service, and over a thousand blockchain projects have been created using it.

3. Witnet

Witnet is also a decentralized oracle network that links smart contracts to the rest of the internet. In general, it enables any piece of software to retrieve the contents of any web address at any given time.

Witnet is based on a blockchain and uses a native protocol token named Wit. In this, witnesses earn Wit by obtaining, attesting, and delivering web information for clients. Clients, on the other hand, use Wit to pay witnesses for their RAD work (Retrieve-Attest-Deliver).

4. iExec

The iExec Oracle Factory is a user interface that enables anyone to quickly and easily design their own decentralized oracles. It enables anyone to build their own oracles from the scratch, right in their browser, and without any prior knowledge of blockchain.

Here are a few highlights of using the iExec Oracle Factory:

  • It simply takes 5 minutes and a few clicks to design a custom Oracle with the Oracle Factory.
  • There is no need to define any code when using the Oracle Factory.
  • The oracle can be built immediately from a web browser, requiring only the URL of the API from which the data must be retrieved.

List of some other oracle services available over the internet.

  • Dos.Network
  • The Realitio project
  • TrueBit
  • Paralink
  • Town Crier

You may also like to read the following Blockchain tutorials.

So, in this tutorial, we have learned about the concept of Oracles in the blockchain. And we have also discussed the following set of topics.

  • Why Do We Need Oracles ?
  • What are Blockchain Oracles
  • How Blockchain Oracles work
  • Types of Blockchain Oracles
  • Blockchain Oracle Services
  • What is Oracle Problem