What Is Offchain Data and Computation?

Definition
DEFINITION

Offchain data, sometimes known as real-world data, is any data that is external to a blockchain.

What is offchain data? Offchain data, sometimes known as real-world data, is any data that is external to a blockchain, such as sports scores, weather data, and financial market data, as well as data on other blockchains. Blockchains are, by their very nature, isolated systems, so connecting a blockchain to off-chain data is like connecting a computer to the Internet—it enables an isolated system to interact with the real world. The high security guarantees of blockchains must be upheld when accessing off-chain data, which is why Chainlink trust-minimized services have become an industry standard. 

Another offchain mechanism that increases the utility of blockchains is offchain computation, which includes verifiable randomness, transaction ordering services, and smart contract automation. Offchain computation is simply computation that takes place outside a blockchain. Oracle networks can provide a trust-minimized form of offchain computation to extend the capabilities of blockchains—this is known as oracle computation. Empowering blockchains with offchain computation is like connecting a laptop to a cloud service like AWS; it exponentially expands the available compute power and enables high-performance yet cost-efficient applications to be built. 

Why is offchain data and computation so important to the Web3 ecosystem? 90% of smart contract use cases require access to off-chain data, including many decentralized finance (DeFi) use cases, parametric insurance, and dynamic NFTs. Offchain computation helps these applications to scale in a cost-efficient and privacy-preserving manner, as well as introduce more advanced functionality such as automation and randomness. Together, offchain data and offchain computation enable developers to build feature-rich and scalable hybrid smart contracts that can help solve real-world problems for millions and eventually billions of users. 

In this article, you’ll learn how oracles connect blockchains to off-chain data and computation, the difference between offchain and onchain data, explore the advantages unlocked by offchain resources, and learn why Chainlink is the leading solution for connecting off-chain resources to blockchains. 

Connecting Off-Chain Resources to Blockchains With Decentralized Oracle Networks 

When a blockchain is connected to offchain resources, the computational power and data available to smart contracts dramatically expands. While it’s possible to leverage centralized off-chain services like those in Web2, that would introduce a single point of failure, undermining the security guarantees that blockchains provide. 

In order to connect blockchains to offchain data, developers need to overcome the “oracle problem,” which describes the inability of blockchains to connect to external resources in a highly secure and tamper-proof manner. Chainlink solves the oracle problem by enabling decentralized oracle networks (DONs) to operate as a secure middleware layer connecting off-chain resources to blockchains. The Chainlink Network is the industry-leading oracle network and is responsible for helping secure tens of billions of dollars across the Web3 ecosystem. 

Decentralized oracle networks (DONs) expand the data accessibility and computational power of blockchains and smart contracts in a trust-minimized manner in order to not compromise on security. DONs enhance the performance, functionality, and interoperability of blockchains by enabling hybrid smart contracts. These contracts fuse the trust-minimized properties of blockchains with the feature-richness of off-chain computing resources and data to enable more advanced applications and use cases that are impossible with on-chain systems alone.

Decentralized Oracle Networks (DONs) enable smart contracts to securely connect with external data and systems
Decentralized Oracle Networks (DONs) enable smart contracts to securely connect with external data and systems.

Onchain vs. Offchain

Blockchains are immutable, deterministic, highly secure, and censorship-resistant ledgers secured by a network of full nodes. While this design endows blockchains with a high level of security and determinism, it also means that blockchains often have to make tradeoffs around privacy, speed, and decentralization. However, by combining blockchains with offchain systems, blockchains are able to extend their capabilities, from lowering costs and increasing throughput by moving computations offchain to incorporating real-world information in on-chain executions. 

Hybrid smart contracts combine on-chain code with off-chain decentralized oracle networks to enable more advanced blockchain-based applications
Hybrid smart contracts combine onchain code with offchain decentralized oracle networks to enable more advanced blockchain-based applications.

Onchain Data

Onchain data is limited to what can be natively generated within a blockchain network. This consists of account addresses and their associated balances, along with smart contract state. 

Onchain data includes:

  • Accounts—Blockchains accounts are individual addresses that can send and receive transactions.
  • Balances—The number of native coins owned by an account, such as 10 BTC on the Bitcoin blockchain or 100 ETH on Ethereum.
  • Smart contracts—Distributed computer programs stored in the global state of a blockchain, such as an ERC20 token contract or an automated market maker (AMM) application.

Offchain Data 

Offchain data is information that is external to blockchains. Enabling blockchains to interact with the real world enables a multiplicity of smart contract use cases across many different industries. 

Chainlink DONs bring a wide range of offchain datasets onchain in a highly secure and reliable manner, where they’re consumed by smart contracts:

  • Financial data—Chainlink Price Feeds power the DeFi economy with hyper-reliable and globally precise price data that is used for decentralized stablecoins, lending and borrowing protocols, and much more. 
  • Weather data—Chainlink Data Feeds deliver rainfall, temperature, and other weather data to weather prediction markets, hedging markets, and dynamic NFTs. For example, Arbol fetches weather data through Chainlink Data Feeds to support its provision of parametric crop insurance to farmers in developing nations.
  • Sports, supply chain, and economic data—Data Feeds also deliver a wide range of data on-chain, such as sports statistics, supply chain information, election results, inflation rates, and much more. 
  • Reserves data—Chainlink Proof of Reserve provides audits on the reserves of fiat-backed stablecoins and cross-chain assets, helping DeFi applications mitigate the negative effects of fractional reserve activities. 
  • Identity data—Chainlink oracles can verify user identities for decentralized applications using e-signatures, credentials, and domain names in a privacy-preserving manner.
  • Any API—Chainlink Any API enables developers to access any external data source using existing Chainlink nodes in a backward-compatible manner. 

With a total of over two billion data points delivered on-chain, Chainlink Data Feeds and other trust-minimized services power hundreds of projects in the blockchain ecosystem, including industry-leading protocols such as Aave, Compound, dYdX, Liquity, Synthetix, and many more.

Visualizing the interactions between off-chain and on-chain resources
Visualizing the interactions between offchain and onchain resources.

Onchain Computation

Blockchains are uniquely specialized in performing specific categories of computation and generate strong consensus regarding transactions. While they excel at verifying ownership, executing immutable smart contracts, and providing a single source of truth, they lack the feature-richness offered by offchain systems. 

Examples of onchain computation include: 

  • Verifying ownership—When a user makes a transaction from their account, the blockchain will check the private key signature used matches the public key. 
  • Executing smart contracts—When smart contract functions receive inputs, such as the trading of a token on a decentralized exchange, the blockchain computes the transaction and executes a state change.
  • Adding new blocks—Nodes regularly add new blocks of transactions to the blockchain, which other nodes check by re-executing all transactions in the block.

Offchain Computation

Through trust-minimized off-chain computation executed by an oracle network, computations that are impossible or unsuitable for executing on-chain due to costs, scalability, or other concerns can be performed off-chain and then relayed onchain. 

Offchain computation performed by the Chainlink Network includes: 

  • Verifiable randomness—Chainlink VRF generates randomness backed by a cryptographic proof, which is then delivered and verified onchain. This enables on-chain gaming dApps to introduce unpredictable gameplay events and for NFTs mints to take place in a provably fair manner.
  • Smart contract automation—Chainlink Automation provides a decentralized transaction execution service that can be used to automatically trigger crucial smart contract functions such as executing liquidations, rebasing tokens, settling limit orders, and more. This is made possible by executing a portion of a smart contract offchain to detect if an onchain function needs to be called.
  • Offchain reporting—Multiple nodes within a Chainlink Data Feed can aggregate their responses offchain into a single oracle report through the Off-Chain Reporting (OCR) protocol, increasing cost-efficiency, supporting larger committees of nodes, and increasing reliability during periods of extreme blockchain network congestion. 

Advantages of Offchain Data and Offchain Computation

Offchain resources unlock advanced smart contract functionality and enable developers to build feature-rich applications. 

Offchain Data Advantages

Without offchain resources, blockchains are limited to simple functionality such as the creation and transfer of tokens. Bringing offchain data to a blockchain network empowers developers to build more advanced applications such as parametric insurance, prediction markets, stablecoins, and much more. 

Providing blockchains with access to real-world information enables multiple advanced use cases: 

  • Hedging financial risk—Financial market data enables traders to hedge financial positions using prediction markets. 
  • Parametric insurance—Parametric insurance helps mitigate the financial impact of real-world risks. For example, weather data makes it possible for farmers to protect against financial losses that stem from a drought by purchasing blockchain-based parametric crop insurance.
  • Supply chain tracking—RFID tracking, IoT sensors, and customs clearance data empower protocols to verify the location of goods within a supply chain. 
  • Identity verification—By cross-referencing e-signatures or biometrics data with a secure database, applications can verify user identities. 
  • Supporting sustainability—IoT sensors and satellite imagery can be used to measure greenhouse gas emissions and reforestation projects, and this data can be brought on-chain to enable multiple smart contract use cases, such as carbon credit verification.
  • Reserves verification—Verifying the reserves of stablecoins and cross-chain assets helps users ensure the tokens are fully backed.  

Offchain Computation Advantages

With work offloaded from blockchain nodes, developers are able to build use cases that would otherwise be impossible through onchain computation alone.  

Trust-minimized offchain computation provided by DONs extends the capability of blockchain networks with features such as:

  • Enhanced privacy—Completing computation offchain can ensure that private user data, such as identity-related information, is not posted on a public blockchain ledger for anyone to see. 
  • Speed and scalability—A high volume of computations can quickly be performed offchain with their outputs recorded on-chain, enabling developers to build fast and scalable dApps.  
  • Cost efficiency—Aggregating data offchain before posting it on-chain in a single transaction can reduce costs significantly. 
  • Flexibility—Offchain computation allows users to determine the specific trade-offs between security and performance that they’re willing to make. They can customize their degree of decentralization, crypto-economic security, and other security factors. 

Offchain Resources Powered by Chainlink DONs

The Chainlink Network is the industry-leading solution for connecting blockchains to off-chain resources including both data and computation. Services in the Chainlink ecosystem actively support hundreds of advanced smart contracts across a dozen blockchains and currently help secure tens of billions of dollars worth of value across the Web3 economy.

In this video, learn how Chainlink brings unrivaled levels of utility to decentralized applications by providing real-world data and off-chain computation:  

 

Developers can start using offchain data and computation today by integrating Chainlink trust-minimized services. You can use Chainlink Data Feeds to access high-quality, hyper-reliable real-world data, Chainlink VRF as a tamper-proof source of cryptographically secure randomness, Chainlink Automation to trigger your smart contract functions in a decentralized, cost-efficient, and highly secure manner, and Chainlink Proof of Reserve to monitor reserve assets using automated audits.

By combining these services, developers can build feature-rich, cost-efficient, and scalable applications that uphold the security guarantees of blockchains. If you want to leverage offchain computation in your Ethereum or Solana dApp, visit the docs, Discord, or chat with an expert.

Learn more about blockchain technology

Get the latest Chainlink content straight to your inbox.