What Is Off-Chain Data and Computation?
Off-chain data, sometimes known as real-world data, is any data that is external to a blockchain.
What is off-chain data? Off-chain 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 off-chain mechanism that increases the utility of blockchains is off-chain computation, which includes verifiable randomness, transaction ordering services, and smart contract automation. Off-chain computation is simply computation that takes place outside a blockchain. Oracle networks can provide a trust-minimized form of off-chain computation to extend the capabilities of blockchains—this is known as oracle computation. Empowering blockchains with off-chain 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 off-chain 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. Off-chain 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, off-chain data and off-chain 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 off-chain and on-chain data, explore the advantages unlocked by off-chain 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 off-chain 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 off-chain 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.
On-Chain vs. Off-Chain
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 off-chain systems, blockchains are able to extend their capabilities, from lowering costs and increasing throughput by moving computations off-chain to incorporating real-world information in on-chain executions.
On-chain 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.
On-chain 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.
Off-chain 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 off-chain datasets on-chain 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.
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 off-chain systems.
Examples of on-chain 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.
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 on-chain.
Off-chain computation performed by the Chainlink Network includes:
- Verifiable randomness—Chainlink VRF generates randomness backed by a cryptographic proof, which is then delivered and verified on-chain. 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 off-chain to detect if an on-chain function needs to be called.
- Off-chain reporting—Multiple nodes within a Chainlink Data Feed can aggregate their responses off-chain 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 Off-Chain Data and Off-Chain Computation
Off-chain resources unlock advanced smart contract functionality and enable developers to build feature-rich applications.
Off-Chain Data Advantages
Without off-chain resources, blockchains are limited to simple functionality such as the creation and transfer of tokens. Bringing off-chain 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.
Off-Chain Computation Advantages
With work offloaded from blockchain nodes, developers are able to build use cases that would otherwise be impossible through on-chain computation alone.
Trust-minimized off-chain computation provided by DONs extends the capability of blockchain networks with features such as:
- Enhanced privacy—Completing computation off-chain 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 off-chain with their outputs recorded on-chain, enabling developers to build fast and scalable dApps.
- Cost efficiency—Aggregating data off-chain before posting it on-chain in a single transaction can reduce costs significantly.
- Flexibility—Off-chain 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.
Off-Chain 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 off-chain 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 off-chain computation in your Ethereum or Solana dApp, visit the docs, Discord, or chat with an expert.