DeFi
What a blockchain oracle is, and how price feeds fail
A blockchain oracle is whatever carries information from outside a chain into a smart contract, most often a price. Lending markets, perpetual futures and synthetic assets all value one token in terms of another, so they all depend on one, and the oracle is often where the protocol’s security really sits: a contract can run exactly as written and still pay out against a wrong number. The common designs differ in who reports the price, how many sources they combine and when the figure is written on-chain, and each fails in its own way.
Why a contract cannot look up a price
A blockchain is a record that many independent computers must agree on, and they can only agree on what they can all check. Ethereum.org’s page on oracles puts it in terms of determinism. Nodes reach consensus on questions answerable from data already on the chain, such as whether a signature is valid or an account has enough funds. If each node fetched an exchange rate from a website, they would get different answers at different moments and could not agree on the result. So the data has to be written to the chain first, by someone, in a transaction, and a contract then reads it like any other stored value.
That someone is the oracle, and ethereum.org calls the resulting difficulty the oracle problem. A contract that trusts an outside reporter has reintroduced exactly the trust it was built to avoid. The page judges oracles on three counts. Correctness means the data came from the right source and was not altered on the way. Availability means it arrives when needed. Incentive compatibility means a reporter can be identified and rewarded or penalised for what it reports.
DefiLlama’s method for measuring oracles reduces the stakes to one question: if the oracle malfunctions, would assets be lost? It credits an oracle with the deposits of every protocol that would lose funds if it failed, and counts a protocol in full against each oracle it uses where a failure of any one could drain it. Its own example is Euler, which uses Chainlink for some assets and Uniswap v3 averages for others. For a lending market the answer is almost always yes, because the price feed decides who gets liquidated and how much anyone may borrow.
Prices are the common case, not the only one. Lido’s staked-ether balances change when its oracle daemons report the validators’ balance, as what liquid staking is describes, and a bridge depends on somebody attesting that an event happened on another chain, which is why bridge hacks are so often failures of that attestation.
Feeds that are pushed on-chain
In the first design, a network of independent operators fetches prices off-chain, combines them and writes the result to a contract anyone can read. In Chainlink’s description of its data feeds, each feed is updated by multiple independent node operators, an aggregator contract has to receive responses from a minimum number of them before its answer changes, and a new round starts on one of two triggers. One is a deviation threshold, when a node sees the off-chain price move further than a set limit from the value on-chain. The other is a heartbeat, a maximum time between updates.
The consequence is easy to miss. A pushed feed is not a stream. Between triggers the stored answer stays where it was, and Chainlink’s data feeds overview says some heartbeats are configured to last several hours. A contract reading the feed gets the answer together with the time it was last updated, and the documentation tells developers to check that timestamp and to pause, or switch to another mode, when the answer is older than their application can accept. It also notes that the minimum and maximum values built into the aggregator are no longer used on most feeds and do not stop an application reading the latest answer, so any bounds have to be the application’s own.
The feed is itself a contract with an owner. The same overview says its proxy and aggregator contracts all have an owner address with permission to change variables and functions, a multisig in the BTC/USD example it gives, and that updates can replace the aggregator behind a proxy altogether. And responsibility for thin markets sits with the user. Chainlink’s developer responsibilities page names spoofing, wash trading, front-running and other manipulation as risks to an asset’s price that its operators cannot control, says low-liquidity assets are the most exposed, and makes developers solely responsible for accounting for them.
Two specialised types show the design adapting. A bounded feed for a stablecoin caps the reported price at a preset maximum, with $1.05 given as the example, and has no lower bound, so a premium above the cap goes unreported and a fall does not. An exchange rate feed reports the internal redemption rate of a token such as a liquid staking token, read from the issuing protocol’s own contract rather than from markets, according to Chainlink’s guide to selecting feeds. Both are choices about which number counts. A capped feed will not follow a stablecoin above its cap, and an exchange-rate feed reports what a token redeems for in its own protocol, not what it fetches on a market. Those two figures can come apart, as they did for the coins in stablecoin depegs, and a protocol using either feed has decided in advance which one it will believe.
Averages read from a pool
The second design takes the price from a decentralised exchange, which needs no outside reporter because the pool’s price is already on-chain. Read naively it is also the weakest, since an AMM’s price moves with every trade, and a large enough trade, paid for with borrowed money, can move it inside a single transaction. Uniswap’s own v2 whitepaper made that point about its earlier design, as the MEV piece recounts.
The answer is to average over time. A Uniswap v3 pool keeps an array of observations, and its documentation says anyone willing to pay the gas can extend it to as many as 65,535 entries, around nine days of history or more. A contract can then read a time-weighted average over any window that history covers. The pool accumulates its price tick over time, and the documentation notes that averaging ticks gives a geometric mean of the price. It also says the length of the record makes manipulation significantly harder.
The cost is lag. Uniswap’s v2 whitepaper states the trade-off: a longer period makes the average more expensive to manipulate but leaves the price less up to date. A thirty-minute average moves only as fast as thirty minutes of prices let it. That is the protection against a trade that lasts one block, and also the weakness when the market itself moves fast, because the average can trail well behind the real price. A lending market deciding whether a position can still be liquidated in time is the user most exposed to that gap. And a thin pool remains cheap to push even over a long window.
Pull oracles: the user brings the price
A third design, used by Pyth, turns delivery around. Instead of operators writing every update on-chain whether anyone needs it or not, prices are signed off-chain and the user’s own transaction carries one in. Pyth’s quick-start for Pyth Core describes three steps, done in a single transaction: fetch a signed price from its off-chain service, submit it to the Pyth contract for verification, and read the verified result. The contracts are permissionless, and anyone can push an update. Pyth’s core contracts, the ones lending markets typically use, then store the verified price for any contract to read until a newer update replaces it, so a stored Pyth price can go stale like any other.
What a signature vouches for changed in 2026. Pyth says its core contracts were upgraded on 26 August 2026 to take prices from the system behind its Pyth Pro service, in which five routers each compute and sign price aggregates, and an update is accepted when at least three of the five signatures verify. Each router takes the median of its publishers’ prices and a confidence interval from their spread. The Pyth Core quick-start puts the publishers at more than 120 first-party sources, including major exchanges, trading firms and market makers.
The confidence interval is the distinctive part. Pyth’s best-practice guide explains it by noting that an asset trades at different prices on different venues at the same moment, and suggests that a protocol pause new activity when the interval grows too wide relative to the price. The same guide names the weakness that comes with letting users bring the price. For contracts that verify signed updates, the person submitting a transaction chooses which update to include, and can pick any one that passes the contract’s checks. The guide likens this to seeing the future price before using a past one, and says a staleness check, a limit on how old an accepted price may be, is the simplest defence.
Perpetual futures venues add a layer of their own, an index price taken from outside the venue and a mark price that blends it with the venue’s own book, as perpetual futures explained sets out.
How oracles fail
The failures fall into a handful of patterns, and the documented cases show each of them.
The best known is a source that can be moved. At Mango Markets, according to the court’s opinion of May 2025, the oracle for MNGO perpetual futures averaged the token’s spot price on three exchanges, FTX, AscendEX and Serum. Someone holding both the long and the short side of the same contracts bought MNGO on all three, which raised the oracle price and the value of the long position, and borrowed against it; minutes later he sold on the same venues, the price fell, the short position gained, and he borrowed again. The oracle did what it was built to do; the prices it averaged were the ones being moved. The incident page sets out the charges and how the case has gone since.
A degraded source can do the same damage with nobody pushing it. On 25 June 2019, Synthetix said, one of the commercial data services behind its foreign-exchange prices began intermittently reporting the Korean won at a thousand times its real rate. Its oracle was meant to discard outliers, but an earlier outage, which its monitoring had not caught, had left the won feed served by only two sources, so the oracle averaged the two and passed the error on. A trading bot traded into and out of the synthetic won and, by Synthetix’s account, made over $1b of profit in less than an hour before the oracle service was stopped. The bot’s owner agreed to reverse the trades in exchange for a bug bounty. DefiLlama’s record files the incident under Oracle Manipulation, with the technique Oracle Misconfiguration and an amount of $0.
Then there is the price that is correct and old. A feed that has not updated, or a contract that never checks the timestamp, lets a borrower or liquidator act on a stale figure. And there is the value that is correctly computed from something an attacker controls. At CREAM in October 2021, Immunefi’s analysis shows the protocol valuing a vault token by its price per share. Sending tokens straight to the vault doubled the assets behind each share, which raised that price, and the attacker borrowed against the inflated collateral. Whether that counts as oracle manipulation at all was disputed at the time: the researcher Mudit Gupta argued, as The Register reported, that CREAM’s pricing stayed correct throughout and the attack was market manipulation.
Infrastructure fails too. On a rollup the sequencer can stop, and Chainlink offers uptime feeds so that contracts can detect the outage and allow a grace period before mass liquidations, because users able to reach the rollup’s contracts through Ethereum directly would otherwise have an unfair advantage over everyone else, as the page puts it. Chainlink now says it is no longer adding those feeds to new networks. Layer 2 explained describes what a sequencer does.
The Oracle Manipulation class in the hacks record
As of 22 November 2026, per DefiLlama, the hacks record files 162 incidents under Oracle Manipulation, totalling $894.1M. That makes it fifth of the 13 classes by count and seventh by value, leaving aside the one incident with no class recorded. The typical case is small, with a median of $800K (computed). Nearly all of the value carries one technique, Spot Price Manipulation: 134 incidents, $835.1M. The rest are Oracle Misconfiguration (18 incidents, $26.9M), Stale Oracle Price (8, $31.6M), Predictable Oracle Update (one, $401K) and one with no technique recorded ($4K).
The three largest rows, CREAM Lending ($130.0M), Mango Markets V3 ($115.0M) and Venus Protocol ($100.0M), hold 38.6% of the class’s value between them (computed). Their written accounts show how loosely the label fits. Mango’s oracle was moved by buying on the venues it read. At CREAM, whether an oracle was manipulated was the question in dispute. The Venus account finds that the sources it cites do not establish the 2021 price spike was engineered at all. The class is DefiLlama’s label on a row, not a finding about the oracle, and how crypto gets hacked sets out what else the record leaves unstated.
What to check about a protocol’s oracle
Most of this can be read in a protocol’s documentation, and the rest in its contracts.
- Which oracle prices each asset, and whether it differs between chains. DefiLlama’s method above assigns oracles chain by chain for that reason.
- What kind of price it is: an aggregated feed, a pool average over a stated window, or a spot price from a single pool, which is the warning sign.
- Whether the contract rejects a price older than some limit, and what it does instead, whether that is to pause, fall back to a second source or carry on.
- Who can change the feed or its parameters, and whether a delay applies.
- How deep the markets are for any collateral the protocol accepts, since no oracle design makes a thin market hard to move.
- Whether the oracle was inside the scope of the protocol’s audits. Trail of Bits’ review of Aave V4, for one, assumed the Chainlink feeds reported a correct price, as what an audit checks describes.
None of the answers is a guarantee. They show where a protocol has decided to trust someone, and how much it would cost to be wrong.