Skip to main content
Important: We do not provide financial advice or custody funds. All transactions occur on third-party platforms.

Oracle

In simple terms

A blockchain cannot see the outside world, so an oracle feeds it information such as the current price of an asset. Contracts that liquidate positions or settle bets depend entirely on that feed being right.

Definition

A service that brings outside data, most often prices, onto a blockchain for contracts to use.

In depth

Contracts are deterministic and can only read on-chain state, so external data must be published on-chain by an oracle. Robust designs aggregate many independent sources and reporters, use medians rather than means to blunt outliers, and require a deviation or heartbeat threshold before updating. Weak designs read a single venue's spot price, which a well-capitalised actor can move momentarily — often with a flash loan — long enough for a dependent contract to act on it. Oracle manipulation is one of the most common root causes of large DeFi losses.

How does Oracle work?

Independent reporters observe a value off-chain, sign it, and submit it. The oracle contract aggregates the submissions and publishes a result other contracts read. Updates fire on a schedule or when the value moves past a threshold, so an on-chain price is always slightly stale — the tolerance for that staleness is a design decision, and setting it wrong is what liquidation cascades and stale-price exploits are made of.

An example

A lending protocol reads its collateral price from an oracle. If it read a single thin pool instead, an attacker could borrow a large sum via flash loan, push that pool's price up for one transaction, borrow far more than their collateral justifies, and leave the protocol with the bad debt.

Figures are illustrative only.

What beginners get wrong

  • Assuming on-chain prices are live. They update on thresholds and can lag a fast-moving market.
  • Overlooking the oracle when assessing a protocol. It is frequently the weakest component, and it is rarely mentioned in marketing.
  • Believing decentralised means unmanipulable. A decentralised oracle reading manipulable sources is still manipulable.

Related terms

Part of

What is DeFi, and how does decentralized finance work? — the subject page for defi, with all 18 of its definitions in one place.

Educational only — not financial advice.