DeFi Fundamentals
Oracle
A service that delivers external real-world data, such as asset prices, to smart contracts on a blockchain.
A data stream delivered by oracles that provides real-time asset prices to on-chain smart contracts.
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.
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.
Once aggregated, the price is published to an on-chain smart contract that any protocol can read. There are two common delivery models:
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.
Price feeds are arguably the most security-critical component in any lending protocol. They serve multiple essential functions:
Inaccurate or manipulated price feeds have been at the center of some of the most damaging DeFi exploits in history. Common attack vectors include:
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.
The oracle landscape has matured significantly, with several major providers serving different needs:
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
DeFi Fundamentals
A service that delivers external real-world data, such as asset prices, to smart contracts on a blockchain.
Risk & Security
Oracle manipulation is an attack that distorts external price feeds to exploit DeFi protocols relying on inaccurate asset valuations.
Lending & Borrowing
The forced sale of a borrower's collateral by a lending protocol when the position falls below the required collateralization threshold.
Lending & Borrowing
Health factor is a numeric score that indicates how close a DeFi lending position is to being liquidated.