What are blockchain oracles?

·

6 min read

What are blockchain oracles?

Hello readersđź‘‹

We all know that blockchain works on the idea of decentralization. But what if our decentralized application requires some real-world information like the current market price of ether, the weather of a particular location, etc. We have some centralized sources that store this data and we can fetch data from those sources but it breaks the idea of blockchain being decentralized. How can we ensure decentralization of information from a particular source i.e. how to get real-world information in decentralized applications. That is what Oracles do.

Let us understand what blockchain oracles mean?

What are Oracles

Blockchains and smart contracts cannot access data from outside of their network. In order to do so, a smart contract often needs access to information related to the contractual agreement from the outside world in the form of electronic data known as oracles. These oracles are services that send and verify real-world information and submit it to the smart contracts, triggering state changes on the blockchain.

Blockchain oracles provide a link between off-chain and on-chain data. Oracles are vital within the blockchain ecosystem because they broaden the scope in which smart contracts can operate. Without blockchain oracles, smart contracts would have very limited use as they would only have access to data from within their networks.

Note that blockchain oracle is not the data source itself, but rather the layer that queries, verifies, and authenticates external data sources and then relays that information.

To call data from the outside world, the smart contract has to be invoked, and network resources have to be spent. Some oracles also have the ability to not only relay information to smart contracts but to send it back to external sources.

Example of a blockchain oracle

Suppose there are two persons named Rohit and Virat. They place a bet on who will win the cricket match between RCB and MI. Rohit believes that MI will win and Virat believes that RCB will win. They both 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 result of the match.

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 match. After the match is over, the oracle queries a trusted API to find out which team won the match and relays this information to the smart contract. The contract then sends the funds to Rohit or Virat, 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.

Blockchain Oracles

Blockchain cannot inherently interact with data and systems existing outside their native blockchain environment. Resources external to the blockchain are considered “off-chain,” while data already stored on the blockchain is considered on-chain.

Securely interoperating with off-chain systems from a blockchain requires an additional piece of infrastructure known as an “oracle” to bridge the two environments.

image.png

Oracles expand the types of digital agreements that blockchains can support by offering a universal gateway to off-chain resources while still upholding the valuable security properties of blockchains.

Major industries benefit from combining oracles and smart contracts including asset prices for finance, weather information for insurance, randomness for gaming, IoT sensors for supply chain, ID verification for government, and much more.

Centralized oracles

Blockchain oracle mechanisms using a single centralized entity to deliver data to a smart contract defeats the total purpose of decentralized blockchain applications.

If the single oracle goes offline, then the smart contract will not have access to the data required for execution or will execute improperly based on stale data.

Even worse, if the single oracle is corrupted, then the data being delivered on-chain may be highly incorrect and lead to smart contracts executing very wrong outcomes. This is commonly referred to as the “garbage in, garbage out” problem where bad inputs lead to bad outputs. Additionally, because blockchain transactions are automated and immutable, a smart contract outcome based on faulty data cannot be reversed, meaning user funds can be permanently lost.

image.png

Therefore, we can't have centralized oracles as they are a single point of failure.

Decentralized Oracle Networks (DONs)

A decentralized oracle network or DON solves all the above issues like data manipulation, inaccuracy, and downtime. A Decentralized Oracle Network combines multiple independent oracle node operators and multiple reliable data sources to establish end-to-end decentralization.

image.png

Types of blockchain oracles

Input oracles

Input oracles fetch data from the real world(off-chain) and deliver it onto a blockchain network for smart contract consumption. Example: providing DeFi smart contracts with on-chain access to financial market data.

Output oracles

Output oracles allow smart contracts to send commands to off-chain systems that trigger them to execute certain actions. Example: informing a banking network to make a payment, telling a storage provider to store the supplied data, or pinging an IoT system to unlock a car door once the on-chain rental payment is made.

Cross-chain oracles

These types of oracles can read and write information between different blockchains. Cross-chain oracles enable interoperability for moving both data and assets between blockchains, such as using data on one blockchain to trigger an action on another or bridging assets cross-chain so they can be used outside the native blockchain they were issued on.

Compute-Enabled oracles

The compute-enables oracles use secure off-chain computation to provide decentralized services that are impractical to do on-chain due to technical, legal, or financial constraints. Example: running a verifiable randomness function to provide a tamper-proof and provably fair source of randomness to smart contracts.

image.png

Human oracles

Sometimes individuals with specialized knowledge in a particular field can also serve as oracles. They can research and verify the authenticity of the information from various sources and translate that information to smart contracts. Since human oracles can verify their identity using cryptography, the possibility of a fraudster faking their identity and providing corrupted data is relatively low.

Blockchain oracle use cases

Decentralized finance or DeFi

Most of the Defi based apps require oracles to access financial data about assets and markets. For example, decentralized money markets use price oracles to determine users’ borrowing capacity and check if users’ positions are undercollateralized and subject to liquidation.

Dynamic NFTs and Gaming

Compute oracles are used to generate verifiable randomness that is used to assign randomized traits to NFTs or to select random lucky winners in high-demand NFT drops. On-chain gaming applications also use verifiable randomness to create more engaging and unpredictable gameplay experiences like the appearance of random loot boxes or randomized matchmaking during a tournament.

Insurance

Insurance smart contracts use input oracles to verify the occurrence of insurable events during claims processing, opening up access to physical sensors, web APIs, satellite imagery, and legal data. Output oracles can also provide insurance smart contracts with a way to make payouts on claims using other blockchains or traditional payment networks.

Different oracle services

Conclusion

  • This is the end of the blog. I think you might have understood what blockchain oracles are and why are they used.

  • I hope you find it helpful. Let me know your thought in the comment below.

  • Do like this blog and follow me!

  • Also, you could follow me on Twitter

Thanks for readingđź’›

Â