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

Pull Oracle

A pull oracle is a decentralized oracle design pattern where an on-chain smart contract initiates a request for external data, which is then fetched and delivered in a subsequent transaction.
Chainscore © 2026
definition
BLOCKCHAIN DATA MECHANISM

What is a Pull Oracle?

A pull oracle is a decentralized data feed where the on-chain contract actively requests, or 'pulls,' external data only when it is needed for execution.

A pull oracle is a type of blockchain oracle where the smart contract initiates a request for external data on-demand. Unlike a push oracle that automatically sends data, the contract must explicitly call a function to trigger the data retrieval process. This model shifts the transaction cost and execution responsibility to the end-user or the contract itself, making it a gas-efficient design for data that is not required continuously. The request typically involves paying a fee to the oracle network, which then fetches the data, verifies it, and returns the result in a subsequent transaction.

The technical workflow involves a multi-step process. First, a user interacts with a dApp, triggering the smart contract to emit an event containing a data request. Off-chain oracle nodes, often part of a decentralized network like Chainlink, detect this event. They then fetch the required information from the designated API or data source, perform consensus on the result, and submit the final answer back to the blockchain in a callback transaction. The requesting contract has a predefined function to receive and process this callback, updating its state accordingly.

Key advantages of the pull model include cost predictability and reduced on-chain overhead. Contracts and users only pay for data when it is explicitly needed, avoiding the continuous gas costs associated with push oracles that update on a schedule. This makes pull oracles ideal for applications like insurance claims processing, where data is needed sporadically, or for low-frequency price checks. However, the trade-off is increased latency, as the data is not pre-fetched and requires waiting for the oracle network's response time.

Common implementations and examples are found in leading oracle solutions. The Chainlink network extensively uses a pull-based model through its Request & Receive data cycle. Another example is a verifiable random function (VRF) for generating provably fair randomness, where the contract requests randomness and the oracle responds with a random number and a cryptographic proof. This design pattern ensures that expensive computation and data fetching occur off-chain, preserving the blockchain's scalability while maintaining decentralized security guarantees.

When comparing oracle designs, the choice between pull and push (or publish-subscribe) oracles depends on the application's requirements. Pull oracles excel in scenarios demanding user-paid fees, event-driven logic, and gas optimization. Push oracles are better suited for data that must be constantly available, such as real-time price feeds for decentralized exchanges. Hybrid models also exist, where a push oracle maintains a baseline data feed that can be supplemented by specific pull requests for customized or infrequent data points.

how-it-works
MECHANISM

How a Pull Oracle Works

A pull oracle is a decentralized data feed where data is retrieved on-demand by a smart contract, rather than being pushed to it automatically.

A pull oracle (or on-demand oracle) is a decentralized oracle design pattern where a smart contract explicitly requests external data only when it is needed to execute a specific function. This is in contrast to a push oracle, which continuously streams data updates onto the blockchain. The core mechanism involves a user or contract initiating a transaction that calls a function like requestData(). This function emits an event that is detected by an off-chain oracle network, which then fetches the data, submits it back in a subsequent transaction, and finally triggers a callback function in the original contract to complete the execution with the verified data.

The architecture typically involves several key steps and components. First, the requesting contract defines the data it needs (e.g., the price of ETH/USD) and specifies a callback function. An off-chain oracle node or decentralized network listens for these request events. Upon detection, the node retrieves the data from the specified API or source, often applying aggregation and validation logic. It then sends the data back to the blockchain in a signed transaction, paying the associated gas fees. Finally, the oracle calls the predefined callback function in the requesting contract, providing the data payload for final computation or state change.

This model offers distinct advantages and trade-offs. A primary benefit is cost efficiency, as data is only fetched and written on-chain when required, avoiding the continuous gas costs of push updates. It also provides deterministic finality; the entire process—from request to callback—is a single, trackable execution flow. However, it introduces latency, as the process requires multiple blockchain transactions (request and response) and off-chain processing time. It also places the gas cost burden on the oracle service or the end-user for the response transaction. Prominent examples include Chainlink's Any API and the ChainlinkClient contract pattern, which implement this on-demand data retrieval model.

key-features
ARCHITECTURE

Key Features of Pull Oracles

Pull oracles are a decentralized data-fetching model where the on-chain contract initiates a request for off-chain data, which is then fulfilled by a permissionless network of node operators. This contrasts with the continuous, unsolicited data pushes of push oracles.

01

On-Demand Data Fetching

A pull oracle operates on a request-response model. An on-chain smart contract (the consumer) explicitly initiates a data query by emitting a log event. Off-chain node operators monitor the blockchain, fulfill the request by fetching data from specified APIs, and submit the signed result in a subsequent transaction. This creates a clear, auditable link between request and fulfillment.

02

Gas Cost Responsibility

In a pull model, the gas cost for submitting the final data point on-chain is borne by the fulfilling node, not the requesting contract. This shifts the operational cost burden to the oracle service provider. The requesting contract typically pays a fee in the native token (e.g., ETH) to compensate the node for this gas expenditure and service.

03

Permissionless Node Networks

Pull oracle protocols like Chainlink Functions or API3 dAPIs rely on decentralized networks of node operators. Anyone can run a node and compete to fulfill data requests. This eliminates single points of failure and censorship. Node reputation, staking, and cryptographic proofs (like TLSNotary) are used to ensure data integrity and punish malicious actors.

04

Enhanced Freshness & Customizability

Because data is fetched at the moment it's needed, pull oracles provide fresh data for time-sensitive applications. They are highly customizable, allowing developers to specify:

  • The exact API endpoint and data path.
  • The required number of independent node responses.
  • Aggregation logic (e.g., median, average) for multi-source queries. This makes them ideal for less frequent, bespoke data needs.
05

Comparison to Push Oracles

Push oracles (like many price feeds) broadcast data at regular intervals to all subscribers, ideal for high-frequency data (e.g., asset prices). Pull oracles are event-driven, fetching data only when a specific contract function is called. This makes pull models more gas-efficient for low-frequency data and essential for fetching unique, non-standard data (e.g., sports scores, weather, custom API calls).

06

Primary Use Cases

Pull orcles are the backbone for smart contracts that require external computation or infrequent, verifiable data. Common applications include:

  • Dynamic NFTs that change based on real-world events.
  • Parametric insurance payouts triggered by weather or flight data.
  • Verifiable Random Functions (VRF) for gaming and lotteries.
  • Cross-chain communication where data is requested from another blockchain.
examples
PULL ORACLE

Examples and Implementations

Pull oracles are implemented through various mechanisms and protocols, each designed to provide on-demand, verifiable data to smart contracts. Below are key examples and architectural patterns.

06

Basic Request-Reveal Pattern

A common implementation pattern for simple pull oracles involves a two-transaction request-reveal scheme:

  1. Request: A contract logs an event with a bounty, prompting off-chain actors to fetch data.
  2. Reveal: A responder submits the data in a subsequent transaction, claiming the bounty. This pattern is gas-efficient for non-time-sensitive data but introduces latency and requires trust in the responder's honesty, often mitigated with cryptographic commits or staking.
DATA DELIVERY ARCHITECTURE

Pull Oracle vs. Push Oracle

A comparison of the two fundamental models for how smart contracts receive external data from an oracle network.

FeaturePull Oracle (On-Demand)Push Oracle (Publish-Subscribe)

Data Delivery Trigger

Smart contract request (pull)

Oracle network broadcast (push)

Gas Cost Payer

End user / dApp (pays for request)

Oracle service / dApp (pays for updates)

Data Freshness

On-demand, at time of request

Pre-defined update interval (e.g., per block)

Latency

Higher (request + on-chain settlement)

Lower (data is pre-available on-chain)

Use Case Fit

Infrequent, user-initiated actions

Continuous, time-sensitive applications

On-Chain Footprint

Lower (no stored data between calls)

Higher (data stored in contract state)

Example Protocols

Chainlink Functions, API3 dAPIs

Chainlink Data Feeds, Pyth Network

advantages
PULL ORACLE ARCHITECTURE

Advantages of the Pull Model

The pull model, where dApps request data on-demand, offers distinct architectural benefits over push-based oracles. These advantages center on cost efficiency, security, and flexibility.

01

Cost Efficiency & Predictability

Users pay only for the data they consume, eliminating recurring subscription fees for unused updates. This creates predictable, transaction-based pricing where gas costs are borne by the end-user at the time of request. It is ideal for applications with low-frequency or unpredictable data needs, such as NFT rarity checks or settlement price verification.

02

Enhanced Security & Censorship Resistance

Data is fetched directly from the source at the moment of need, reducing the attack surface compared to a constantly updated on-chain data feed. There is no persistent, updatable value for an attacker to manipulate. The decentralized verification of the data's authenticity and timestamp happens within the user's transaction, making it resistant to front-running and data withholding attacks common in push models.

03

Freshness & On-Demand Data

Applications receive the most recent data available at the exact moment their transaction executes. This eliminates the staleness risk inherent in push oracles, which update on a fixed schedule. It is critical for use cases like options expiry pricing, liquidations, or real-time market orders where data must be current to the block.

04

Developer Flexibility & Composability

Developers can integrate multiple data sources and oracle networks within a single transaction, enabling data aggregation and fallback logic. The model supports complex, conditional data fetches (e.g., "get the price if it's below $X"). This composability makes it a foundational primitive for advanced DeFi products and meta-transactions.

05

Reduced On-Chain Bloat

Only the final, verified data point is written to the blockchain, not every intermediate update. This conserves block space and reduces the historical storage burden for node operators. It aligns with blockchain scalability principles by minimizing persistent state changes that aren't directly tied to application logic.

limitations-considerations
PULL ORACLE

Limitations and Considerations

While pull oracles offer a decentralized and gas-efficient design, their architecture introduces specific trade-offs and operational challenges that developers must account for.

01

Latency and User Experience

The on-demand nature of pull oracles introduces inherent latency. Users must wait for the data retrieval transaction to be mined, which can result in a poor experience for time-sensitive applications like trading. This contrasts with push oracles, which proactively update on-chain data.

  • Example: A user swapping tokens based on a price must submit two transactions: one to request the data and a second to execute the swap after the data is available.
02

Relayer Incentive & Reliability

The system's security depends on a competitive, permissionless network of relayers. If relay fees are too low, data requests may go unfulfilled, causing transactions to fail or time out. This creates a critical dependency on market economics rather than a guaranteed service level.

  • Sybil Resistance: While anyone can be a relayer, economic barriers to entry help prevent spam but may also reduce network redundancy in low-fee environments.
03

Data Freshness Guarantees

Pull oracles provide cryptographic proofs of data authenticity and timeliness (e.g., within a specified time window). However, the actual freshness is only as good as the most recent update committed by data providers. Applications must validate these timestamps and implement fallback logic for stale data.

  • Time-to-Live (TTL): Each data point has a TTL; using data past its expiry requires a new on-chain request, adding complexity.
04

Protocol Integration Complexity

Integrating a pull oracle shifts the burden of data fetching and verification to the application layer. Smart contracts must be explicitly designed to:

  • Emit events to signal data needs.
  • Handle callback functions to process the returned data and proofs.
  • Manage request IDs and potential failures. This increases development complexity compared to simply reading from a pre-populated storage contract.
05

Front-running and MEV Risks

The transparent nature of on-chain data requests creates Miner Extractable Value (MEV) opportunities. Observant bots can see a pending price request and front-run the subsequent transaction that uses that data, potentially to the user's detriment.

  • Mitigation: Techniques like commit-reveal schemes or using private mempools (e.g., via Flashbots) can reduce this risk but add further complexity.
06

Cost Predictability for Users

While gas-efficient overall, the total cost for an end-user is variable and unpredictable. It comprises:

  • Gas for the initial request transaction.
  • The relayer's service fee (paid in the transaction).
  • Gas for the callback execution. Users cannot know the total cost upfront, as relayer fees are set dynamically in a decentralized market.
security-considerations
PULL ORACLE

Security Considerations

A pull oracle is a decentralized oracle design where data is fetched on-demand by the consuming smart contract, shifting the gas cost and responsibility for data freshness to the contract owner or a designated relayer.

01

Data Freshness & Staleness Risk

The primary risk is stale data. Since data is pulled only when a transaction is initiated, the contract relies on the initiator to provide a recent, valid data point. Without robust checks, a contract could execute on outdated information. Mitigations include:

  • Implementing timestamp tolerance checks to reject data beyond a defined age.
  • Using a commit-reveal scheme where data is submitted and later verified.
02

Relayer Incentives & Centralization

Gas costs for pulling and submitting data are borne by a relayer. This creates incentive challenges:

  • If relayers are not compensated, the service may be unreliable.
  • Over-reliance on a single, altruistic relayer introduces a centralization point of failure.
  • Solutions involve fee mechanisms (e.g., charging a premium to the transaction sender) or decentralized relay networks with staking.
03

Data Authenticity & Source Verification

The contract must cryptographically verify that the provided data is genuine. Key mechanisms include:

  • Signature Verification: Checking that the data is signed by a trusted oracle node or committee.
  • Proof of Inclusion: Verifying a Merkle proof that the data point is part of a attested data root (e.g., using Merkle-Patricia Tries). Failure to implement these checks allows for data spoofing attacks.
04

Front-Running & MEV Vulnerabilities

The transparent nature of pull data in the mempool creates Maximal Extractable Value (MEV) opportunities. An attacker can:

  • Front-run a beneficial data submission with their own transaction.
  • Sandwich the data pull transaction if it triggers a trade.
  • Delay a transaction to exploit stale data. Using commit-reveal or threshold encryption can mitigate some of these risks.
05

Gas Cost & Economic Denial-of-Service

High gas costs for data retrieval can lead to economic denial-of-service (EDoS).

  • Expensive pulls may make contract functions prohibitively costly to call.
  • An attacker could spam the network to increase gas prices, preventing legitimate data pulls.
  • Contracts should be designed with gas-efficient verification and consider gas refunds or subsidies for relayers.
06

Canonical Data Source Risk

Even with perfect delivery, the security depends on the underlying data source. Risks include:

  • Source Manipulation: The primary API or data feed being compromised.
  • Sybil Attacks on decentralized source aggregation.
  • Oracle Node Collusion to provide incorrect signed data. A robust pull oracle design must consider the security and liveness of its primary data layer.
code-example
PULL ORACLE

Code Example Pattern

A practical guide to implementing the pull-based oracle pattern, where a smart contract explicitly requests off-chain data.

A Pull Oracle is a decentralized oracle design pattern where a smart contract's execution is paused until it explicitly requests and receives off-chain data from an oracle service. Unlike a Push Oracle, which automatically sends data to a contract, the pull model requires the contract to initiate a transaction to fetch the data it needs. This pattern is implemented using a two-step process: first, the contract emits an event or makes a call that signals its data need to oracle nodes, and second, a separate transaction from an oracle or a user delivers the data to fulfill the request. This approach gives the contract direct control over when data is updated.

The core mechanism relies on a callback function. A common implementation involves the request-and-receive cycle. The smart contract calls a function on an oracle contract (like Chainlink's Oracle or a custom solution), which logs an event containing the data request parameters. Off-chain oracle nodes monitor the blockchain for these events, fetch the required data from external sources, and then send a transaction back to the requesting contract, calling a predefined callback function (e.g., fulfillRequest) with the retrieved data. The contract's state is only updated upon successful verification of this callback.

Key technical considerations for developers include managing gas costs (the user or contract must pay for the final callback transaction), ensuring data authenticity through cryptographic signatures from oracle nodes, and handling request lifecycle with unique request IDs to match responses. Security is enhanced because the contract validates the data sender, but the pattern introduces latency due to the multi-transaction sequence. It is ideal for use cases where data updates are user-initiated or periodic, such as fetching a price for a decentralized exchange trade or retrieving a verifiable random number for an NFT mint.

A canonical example is a price feed consumer. A DeFi lending contract might need the latest ETH/USD price before processing a liquidation. It would call requestPriceData(), which emits a PriceRequested event. An oracle network fetches the price from multiple exchanges, aggregates it, and submits it via fulfillPriceRequest(requestId, price). The contract's fulfillPriceRequest function checks the sender's authorization and the request ID, then stores the new price and resumes the liquidation logic. This pattern decouples the data-fetching latency from the core contract logic.

When designing a system using this pattern, developers must account for oracle stalling—the risk that a response never arrives. Implementing timeouts and fallback oracles is critical. Furthermore, the pattern's gas overhead can be optimized by batching requests or using meta-transactions for the callback. While more complex to implement than a simple push oracle, the pull model offers superior flexibility and security for applications requiring on-demand, verifiable data from the real world.

PULL ORACLE

Frequently Asked Questions

Pull oracles are a foundational design pattern for fetching external data onto a blockchain. These questions address their core mechanisms, trade-offs, and real-world applications.

A pull oracle is a decentralized data feed where the on-chain data is updated only when a user-initiated transaction explicitly requests it. The core mechanism involves an off-chain data provider (or a network of them) that signs and stores price data or other information. When a smart contract, like a lending protocol, needs the latest price to process a loan liquidation, it calls an on-chain function. This function verifies the cryptographically signed data from the provider and updates the on-chain storage, making the fresh data available for the transaction. This model contrasts with push oracles, which broadcast updates automatically at regular intervals.

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
Pull Oracle: On-Chain Data Request Model | ChainScore Glossary