Price Feed

A data stream delivered by oracles that provides real-time asset prices to on-chain smart contracts.

What Is a Price Feed?

A price feed is a data stream that delivers real-time or near-real-time asset prices to smart contracts on a blockchain. Because smart contracts cannot natively access off-chain data like market prices, price feeds serve as the critical bridge between external financial markets and on-chain applications. In DeFi, they are typically delivered by oracles -- specialized infrastructure that aggregates price data from multiple exchanges and data providers.

Without accurate, tamper-resistant price feeds, lending protocols could not calculate collateral values, decentralized exchanges could not settle trades fairly, and derivatives platforms could not mark positions to market. Price feeds are, in many ways, the nervous system of decentralized finance.

How Price Feeds Work

Data Aggregation

A reliable price feed does not rely on a single source. Instead, oracle networks collect price quotes from dozens of exchanges -- both centralized and decentralized -- and compute an aggregate value. This typically involves taking a volume-weighted average or a median across all sources. By pulling from many independent markets, the feed becomes resistant to manipulation on any single venue.

On-Chain Delivery

Once aggregated, the price is published to an on-chain smart contract that any protocol can read. There are two common delivery models:

  • Push-based feeds update at regular intervals (e.g., every heartbeat period) or whenever the price deviates beyond a threshold (e.g., 0.5% change). Chainlink Data Feeds are the most widely used example of this model.
  • Pull-based feeds store prices off-chain and require the consuming protocol (or user) to fetch and submit the latest price on-chain at the time of the transaction. Pyth Network uses this approach, which can reduce gas costs but shifts the responsibility for freshness to the caller.

Staleness and Freshness Checks

Every price feed includes a timestamp indicating when the data was last updated. Protocols implement staleness checks that reject prices older than a defined threshold. If a feed goes stale -- due to oracle downtime, network congestion, or a lack of price movement triggering updates -- the protocol may pause certain operations to prevent decisions based on outdated information.

Role in Lending Protocols

Price feeds are arguably the most security-critical component in any lending protocol. They serve multiple essential functions:

  • Collateral valuation: Every time a user deposits collateral or opens a loan, the protocol queries the price feed to determine the dollar value of the deposited assets and calculate borrowing capacity.
  • Health factor monitoring: Protocols continuously check the ratio of collateral value to debt. When the price feed reports a decline in collateral value that pushes the health factor below the liquidation threshold, the position becomes eligible for liquidation.
  • Liquidation execution: Liquidators rely on accurate price feeds to determine whether liquidating a position is profitable. An incorrect feed could cause premature liquidations (harming borrowers) or delayed liquidations (creating bad debt for lenders).

Price Feed Manipulation and Security

Inaccurate or manipulated price feeds have been at the center of some of the most damaging DeFi exploits in history. Common attack vectors include:

  • Oracle manipulation: An attacker temporarily inflates the price of a low-liquidity token on a single DEX, causing the oracle to report an artificially high price. They then use this inflated valuation to borrow far more than the collateral is actually worth.
  • Flash loan-assisted attacks: Attackers use flash loans to move prices on the exchanges that feed an oracle, exploit the mispricing in a lending protocol, and repay the flash loan -- all within a single transaction.
  • Stale price exploitation: If a feed stops updating during volatile conditions, attackers can exploit the gap between the reported price and the actual market price.

To defend against these threats, modern oracle networks employ multiple safeguards: minimum number of independent reporters, outlier detection, circuit breakers that halt feeds during extreme volatility, and time-weighted average pricing (TWAP) that smooths out short-term manipulation attempts.

Types of Price Feed Providers

The oracle landscape has matured significantly, with several major providers serving different needs:

  • Chainlink is the dominant push-based oracle, securing hundreds of billions in DeFi value across multiple chains
  • Pyth Network specializes in high-frequency, low-latency feeds popular with derivatives and perps protocols
  • Uniswap TWAP oracles derive prices from on-chain DEX trading activity, offering fully decentralized but potentially less responsive feeds
  • Chronicle (formerly Maker Oracles) provides feeds optimized for lending and stablecoin protocols

Why Price Feed Quality Matters for Borrowers

For anyone borrowing against crypto collateral, the quality of the price feed directly affects your experience. A well-maintained feed with tight deviation thresholds means your position's health factor accurately reflects reality, and liquidations happen at fair market prices. A poorly maintained or easily manipulated feed could trigger unnecessary liquidations or, conversely, allow the protocol to accumulate bad debt that eventually impacts all depositors. When evaluating a lending protocol, checking which oracle provider it uses and how it handles price feed edge cases is a fundamental part of due diligence.

Related Terms