A Brief Introduction To The Decentralized Oracle Network

 

Blockchain technology supports the multibillion-dollar cryptocurrency industry and promises to revolutionize how we trade, interact, or exchange finances. As a decentralized digital ledger, Blockchain eradicates the requirement for third-party validation while guaranteeing best-in-class security standards, immutability, and transparency. The diverse participants in the channel are named network nodes, and they are the ones who manage everything.     

In addition to its merits, Blockchain technology also has some loopholes. Using one Blockchain system to trade data is easy but exchanging data across multiple Blockchains is more challenging. This is where Blockchain Oracles come into space. Oracles function as a bridge for linking Blockchain ecosystems to exterior data inputs & outputs. Besides enhancing the working capacity of a Blockchain network, they also ensure the accuracy of the data statistics available to users. 

This blog will help you understand what Blockchain Oracles are and how a Decentralized Oracle Network works. So, let’s get started!

What Is Blockchain Oracle Network?

Blockchain Oracles act like a bridge to connect the on-chain and off-chain worlds. They play a key role in letting deterministic Blockchain access non-deterministic values. But having a single oracle provide value to the Blockchain challenges the trustless principle of Blockchain. Being dependent on this single oracle might be risky; what if that oracle itself is compromised or is getting data that was compromised before reaching the Oracle?  

To solve this problem, the Decentralized Network of Oracles is designed in such a way that oracles form the core of this network, forming an infrastructural layer. Here they work beside Blockchain, gathering, processing, and then supplying the verified aggregate result to the smart contract in Blockchain.   

Blockchain Oracles Key Functionalities   

Oracles provide several functionalities but here view the key functionalities of it:   

  • Collecting data from the off-chain world  
  • Send the data to a smart contract on Blockchain by using a signed message  
  • Store the data in the smart contract’s storage so that it remains accessible

Note: The stored data can be accessed via the smart contract’s “retrieve” function call. 

Determine The Type Of Oracle 

An oracle can be determined based on the type of data required by the Blockchain as described below-  

Immediate Read 

It is used when a result is required on a just-in-time basis. For example, to verify someone’s identity.

Publish Subscribe

This is used when the required data keeps changing. Whenever a change occurs, it is notified by polling a smart contract or by keeping a watch on the updates via off-chain triggers. For example, weather updates.  

Request Response

It is used when users need to use only a small part of a big data set at any given time. In this scenario, data is too large to be stored in a smart contract; therefore, a combination of on-chain smart contracts and off-chain infrastructure is used. 

A request is sent from the Blockchain to off-chain infrastructure, which keeps monitoring for requests, processes them, and returns results. This being an asynchronous process, follows multiple steps. For example, geolocation data for tracking and tracing in the supply chain.

The steps for a request- response oracle set up

How Does The Decentralized Oracle Network (DONs) Work?

We can have a single or mixed type of oracles in the network. Understand how the decentralized oracle network works with Chainlink’s architecture for the data feeds. These data feeds enable Smart Contracts to quickly connect with the real world and include the following components –    

Consumer 

An application that uses data feeds. It may be an on-chain or off-chain application, where its contracts called consumer contracts calls functions on the proxy contract and retrieve information from the aggregator contract.

consumer

Proxy Contract 

They are proxies that are on-chain contracts pointing to the aggregator for data. With the use of proxies, the upgradation of the underlying aggregator becomes seamless due to zero service interruption to consuming contracts. They may vary for different data feeds as per the application requirements.

proxy contract

Aggregator Contract    

This contract receives data updates periodically from the decentralized oracle network. Then it stores the aggregated data on-chain for the consumers to retrieve and act upon it in the same transaction.

Connecting smart contracts to external data (off-chain) is done using a decentralized oracle network. Chainlink handles API requests by 1:1 by an oracle. It does this by using the following models – 

Basic Request Model   

This model is used when data is required from a single oracle source.      

Contracts Overview 

The following diagram shows the flow of its contract, the open-source code of which is available at the Chainlink Github repository.

Architecture Request Model Image Reference: Architecture Request Model

Chainlink Client  

It is a parent contract of the basic request model that allows smart contracts to take data from oracles. It sends the required encoded information via transferAndCall function request to chainlink oracle via LINK token.   

LINK Token  

It is an ERC-677 compliant token that executes the transferAndCall request sent by ChainlinkClient. It lets token transfer and triggering of logic in a single transaction in the receiving contract via onTokenTransfer call.   

Oracle Contract  

These run beside off-chain oracle nodes and are owned by oracle node operators. They are responsible for handling on-chain requests received via onTokenTransfer through LINK Token. 

Oracle Request  

It must be made by the client contract that initiated the process with the following must-haves:   

  • Oracle Address – which oracle to contact 
  • Job ID – which tasks to perform  
  • Callback function – through which the oracle shall send back the response  

Completion  

On completion, a fulfillOracleRequest function returns the result to ChainlinkClient via a defined callback function.   

Oracle Node (Off-chain) 

It listens to the events of its on-chain smart contract. On listening to the OracleRequest event, it uses the data emitted to execute the task.  

For example, a GET request to an API retrieves data, parses the response, converts the result into Blockchain-compatible data, and then sends the result back via the fulfilllOracleRequest function to the oracle contract.    

Decentralized Data Model 

This model is used when data is aggregated from several independent oracles nodes in a decentralized oracle network. 

Data Aggregation 

Each data feed is updated by independent oracle nodes of the decentralized oracle network, and the AccessControlledOffchainAggregator is used to aggregate the data on-chain. The aggregation process is improved by Off-Chain Reporting (OCR). 

Shared Data Resource 

Every data feed has its own properties, and each data feed is created by a community of users. These users rely on accurate data in smart contracts. In order to enhance the quality of the data feed, more users are added that add their contribution to the data feed, thus, enhancing its quality.   

Decentralized Oracle Network (DON) 

It consists of a consumer contract, a proxy contract, and an aggregator contract. DON updates each data feed where the number of participating oracles in each data feed varies. Every oracle operator is awarded for publishing data. For any update to take place, the data feed aggregator contract must have a minimum number of oracles to respond in an aggregation round, or the update will not be published. This data is validated and aggregated by a smart contract which forms the latest response of the feed.   

Updates are received by aggregators from DON only when a trigger happens on the Deviation Threshold (when off-chain values vary by more than the specified variation threshold from the on-chain value) or Heartbeat Threshold (after a specified amount of time) while in an aggregation round. The first met condition triggers an update to the data.

Off-Chain Reporting 

In Off-Chain Reporting (OCR), nodes communicate off-chain using a peer-to-peer network. A lightweight consensus algorithm is executed during the communication process. During this communication process, every node returns its observed price and signs it. The result is then aggregated and sent as a single value, thus saving a good amount of gas fees. 

During the process, nodes regularly elect a new leader who is responsible for the execution of the whole process. The leader repeatedly asks their followers to send freshly signed observations & aggregates them into a report. The report is then sent back to followers for verification of its validity. If the required number of followers approves the report, then a signed copy is sent back to the leader, who then combines it into a final report along with the signature of the followers who approved it, and then the leader broadcasts that report to the whole network.    

As per a randomized schedule, nodes in the DON try to transmit the final report to the aggregator contract. The aggregator contract then verifies that the required number of nodes have signed the report and reveals the median value as an answer to the consumers, along with a block timestamp and a round ID.    

During transmission, the Blockchain is watched by all the nodes for the final report, and in it, if any single point of failure is discovered, then that is removed. A round-robin protocol is used when the desired node does not get the transmission confirmed within the given time period; in this case, other nodes keep transmitting the final report till the time one of them gets confirmation.   

Ending Words

Blockchain technology can only be expanded globally if a secure infrastructure facilitates communication between smart contracts and external sources. Without oracles, smart contracts cannot attain their full potential, as they would only rely on on-chain data for work. 

With decentralized oracles, Blockchain networks can ease different system risks & operational limitations. In addition, Blockchain oracles can provide businesses with an interface that is trustless, secure, and safe for them to develop and grow within a decentralized economic system; if you also want that, then connect with a reliable Blockchain development company (Infrablok).

Moreover, if you are seeking help to call APIs from Ethereum smart contracts using chainlink oracles, follow the steps present in our tutorial.

Note: To write informative information on this blog, we referred Chainlink Architecture doc! 

Everything You Need To Know About Blockchain Oracles

 

Blockchain Oracles provide a link between off-chain and on-chain data, i.e., they act like a bridge between the data of the real world and the smart contracts of the web3 world. It means that oracles are the main source that gives data to smart contracts, which helps broaden the scope of smart contracts and Blockchain applications.     

But it does not mean that Blockchain oracles are the data source as they work at the network’s core, forming an infrastructural layer that works beside Blockchain. It gathers data by querying external data sources, verifying it, and then supplying the resultant information to smart contracts in the Blockchain.

Blockchain Oracles

Moreover, with Oracles, the issue of connecting the two worlds was resolved, but Blockchain’s very basis seemed deluded. The trustworthiness and reliability of Blockchain are based on its concept of being decentralized & deterministic, but none of it was conceptualized in Oracles. Thus, giving rise to the Blockchain Oracle Problem…  

Major Problem Related to Blockchain Oracle 

Anything that is written on the Blockchain is immutable, which makes it trustworthy, but anything that Oracle supplies is not immutable until it reaches the Blockchain, which means, data might get counterfeited or tweaked by anyone in the Oracle before it gets registered in the digital ledger over Blockchain. 

It directly conflicts with the Blockchain’s fundamentals of security, authenticity, and trust, thus creating the Blockchain oracle problem.

Smart contracts work with an aim to get a deterministic answer to questions like, Will party A win the election? Or will the stock of B generate profit? Getting a deterministic answer to these questions through smart contracts is based on getting to the consensus of true/false stored in its distributed ledger. But to reach the consensus, smart contracts require data from the real world, like market predictions or the result of a game or an election result; feeding data to the smart contracts is where oracles come into play. Though they are required for data yet, being controlled by third parties outside of blockchain makes them untrustworthy.

Types of Oracles

The solution to the above problem lies in decentralizing these oracles and creating a decentralized network of oracles. Designing a network of oracles would require choosing the right type of oracle, depending on what sort of application you want to design and other requirements. The Blockchain oracles are classified into three different types that are: 

1. Direction Of Information Flow 

Depending on the direction of the information flow, oracles are categorized as follows – 

Inbound Oracles

Inbound Oracles fetch data from the real-world (off-chain) and deliver it onto a Blockchain network for smart contract consumption.

These oracles are utilized to power Chainlink Price Feeds, offering DeFi smart contracts on-chain access to financial market data.

Outbound Oracles

Outbound Oracles are just the opposite of inbound oracles, which permit smart contracts to send commands to off-chain systems to execute certain actions.

It can include telling the storage provider to store the supplied data, reporting the banking network to make a payment, or pinging an IoT system to unlock a bus door once the on-chain rental payment is made.

Computation Oracles

Computation Oracles are a mixture of both inbound and outbound oracles. Whenever an app needs to compute data after receiving a certain value from the Blockchain’s smart contract (on-chain), it computes the data off-chain & sends the result to the smart contract.

2. Source Of Information 

It helps in identifying oracles based on the Source of information origin and is categorized as follows –   

Software Oracles 

Software oracles are used when an application requires data from an online source (internet). They can collect real-time information from servers, websites, databases, APIs, or any online digital source available on the internet. 

For example, an oracle can give real-time weather updates to an insurance application’s smart contract that manages claims of damaged crops due to bad weather.   

Hardware Oracles 

When an application requires data from the real world, then hardware oracles are used. They collect data with the help of scanners, sensors, and IoT devices. 

For example, tracking the geolocation of goods in a supply chain requires a QR code to be scanned and sent that code to the Blockchain’s smart contract. 

Human Oracles

When an application requires specialized skills in mathematics, finance, or any specialized field, then a human with the required set of knowledge can act as an oracle. In order to reduce the chances of fraud, humans can be cryptographically identified. 

For example, an application to settle an arbitration dispute might require human intervention when two parties disagree on the settlement. A human oracle would then check previous data and find the solution. 

3. Centralized/Decentralized 

An oracle may be centralized or decentralized, as described below: 

Centralized

An oracle with a single source of information or being controlled by a single entity is called a centralized oracle. Having a fixed source makes them more vulnerable and gives the whole network a single point of failure.

It can act as a bridge between on-chain and off-chain data but will not be trustworthy and, thus, must only be used when no other alternative is available.

Decentralized

An oracle network that has multiple sources of information or is not controlled by a single entity. Being off-Blockchain, it does not guarantee 100% trust. The trust divides into multiple nodes as they give results only after a majority consensus is reached amongst participating nodes giving it much higher credibility. Data fetched and processed by decentralized oracles are more accurate and far more trustworthy than centralized oracles.

Depending on the application, an oracle might belong to any type explained above or have more than one type of functionality. 

For example, suppose the source of information for a private application is a single data source. In that case, it will be centralized software inbound oracle, whereas if an application requires settling claims for delayed delivery of a package, then it will be a decentralized hardware inbound oracle. 

The Best Blockchain Oracles to Use In dApps  

There are various options available that provide Blockchain oracles to be integrated with dApps. Some of them are – 

Chainlink 

In the decentralized network, you can pick the number of nodes required, the collateral those nodes should have, and data sources are collected to enter the data into the Blockchain’s smart contract. 

Moreover, it supports Ethereum, BNB, Polygon, Avalanche, Fantom, and Arbitrum & provides support to integrate it with other chains.  

Oraclize 

It ensures data authenticity while connecting dApps with external web APIs. It supports public chains like Ethereum, Bitcoin, Rootstock, EOS Mainnet, Testnet, and private Ethereum-based chains. 

API3 

It provides Airnode as its 1st party Blockchain oracle and ensures to connect via web API directly without any requirement of any third parties. It needs to be set up once it is completed; it can handle all future management and maintenance. 

DIA 

Decentralized Information Asset (DIA) is a multichain, open-source data, oracle solution for decentralized finance. It allows the customization of data feeds in the context of data sources and methodologies. It supports EVM chains, Solana, Polkadot, etc. 

Moreover, many more oracle solutions are available, the choice of which fully depends upon the application’s needs. 

If you want to choose one of the best Blockchain Oracles for dApp development, consider the following criteria to make the right decision… 

Factors To Consider While Picking Blockchain Oracles

Where To Use Blockchain Oracles? 

You can use oracles to create more advanced decentralized applications (dApps). While there are infinite possibilities to use Blockchain Oracle, the use cases with the most current adoption are below. 

Decentralized Finance (DeFi) 

An enormous portion of the decentralized finance (DeFi) ecosystem needs oracles to access financial data about assets & markets.   

For example, decentralized money markets utilize price oracles to specify users’ borrowing capacity and inspect if users’ positions are undercollateralized and subject to liquidation. 

Similarly, to increase capital efficiency, synthetic asset platforms and automated market makers (AMMs) use price oracles to help peg token values to real assets. 

Dynamic NFTs and Gaming 

Using Oracles, smart contracts can be used for non-financial reasons, such as dynamic NFTs (Non-Fungible Tokens) whose appearance, value, or distribution can change depending on the time of day or weather.  

Furthermore, compute oracles are used to generate verifiable randomness that projects use to assign randomized traits to NFTs or to select random winners to receive high-demand NFTs. In addition, On-chain gaming apps also utilize verifiable randomness to make more engaging & surprising gameplay experiences. 

Insurance 

Insurance smart contracts employ input oracles to prove the occurrence of insurable events while claims processing, opening-up keys to physical sensors, web APIs, legal data, and satellite imagery.  

Output oracles can also provide insurance – smart contracts to make payouts on claims utilizing other Blockchains or traditional payment networks. 

Wrapping Up

A trustworthy mechanism that facilitates the communication between smart contracts & the external world is crucial to the global adoption of Blockchains. Without Blockchain Oracles, smart contracts would have to depend only on details existing within their networks, which would greatly confine their capabilities.  

Decentralized Oracles have the potential to introduce safeguard mechanisms that could eradicate systemic risks from the Blockchain ecosystem. Blockchain Oracles remain one of the crucial building blocks to be enforced in a reliable, secure, & trustless manner for the Blockchain ecosystem to grow. Moreover, these decentralized oracles together form a decentralized oracle network (DON); click here to know more about it!

Additionally, if you are looking forward to using Blockchain Oracles in your next business project, feel free to connect with one of the reliable Blockchain development companies (Infrablok). Doing so, you will get a professional development team who will help you get things done as per your needs. 

Accessing Real Time Data Using Chainlink Oracles

 

Blockchain and its new cryptocurrencies and chains are becoming popular day by day, making it one of the fastest-growing technologies in the business world. The first chain that came into the market after Bitcoin was Ethereum which brought the concept of “smart contracts.”  

These smart contracts are paving the way for solving various real-world problems in the immutable, decentralized, distributed, yet trustworthy network. It means that Blockchain is no longer fixed for the cryptocurrency market. But it can also be employed to solve realistic problems by setting up terms or agreements in the form of some computation done in smart contracts (written in a programming language).

With this breakthrough, new ideas sprang up that brought solutions to the problems of the centralized world into the decentralized world. But with this, some significant bottlenecks in the advancement of Blockchain came up.    

Before discussing accessing real-time data using Chainlink Oracles, it’s also essential to know the Blockchain technology bottlenecks. By knowing this, you can overcome challenges in less time. 

3 Major Bottlenecks In The Advancement Of Blockchain

Blockchain Oracles Problems

1. Every Transaction In Blockchain Takes Place On Blockchain

Every computation, be that solving a simple calculation from the Blockchain data (called on-chain data) or a complex computation that involves data from the real world (called off-chain data), in real-time, is needed to take place Blockchain itself.  

It means that there had to be a way devised for an isolated system like Blockchain to access not only its on-chain data but also off-chain data. If this is achieved, putting a massive amount of data (off-chain data) on Blockchain would create extremely high levels of redundancy in every system that processes blockchain transactions.   

2. No Relation Between Real World Data & Smart Contracts

There is no link between off-chain data & smart contracts, which means smart contracts could not process any computation related to off-chain data.   

3. Bigger Transaction = Higher Cost

If any real-world problem ought to solve with Blockchain, then data has to be migrated over to Blockchain to solve that transaction, which means more time consumption will lead to a higher transaction (gas) cost.

How To Access Real-Time Data Employing Chainlink Oracles?

To solve the real-world computation off-chain & feed the solution to the on-chain smart contract, some mechanism that can make off-chain data immutable, decentralized, distributed, & secure was required. To make this possible, Chainlink created Oracles and combined them to form a Decentralized Oracles Network (DONs). 

Oracles acted as entities that could connect off-chain data with the Blockchain’s smart contract. Oracles can solve all off-chain computations by preserving all the core fundamentals of Blockchain & acted as a bridge to feed the solution to the Blockchain’s smart contract. 

Additionally, they enabled 2-way communication by creating a communication link between on-chain & off-chain data. It means all high costing computations can now be done off-chain while keeping it immutable, decentralized, distributed, & secure. 

Oracles can achieve this connectivity by interfacing with external APIs & data feeds, allowing them to pull data for or push data from a smart contract. 

Did You Know One Oracle Can Mislay Whole Trustworthiness?

Well, one Oracle could not be called decentralized or distributed as it certainly wasn’t giving immutability. This resulted in a loss of whole trustworthiness as data was received from outside a blockchain network. To feed any data to Blockchain, any system outside the Blockchain must have the same fundamentals. 

Decentralized Oracle Network (DONs) To Maintain Credibility

To maintain trustworthiness, DONs were formed. The DONs is a network where several Blockchain oracles run by independent node operators are selected to retrieve & validate data from multiple off-chain sources. It ultimately helped achieve a Blockchain kind network outside of Blockchain in the real world to process any off-chain data.  

It works as a Blockchain because the oracle nodes of these DONs have a resultant value aggregated to get a single trusted data point fed to the on-chain smart contract for further execution.  

Moreover, the independent network of multiple DONs running simultaneously and independently of each other formed the chainlink network. In simple terms, Chainlink is a decentralized network of Oracles that lets users securely connect off-chain data to on-chain smart contracts & vice versa. 

Know How Users Can Securely Connect Off-Chain Data To On-Chain Smart Contracts & Vice Versa

Here we have given an example that will help you understand the working to know how users can securely connect off-chain data to on-chain smart contracts & vice versa. 

how users can securely connect off-chain data to on-chain smart contracts

Assume there is an insurance company that insures packages delivered across the globe. John visits this company and asks to insure his package that requires to reach its destination in 3 days. In this case, if the package gets delayed due to any reason related to the flight carrier, John gets the claim. But, in case of delivery delays, various checks are done by the insurance company to ensure that the package was not delivered on time due to the lagging of the flight carrier; thus, settlement of the claim becomes a lengthy process. 

To solve the above issue, the insurance company decides to opt for a Blockchain-based solution, & to fetch flight data in real-time, they opt for oracles. This oracle-based insurance company will monitor data coming through oracles via API and transmit the required information to the Blockchain. Then, with the help of smart contracts (based on the preset agreement between the client & company) and oracles, the Blockchain will determine if the events are occurring as per the preset agreement or not through consensus.

Smart contracts will then control the action to release a claim or not. Being on Blockchain, the whole process gets transparent, allowing the clients to track the status of the flight, henceforth, their packages. Thus, making it automated and trustless increases faith in the process, paving the path for smoother and faster claims.   

Wrapping Up

Chainlink is also developing optional attributes such as advanced oracle computations, oracle and data privacy, and much more. By ensuring high security & credibility guarantees on par with the Blockchain, Chainlink oracles enable more refined smart contracts. Moreover, to know major things related to Blockchain Oracles, click here. 

If you are looking to access real-time data using Chainlink Oracles or want to overcome Blockchain oracle issues in your blockchain ecosystem, take help from the best Blockchain development company (Infrablok). It will help by offering innovative Blockchain solutions.