GTON Academy. Data oracles: fetching offchain data to the blockchain

In this post, we are looking at blockchain oracles, which deliver real-world data to the blockchain.

One major limitation of smart contracts is their inability to connect with systems outside of their native blockchain to fetch real-world data or send data to an external system.

The reason is that, by design, blockchains are isolated from external systems. This ensures their major advantages, including the immutability and security of data.

However, smart contracts and dApps require significant amounts of real-world data, such as exchange rates, sports results or meteorological information. That data is referred to as "offchain," as opposed to "onchain" data – that, which is recorded on a blockchain.

Oracles as a solution

Blockchains' inability to communicate with the real-world creates a major problem, which is solved by oracles - infrastructure elements that operate as data bridges between the offchain and onchain environments.

Real-world data fetched by oracles - from exchange rates to temperature or flight information - enable smart contracts and dApps to operate efficiently. Meanwhile, oracles can also operate in the opposite direction, supplying blockchain data to the external world.

Often, oracles operate as decentralized oracle networks (DONs). A DON is a system of nodes, each of which fetches the same type of data - for instance, exchange rates for a specific currency pair. To ensure the accuracy of data, the nodes have to reach consensus on each piece of data.

Those pieces of data are put into a smart contract and thus form a data feed which in our example contains the entire history of rate changes in the cryptocurrency pair, recorded to the blockchain. That data feed can be later read by a dApp that requires the exchange rate information.

To reach consensus between nodes, various models can be used. In the reputation-based model, a node's reputation is based on the accuracy of provided data, which is checked against data provided by other nodes. Another model is based on curation of nodes by the community to determine if a specific node provides accurate information.

Among the best known projects providing oracle solutions are Band Protocol, DIA (Decentralized Information Asset) and Chainlink.

Ranking of Oracles by Total Value Secured / DefiLlama
Ranking of Oracles by Total Value Secured / DefiLlama

Application areas

Arguably, the most popular segment using blockchain oracles is decentralized finance (DeFi), as it needs access to data about financial assets and markets. For instance, decentralized money markets use feeds from price oracles to check if a user's positions is undercollateralized and should be liquidated. Along the same lines, synthetic asset platforms use oracle feeds to track the value of tokens pegged to real-world assets.

Oracles also enable non-financial use cases for smart contracts, including NFTs that can change their shape and form depending on external events, such as weather or the time of day.

Another use case for oracles are on-chain games and contests that require verifiable randomness – something that blockchains cannot provide. The issue is solved by oracles fetching offchain random data to the blockchain. Randomness provided by oracles can also be used in various token drops.

Meanwhile, prediction markets use oracles to supply data from sporting games and other events on which bets are placed.

Oracle types

Oracles can be broken down into several categories, based on different characteristics.

Inbound and outbound oracles

Arguably, the most often used oracles are those which fetch data from the real-world and supply it to a blockchain to be used by smart contracts and dApps. This type of oracle is called "inbound" or "input." Data fetched by inbound oracles ranges from currency exchange rates to sporting games' results and weather data.

Conversely, oracles that enable smart contracts to send commands to offchain systems in order to execute a certain action, are referred to as "outbound" or "output" oracles. An outbound oracle can, for instance, inform a bank that a payment should be made or send a signal to unlock a vehicle rented onchain to an IoT system.

Centralized and decentralized oracles

Another major criteria is based on who controls an oracle. Obviously, centralized oracles are those which are controlled by a single entity, serving as the sole data source for a smart contract. The use of a single source could be risky as the contract will have to rely exclusively on the entity running the oracle.

In contrast, decentralized oracles operate on the same principles, as public blockchains, aiming to minimize counterparty risks. As data supplied by decentralized oracles does not depend on a single source, it is set to be much more reliable. In case of discrepancies between data from different sources a final output is reached through consensus of all data sources.

Decentralized oracles are also referred to as decentralized oracle networks (DONs) as they basically consist of a network of oracles.

Hardware and software oracles

These two types of oracles differ in what kind of data they deliver. Hardware oracles fetch data from the physical world, such as that from camera motion sensors or radio frequency identification (RFID) sensors. Meanwhile, software oracles fetch real-time data, including exchange rates or travel information

Compute-enabled, or computation oracles

Sometimes, computation for a specific task performed by a smart contract turns out to be too expensive due to gas costs or could not be done onchain due to technical or legal limitation.

This issue is solved by compute-enable or computation oracles. They fetch data to an offchain system that performs the computation, after which the outcome is delivered back to the blockchain.

Cross-chain oracles

Cross-chain oracles are those which can receive and send data and assets between different blockchains.

Security concerns

As bridges between the offchain and onchain worlds, oracles may present a security risk that should be taken into account. If an oracle is hacked, the execution of smart contracts that oracle feeds could be in jeopardy.

Also, while selecting an oracle, its trust model has to be thoroughly considered. A smart contract's security can be compromised if it is exposed to potentially inaccurate feeds from a smart contract.

The use of decentralized oracles solves the latter issue, but, in any case, the selection of an oracle has to be done very carefully.

GTON Capital's DON

GTON Capital is currently building its own DON. It will operate as a fork of Chainlink, run and maintained by the GTON Capital team.

In addition to Chainlink data feeds, GTON Capital's DON will receive data feeds from DIA and Band, using the two projects' public APIs. GTON DON's node will fetch data from the APIs and record it to GTON Network. 

The main use cases for GTON Capital's DON will be data for prediction markets and exchange rate data that will help maintain GTON Capital's upcoming stablecoin's peg ($GCD) to the US dollar.

About GTON Capital

GTON Capital builds infrastructure to advance digital capital markets including GTON Network — L2 Ethereum rollup with $GCD stablecoin as a native currency, Pathway — algorithms for the pricing of governance tokens, set of mutually reinforcing DeFi protocols, DONs, and more.

By combining cutting-edge achievements of Web 3.0 technology, GTON Capital creates a more advanced and stable foundation for DeFi development.

Website | Twitter | Telegram | Discord | GitHub | Youtube | Mirror | Blog |**

Subscribe to GTON Capital
Receive the latest updates directly to your inbox.
This entry has been permanently stored onchain and signed by its creator.