DecentralSchool

Introduction to Blockchain Oracles

What is the Oracle Problem?

The Oracle problem is the limitation that Blockchain networks cannot pull in data from off-chain or external networks. It works as an isolated network which becomes a major limitation, especially for the smart contracts developed on the blockchain network. This means that smart contracts can only interact with data on the blockchain and cannot interact with external data sources such as weather forecasts, stock prices or external APIs. Some folks term this as the "the Smart Contract Connectivity Problem"

The oracle problem is so notorious that Vitalik Buterin, co-founder of Ethereum, once said that "the chain with the best oracles will win." Oracles are necessary because they provide an interface between smart contracts and external data sources.

The Oracle problem in the context of Blockchains is solved by 'Blockchain Oracles'.

What are Blockchain Oracles?

A blockchain oracle is a secure piece of middleware that facilitates communication between blockchains and any off-chain system. They enable smart contracts to send and receive data from various sources outside of the blockchain itself. This allows blockchain networks to access real-time information from outside their native environments so they can perform useful tasks such as checking whether a package has been delivered, verifying the weather forecast or enabling you to bet on the next election's winner.

API call vs Blockchain Oracles: Why not make an API call?

Blockchains are deterministic. Each node needs to repeat each step in the contract and every time it does it should get the same result so that the blockchain remains deterministic. If you use API calls in your smart contract you may have some scenarios that some nodes that may get a different result. To avoid this and keep the deterministic nature of the blockchain Oracles are used to fetch data from outside the blockchain network

Types of Blockchain Oracles

Hardware and Software Oracles

Hardware oracles require an extra 'hardware' setup to pass data back to the blockchain network. Some common examples would be RFID sensors and motion sensors to capture and relay information back to the on-chain smart contracts. On the other hand, Software oracles use software to connect the digital source of information like crypto asset prices.

Inbound and Outbound Oracles

This categorization refers to the direction of the information flow. Inbound oracles bring off-chain data onto the blockchain network whereas outbound oracles can deliver blockchain data to an off-chain application.

Centralized and Decentralized Oracles

An Oracle will be termed centralized if it is controlled by a single entity or if the data source for the Oracle is a single data source. Using a centralized oracle in your smart contract or dApps is risky as a single source of bad information can harm the whole system. a decentralized oracle is similar to a public blockchain where it uses data from multiple sources to come to a consensus and thus does not rely on a single source.

Human Oracles

Individuals with specialized knowledge in a particular field can act as Oracles. Human oracles can use cryptography to verify their identity and thereby reduce the risk of an imposter impersonating them and providing false data.

Contract Specific Oracles

These Oracles are built to work with a specific or a single smart contract. Contract Specific Oracles are inconvenient and generally used for specific situations.

Computation Oracles

Oracles can also be leveraged to perform an off-chain computational task. Such Oracles typically receive on-chain data, compute it off-chain and send it back to the blockchain. One of the reasons this approach is used is to money on Gas Fees.