Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Data Request

A data request is a query initiated on-chain, typically via a smart contract function call, that specifies the external data needed from an oracle network.
Chainscore © 2026
definition
BLOCKCHAIN GLOSSARY

What is a Data Request?

A fundamental operation in decentralized systems where a user or smart contract queries an external data source.

A Data Request is a structured query, typically initiated by a smart contract or decentralized application (dApp), that seeks to retrieve or verify information from a source external to its native blockchain. This mechanism is essential for connecting on-chain logic with off-chain data, enabling smart contracts to execute based on real-world events, market prices, or any information not natively stored on the ledger. The entity fulfilling the request is often called an oracle or data provider.

The technical flow of a data request involves several key steps. First, the requesting contract emits an event or makes a call specifying the needed data, such as a price feed for ETH/USD. One or more oracle nodes then detect this request, fetch the data from pre-defined API endpoints or sources, and submit the response back to the blockchain in a new transaction. To ensure security and accuracy, many oracle networks use cryptographic proofs and consensus mechanisms, aggregating responses from multiple nodes to produce a single, reliable data point.

Data requests are categorized by their pattern and purpose. A pull-based request is initiated on-demand by the contract, while a push-based (or publish-subscribe) model has oracles periodically pushing updates. Common use cases include fetching asset prices for decentralized finance (DeFi) protocols, retrieving randomness for NFT minting or gaming, verifying proof of identity, and confirming the outcome of real-world events for prediction markets or insurance contracts.

Implementing a data request requires careful design to address the oracle problem, which encompasses issues of data authenticity, source reliability, and timeliness. Developers must select oracle solutions that provide cryptographic proof of data integrity, such as TLSNotary proofs or zero-knowledge proofs, to prevent manipulation. The cost of a request is typically paid in the network's native token or the oracle's service token, covering the gas fees for the response transaction and the provider's operational costs.

Prominent oracle networks like Chainlink, API3, and Pyth Network have standardized the data request process. They provide developer frameworks and pre-built oracle contracts that abstract away much of the complexity. For example, a developer can integrate a price feed by simply calling a function from a deployed data feed contract, which manages the underlying request/response cycle, aggregation, and updating automatically, providing a clean interface for on-chain applications.

key-features
BLOCKCHAIN DATA PIPELINE

Key Features of a Data Request

A Data Request is a structured query for on-chain information, forming the core of any blockchain data pipeline. Its features define the scope, execution, and delivery of the requested data.

01

Query Specification

The smart contract address, function signature, and input parameters that define what data to fetch. This is the executable instruction for the blockchain node.

  • Example: Calling the balanceOf(address) function on an ERC-20 token contract.
  • Granularity: Can target a single storage slot, an event log filter, or a complex state computation.
02

Execution Trigger

The mechanism that initiates the data fetch. This can be on-demand (user-initiated), scheduled (cron-based), or event-driven (triggered by an on-chain transaction or block).

  • Oracle-based: A decentralized oracle network fulfills the request off-chain.
  • RPC Call: A direct call to a node's JSON-RPC endpoint (e.g., eth_call).
03

Data Provenance & Freshness

Specifies the block number or block hash from which to read state, ensuring verifiable and consistent data. This is critical for deterministic results.

  • Latest Block: For real-time data.
  • Finalized Block: For secure, non-reorgable data.
  • Historical Block: For auditing or analytics at a past state.
04

Response Format & Delivery

Defines how the raw blockchain data (bytes, integers, addresses) is decoded, formatted, and delivered to the requester.

  • ABI Decoding: Uses the contract's Application Binary Interface to parse the raw response into human-readable types (e.g., uint256, string).
  • Output Destinations: Can be returned directly to a smart contract, sent to an API endpoint, or written to a data warehouse.
05

Gas & Cost Management

For on-chain execution (via eth_call or an oracle), the request must account for gas limits and potential computation costs. Off-chain requests incur infrastructure costs for node providers.

  • Gas Estimation: Prevents out-of-gas errors for complex queries.
  • Pricing Models: Can be subscription-based, pay-per-request, or covered by protocol fees.
06

Error Handling & Timeouts

Mechanisms to manage reverts, node unavailability, and response latency. Robust systems implement retries, fallback nodes, and clear error messaging.

  • RPC Errors: -32000 execution reverted, -32603 internal error.
  • Timeouts: Critical for applications requiring data within a specific block time.
how-it-works
MECHANISM

How a Data Request Works

A data request is the fundamental operation for retrieving verifiable information from a blockchain or decentralized network. This process involves a structured query, a decentralized oracle network for execution, and the on-chain delivery of a cryptographically signed result.

A data request is initiated when a smart contract, often called a consumer contract, requires external information to execute its logic. This request specifies the required data—such as a price feed, weather result, or sports score—and the conditions for retrieval. The request is broadcast to a decentralized oracle network, like Chainlink, which acts as a secure middleware layer between the blockchain and off-chain data sources. The request typically includes parameters like the data source URLs, the parsing path (e.g., a JSON path), and the number of oracle nodes required to respond.

Upon receiving the request, a decentralized network of independent oracle nodes fetches the data from the specified external API or data source. Each node retrieves the data independently, performs any necessary computation or aggregation, and submits its response back to the oracle network. A critical component is off-chain reporting (OCR), where nodes first cryptographically sign and aggregate their responses into a single, consolidated report off-chain. This aggregation minimizes on-chain transaction costs and latency before a single representative transaction submits the final, verified result to the blockchain.

The final aggregated data is delivered on-chain via a callback to the requesting smart contract's function, often named fulfillRequest. This payload includes the requested data and a cryptographic proof, such as a multi-signature from the oracle committee, attesting to the validity of the response. The consumer contract can then trustlessly use this data to settle a derivative, release funds in a lending agreement, or trigger any other predefined on-chain action. This end-to-end process ensures data integrity through decentralization and cryptographic guarantees, making external data as reliable as the blockchain itself for smart contract execution.

code-example
PRACTICAL IMPLEMENTATION

Code Example: A Simple Data Request

This section demonstrates a concrete implementation of a data request using a popular oracle protocol, breaking down the code to explain how smart contracts fetch external information.

A data request is a transaction where a smart contract asks an oracle network, like Chainlink, for external data, which is then delivered in a subsequent transaction. The core mechanism involves a requesting contract emitting an event that oracle nodes detect, sourcing the data off-chain, and returning it via a callback function. This example uses a ChainlinkClient contract to request the latest ETH/USD price from a Chainlink oracle, showcasing the standard request-and-receive pattern.

The code begins by importing the necessary interfaces, primarily ChainlinkClient.sol, which provides the foundational logic for creating and managing requests. The contract defines key variables: the oracle node's address (oracle), the job ID for the specific price feed task (jobId), and the fee paid in LINK tokens. The request is initiated by calling the requestEthereumPrice function, which builds and sends a Chainlink.Request to the specified oracle, including the job ID and the address for the callback.

Upon successful off-chain execution, the oracle node calls the contract's fulfill function (e.g., fulfill(bytes32 _requestId, uint256 _price)), delivering the data. This callback function is where the application logic uses the verified data, such as updating a state variable. It is critical that only the requesting oracle can call this function, a security feature enforced by the underlying client library. This pattern decouples the request transaction from the response, allowing for asynchronous and reliable data retrieval without blocking the contract.

Developers must ensure the contract holds a sufficient balance of LINK tokens to pay the oracle fee and that the fulfill function handles the data correctly and securely. Common variations include requests for multiple data points, using different data feeds (e.g., BTC/USD, weather data), or implementing custom computation jobs. Understanding this flow is fundamental to building hybrid smart contracts that interact with the world beyond the blockchain.

examples
DATA REQUEST

Examples and Use Cases

A Data Request is a structured query for specific on-chain or off-chain information, initiated by a smart contract or oracle client to be fulfilled by an oracle network. Below are key applications and real-world implementations.

ecosystem-usage
DATA REQUEST

Ecosystem Usage

A Data Request is a structured query for specific on-chain or off-chain information, submitted to a decentralized oracle network like Chainlink. These requests are the fundamental mechanism by which smart contracts access external data feeds, trigger computations, or verify real-world events.

01

Decentralized Price Feeds

The most common use case, where a smart contract requests the latest price of an asset (e.g., ETH/USD). The oracle network aggregates data from multiple premium sources, creating a tamper-resistant and highly available data feed. This is critical for DeFi protocols like lending markets (e.g., Aave) and decentralized exchanges (e.g., Uniswap) to determine collateral values and execute liquidations.

  • Key Components: AggregatorV3Interface, latestRoundData() function.
  • Example: A lending protocol requests the ETH price to check if a user's collateralization ratio has fallen below the required threshold.
02

Verifiable Random Function (VRF)

A request for a cryptographically secure and provably fair random number. The oracle generates the random number and a cryptographic proof, which the requesting contract can verify on-chain before using the result. This prevents manipulation and ensures trustless randomness for applications like:

  • NFT Minting & Loot Boxes: Fair distribution of rare traits.
  • Gaming: Random in-game events or matchmaking.
  • DAO Governance: Random selection of committee members.

Unlike pseudo-random solutions, Chainlink VRF provides on-chain verifiability that the number was not known before the request was made.

03

Cross-Chain Communication (CCIP)

A request to send data or tokens across different blockchain networks. This enables interoperability by allowing smart contracts on one chain to trigger actions or transfer value on another. The request is routed through the Chainlink network, which validates and commits the message on the destination chain.

  • Use Cases: Cross-chain DeFi, bridging assets, multi-chain NFT minting, and unified governance.
  • Key Feature: Provides a unified interface for developers to build applications that span multiple ecosystems without managing individual bridge infrastructure.
04

API Calls & Off-Chain Computation

A request for data from any external API or for a custom computation to be performed off-chain. This extends smart contract functionality far beyond on-chain data. Developers can define the API endpoint, data parsing, and formatting within the request.

  • Examples:
    • Fetching weather data for parametric insurance.
    • Retrieving sports scores for prediction markets.
    • Running complex machine learning models whose output is needed for a contract's logic.
  • Process: The request is fulfilled by Chainlink nodes that execute the HTTP GET/POST request and return the result on-chain.
05

Automation (Keeper Network)

A request to register a smart contract function for time-based or condition-based execution. The Chainlink Automation network monitors the blockchain for the defined conditions (e.g., a specific timestamp or a price reaching a limit) and automatically submits a transaction to execute the function.

  • Critical for:
    • Yield harvesting and portfolio rebalancing in DeFi.
    • Limit order execution for DEXs.
    • Rebasing tokens and performing regular upkeep for DAOs.
  • Eliminates the need for centralized cron jobs or manual intervention, ensuring reliability and decentralization.
06

Proof of Reserve

A request to cryptographically verify the off-chain reserves backing a tokenized asset. An oracle network independently audits the custodian's holdings (e.g., bank accounts, gold vaults) and posts the proof on-chain. This provides transparency and auditability for stablecoins, wrapped assets, and tokenized real-world assets (RWAs).

  • Process: The auditor (a Chainlink node) signs a cryptographically verifiable report of the reserve holdings.
  • Impact: Allows users and protocols to verify 1:1 backing in real-time, mitigating counterparty risk and increasing trust in the asset's peg.
security-considerations
DATA REQUEST

Security Considerations

Data requests in blockchain contexts, such as oracles or cross-chain messaging, introduce unique attack vectors. This section details the critical security risks and mitigation strategies.

01

Data Authenticity & Source Integrity

Ensuring data originates from a trusted, tamper-proof source is paramount. Risks include:

  • Spoofing Attacks: Malicious actors impersonating a legitimate data provider.
  • Data Manipulation at Source: Compromising the primary API or data feed before it reaches the blockchain.
  • Mitigation: Use multiple, independent data sources (decentralized oracles), cryptographically signed data proofs, and on-chain verification of source identities.
02

Data Freshness & Timeliness Attacks

Stale or delayed data can be exploited for profit, especially in DeFi.

  • Stale Price Attacks: Using an outdated asset price to execute favorable trades.
  • Time Bandit Attacks: Miners/validators reordering blocks to exploit time-sensitive data.
  • Mitigation: Implement strict heartbeat mechanisms and timestamping. Use systems that penalize delayed updates and verify data timeliness on-chain.
03

Oracle Manipulation & Extraction

A primary risk where an attacker directly manipulates the data feed to drain funds from dependent smart contracts.

  • Flash Loan Attacks: Borrowing large capital to temporarily skew a price on a DEX, manipulating an oracle that uses that DEX as its source.
  • Mitigation: Use time-weighted average prices (TWAPs), draw data from deep liquidity pools, and implement circuit breakers that halt operations during extreme volatility.
04

Transport & Validation Security

Securing the data's journey from source to destination blockchain.

  • Man-in-the-Middle Attacks: Intercepting and altering data in transit.
  • Validator/Callback Vulnerabilities: Flaws in the code that receives and processes the external data on-chain.
  • Mitigation: Employ TLS/encrypted channels, use merkle proofs for data integrity, and rigorously audit the receiving smart contract's callback logic.
05

Decentralization & Sybil Resistance

Centralized data request systems create single points of failure.

  • Single Oracle Failure: A compromised or faulty node provides incorrect data to all dependent contracts.
  • Collusion: A majority of nodes in a decentralized oracle network conspiring to submit false data.
  • Mitigation: Design systems with economic staking/slashing, a diverse set of node operators, and consensus mechanisms that require data attestations from multiple independent parties.
06

Cross-Chain Message Authentication

For cross-chain data requests (e.g., bridging, omnichain apps), verifying the message's origin chain and integrity is critical.

  • Fake Deposit Events: Spoofing a deposit event on the source chain to mint illegitimate assets on the destination.
  • Validator Set Attacks: Compromising the light client or multi-sig responsible for verifying cross-chain state.
  • Mitigation: Use cryptographic merkle proofs verified on-chain (e.g., Merkle Patricia Proofs), and robust fraud-proof or optimistic verification systems.
DATA ACCESS PATTERNS

Comparison: Data Request vs. Related Concepts

This table contrasts the technical and operational characteristics of a Data Request with other common methods for obtaining external data on-chain.

FeatureData RequestBlockchain OracleData FeedDirect API Call

Primary Function

On-chain query for specific, verifiable data

General-purpose bridge for external data & computation

Continuous stream of pre-defined data points

Direct, unverified call from a smart contract

Data Freshness

On-demand (pull-based)

Configurable (push or pull-based)

Periodic (push-based)

On-demand (pull-based)

Verification Method

Cryptographic proof (e.g., TLSNotary, TEE)

Consensus of multiple nodes or cryptographic attestation

Signed by a trusted provider or decentralized network

None (trusts the calling contract's environment)

Execution Scope

Off-chain, with proof posted on-chain

Off-chain, with result posted on-chain

Off-chain, with result posted on-chain

On the blockchain's execution layer

Gas Cost for Data

High (pays for proof generation & verification)

Medium (pays for oracle network service)

Low (subsidized or fixed fee for pre-funded feed)

Not applicable (fails unless API is on-chain)

Decentralization Level

Verification is decentralized; sourcing can vary

Varies (from centralized to fully decentralized networks)

Varies (from single provider to decentralized networks)

Centralized (depends on the API operator)

Use Case Example

Proving a specific user's bank balance at a time

Getting the current price of ETH/USD for a DApp

Subscribing to a continuously updated price feed

Querying data from another on-chain smart contract

Native Blockchain Support

DATA REQUEST

Frequently Asked Questions (FAQ)

Common questions about requesting and interpreting blockchain data using Chainscore's APIs and tools.

A data request is a structured query to a blockchain data provider, such as Chainscore, to retrieve specific on-chain information. It works by specifying parameters like a wallet address, smart contract, transaction hash, or block number, which the provider's infrastructure uses to filter and return relevant data from indexed blockchain ledgers. The process involves querying a high-performance database that has pre-processed raw blockchain data into a queryable format, rather than scanning the live chain directly. This allows for complex analytical questions about token balances, transaction history, DeFi positions, or NFT ownership to be answered in milliseconds. Developers typically make these requests via REST or GraphQL APIs, receiving responses in structured JSON format for easy integration into applications.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Data Request: On-Chain Query for Oracle Data | ChainScore Glossary