Blockchain oracle: how outside prices reach smart contracts

A blockchain oracle is a service that brings outside information, usually asset prices, onto a blockchain so smart contracts can act on it; lending markets and crypto-backed stablecoins depend on these feeds, so a wrong or manipulated price can cause real losses.

By Sonic Wallet Editorial Team· Updated · 6 min read

Key takeaways

  • A blockchain oracle carries outside facts, mostly prices, onto a chain. Smart contracts cannot fetch them directly, because every node replays every transaction and must reach the identical result, so an oracle posts the data as an ordinary transaction and every node then reads the same stored value. Lending and stablecoin contracts treat that value as the truth.
  • Push feeds update on a price move or a timer, whichever comes first. Chainlink's ETH/USD feed on Ethereum uses 0.5% or one hour; in the 24 hours to 05:52 UTC on November 2, 2026, it wrote 27 prices, 5 of them early because ether had moved more than 0.5%.
  • Most oracle exploits move the market an oracle reads rather than breaking the oracle. In April 2022 an attacker pumped the thin INV/ETH pool behind Inverse Finance's price feed, which averaged about 15 seconds of trading instead of 30 minutes, and borrowed $15.6 million against the inflated tokens.
  • Designs trade freshness against safety. Sky holds each new collateral price for one hour before its stablecoin system uses it, leaving time to freeze a bad value, while pull oracles such as Pyth let an app bring a freshly signed price into the very transaction that uses it.

A blockchain oracle is a service that delivers information from outside a blockchain, most often an asset price, in a form smart contracts can read. A lending app on Ethereum has no way to see what ether trades for on exchanges; the number has to be written on chain, and an oracle is whatever does the writing, whether a network of independent operators, a single company or a contract that reads prices from an exchange pool. Whoever controls that number controls what the contract does next. The crypto hub covers the wider market, and what is DeFi shows the lending and trading apps that consume most oracle data.

Why can't a smart contract look up a price itself?

Because every node re-runs every transaction and must reach an identical result, while a website could answer each node differently, change between calls or go offline.

Blockchains get their reliability from that determinism; Ethereum's developer documentation notes that nodes reach agreement using only data already stored on the chain. An oracle closes the gap by posting the outside answer as an ordinary transaction; from then on every node sees the same stored value. Prices are the main product, but oracle networks also publish interest rates, the reserves behind tokens and the results of real-world events such as elections. The contracts on the receiving end are explained in what is Ethereum, and proof of reserves covers one of the non-price uses.

How does a blockchain oracle get a price on chain?

Most designs gather quotes from several sources off chain, combine them and write the result to a contract on a timer, after a price move or on demand.

DesignHow the price arrivesMain weaknessExample
Push networkIndependent operators fetch prices; their reports are combined and written on chain when the price moves past a threshold or a timer runs outThe stored price trails the market between updatesChainlink Data Feeds
Pull oraclePrices are aggregated and signed off the target chain, and an app submits the latest one in the same transaction that uses itSomeone must fetch and pay for each update, or the on-chain price goes stalePyth, which aggregates its publishers' prices every 400 milliseconds
Exchange averageA contract reads a time-weighted average price (TWAP) from a decentralized exchange poolA pool with little liquidity can be pushed with modest capitalUniswap's built-in oracle
Optimistic oracleAnyone proposes an answer with a bond; it stands unless disputed within a challenge period, and disputes go to a vote of token stakersA disputed answer waits at least two days for the voteUMA
Delayed feedA new price takes effect only after a fixed delayThe system always acts on a price an hour oldSky's Oracle Security Module

Scale differs enormously. On November 2, 2026, DefiLlama counted about $34.0 billion of deposits in 540 protocols relying on Chainlink, against $91 million in 90 protocols pricing assets from exchange-pool averages. That measure, total value secured, is explained under total value locked.

Chainlink's documentation says each feed is updated by multiple independent operators, and that a new round starts on whichever comes first: a deviation threshold, meaning the off-chain price has moved more than a set percentage from the stored one, or a heartbeat, a maximum time since the last update. On Ethereum, the ETH/USD and BTC/USD feeds use 0.5% or one hour, and the USDC/USD and USDT/USD feeds use 0.25% or 24 hours.

Worked example: Chainlink's ETH/USD feed on November 2, 2026

  • Latest stored price: $2,290.73 at 05:52:35 UTC, the figure any contract reading the feed would receive.
  • Next trigger: an off-chain price below about $2,279.28 or above $2,302.18, which is 0.5% either way, or 06:52:35 UTC, whichever comes first.
  • The previous 24 hours: 27 prices written. Of the 26 gaps between them, 21 lasted about an hour, the heartbeat, and 5 were cut short, at 11 to 54 minutes, after moves of 0.5% to 0.6%.
  • The takeaway: between updates, a contract acts on a price that can trail exchanges by up to about 0.5%.

The market itself moves continuously, as the live ether price page shows; the feed only samples it.

Why do lending apps and stablecoins depend on oracles?

Because the oracle price decides how much can be borrowed against collateral, when a loan is liquidated and whether a crypto-backed stablecoin is still fully backed.

A lending protocol values each deposit at the oracle price and liquidates loans whose collateral falls below a set ratio; the DeFi guide works through that arithmetic step by step. A price that reads too high lets borrowers take out more than their collateral is worth, leaving the protocol with bad debt, and one that reads too low liquidates loans that were sound.

Crypto-backed stablecoins carry the same exposure. Sky, the protocol formerly called MakerDAO that issues USDS and DAI, values vault collateral such as ETH through its Oracle Security Module, which holds each new price for one hour before the system uses it. Sky says the delay lets vault owners add collateral or repay debt before a lower price takes effect, and lets its price provider, Chronicle, freeze a malicious value before it goes live. Coins backed by cash and Treasury bills rely on a different kind of evidence, reports on their reserves, as how stablecoins work explains. If one of those coins slips below a dollar, a stablecoin depeg, a market-price feed reports the drop to every lending app that reads it, and loans backed by the coin can be liquidated.

How does an oracle manipulation attack work?

The attacker usually leaves the oracle alone and moves the market it reads, then borrows against the inflated price before arbitrage drags it back.

Exchange-pool oracles defend themselves by averaging over time, so a brief spike counts only in proportion to how long it lasted:

TWAP = sum of (price × seconds at that price) ÷ seconds in the averaging window

Worked example: Why the averaging window decides the damage

  • Setup: a token trades at $10, and an attacker lifts it to $50 for one 12-second Ethereum block before arbitrage pulls it back.
  • 30-minute window: (10 × 1,788 + 50 × 12) ÷ 1,800 = $10.27, only 2.7% above the real price.
  • 15-second window: (10 × 3 + 50 × 12) ÷ 15 = $42, more than four times the real price.
  • The prices are illustrative; the two window lengths are the ones in the Inverse Finance case below.

A window that short is what went wrong on April 2, 2022. Inverse Finance's Anchor lending market, since renamed Frontier, priced its INV token with a Keep3r TWAP oracle that read the INV/WETH pool on SushiSwap. According to CertiK's analysis, the pool held about 432 INV and 46 ETH; the attacker spent 300 ETH buying 374 INV, lifting the pool's INV price more than 50-fold, and a flaw in the oracle's sampling meant its intended 30-minute average covered only 15 seconds. Posting INV as collateral at the inflated price, the attacker borrowed 1,588 ETH, 94 WBTC, 39 YFI and about 4 million DOLA, worth $15.6 million in total, according to Inverse Finance. Its post-mortem says no flash loan was involved; the attacker began by withdrawing 901 ETH from the Tornado Cash mixer.

Defenses follow from the same arithmetic: longer averaging windows, prices drawn from many venues rather than one pool, delays such as Sky's hour, tight borrowing limits on thinly traded collateral, and checks on the uncertainty band Pyth publishes with every price, which Pyth says contracts can use to operate more safely. The DeFi guide's table of exploits adds the Mango Markets case from October 2022.

How is an oracle different from a bridge, an API or proof of reserves?

An oracle reports facts to a chain; the others move assets between chains, serve data to ordinary software or prove holdings, and some of them use oracles.

TermWhat it doesHow it relates to an oracle
APIServes data to ordinary software off chainOracle operators often read APIs, but a contract cannot call one
Cross-chain bridgeMoves tokens or messages between blockchainsNeeds its own operators to vouch for events on another chain, a similar trust problem
Proof of reservesShows that a custodian or token issuer holds the assets it claimsResults can be published on chain through an oracle feed
Price feedOne stream of prices, such as ETH/USDA single product an oracle network runs
Smart contractCode on the chain that acts on dataThe consumer of oracle data, and the party harmed when it is wrong

The code on the receiving end of every feed is covered under smart contract.

Frequently asked questions

Is Chainlink the same thing as a blockchain oracle?+

No. Chainlink is one oracle network among several; Pyth, Chronicle, RedStone and UMA are others, and some protocols price assets internally from their own markets rather than using an outside oracle at all.

Was the Inverse Finance exploit a flash loan attack?+

No. Inverse Finance's post-mortem says no flash loan was used; the attacker started by withdrawing 901 ETH from the Tornado Cash mixer. Flash loans, borrowed and repaid within one transaction, can fund the same trick, which is why averaging prices over many blocks matters.

Why might a stablecoin price feed update only once a day?+

Push feeds write a new price when the market moves past a threshold or a timer runs out. Chainlink's USDC/USD feed on Ethereum uses a 0.25% move or 24 hours, so while the coin holds near one dollar, a day can pass between updates.

Do oracles matter for someone who only holds bitcoin or ether?+

Not directly, since keeping coins in a wallet involves no oracle. They matter once coins go into smart contracts such as lending markets, derivatives or crypto-backed stablecoins, where a wrong price can trigger a liquidation.

Can an oracle report a wrong price without being attacked?+

Yes. A feed can trail a fast market between updates, a data source can glitch, and a pull-based price goes stale when nobody submits a fresh one, which is why well-built contracts check a price's timestamp before acting on it.

Sources

  1. Oracles, ethereum.org
  2. Data Feeds architecture: decentralized data model, Chainlink
  3. Price feed contract addresses: Ethereum mainnet, Chainlink
  4. Chainlink ETH/USD price feed proxy contract, Etherscan
  5. Everything you need to know about the Pyth Network, Pyth Network
  6. How does UMA's oracle work?, UMA
  7. Uniswap v3 oracle, Uniswap Labs
  8. OSM (Oracle Security Module), Sky Protocol
  9. Security mechanisms, Sky Protocol
  10. INV price manipulation incident, Inverse Finance
  11. Frontier (Anchor): legacy products, Inverse Finance
  12. Inverse Finance incident analysis, April 2, 2022, CertiK
  13. Oracle rankings by total value secured, DefiLlama

Related guides