Glossary
What Is a Blockchain Oracle? How Smart Contracts Get Outside Data
Definition
Oracle: An oracle is a service that delivers data from outside a blockchain, such as asset prices or exchange rates, to smart contracts that can't fetch it themselves.
On this page
A blockchain oracle is a service that brings information from the outside world, such as the dollar price of ETH or a euro exchange rate, onto a blockchain so that smart contracts can use it. Blockchains can’t look things up on the internet by themselves, so lending apps, stablecoins and on-chain payment tools all depend on oracles for prices. If the oracle is wrong, everything that trusts it can be wrong too.
Why blockchains need them
A smart contract runs identically on thousands of nodes. To agree on the result, every node must use exactly the same inputs. A web request could return different answers on different nodes, so contracts are limited to data already on-chain. ethereum.org calls this the “oracle problem”: getting off-chain data in without giving one party the power to feed false information.
How a price feed typically works
- Independent node operators collect prices from several exchanges and data providers.
- Each operator submits a value; the oracle network aggregates them, for example by taking the median.
- The aggregated price is written on-chain when it moves by more than a set threshold or after a set time.
- Smart contracts read the latest value from the oracle’s contract.
Chainlink, one widely used provider, documents deviation thresholds and heartbeat intervals for each feed in its data feeds documentation.
Types of oracle
| Type | Data it provides | Example use | Main risk |
|---|---|---|---|
| Price feed | Crypto and fiat prices | Lending collateral, stablecoin minting | Manipulation or stale prices |
| Exchange-rate feed | Currency pairs like EUR/USD | Euro stablecoins, cross-currency payments | Gaps outside market hours |
| Proof-of-reserve feed | Off-chain asset balances | Checking backing of wrapped tokens and stablecoins | Depends on custodian honesty |
| Randomness | Verifiable random numbers | Games, lotteries | Bias if poorly designed |
| Event / API data | Weather, sports results, delivery status | Insurance, prediction markets | Single data source |
| Cross-chain messaging | State of another chain | Bridges | Large exploits if compromised |
Why it matters to people who spend crypto
You may never call an oracle directly, but they shape the money you spend:
- Stablecoins. Collateral-backed stablecoins such as DAI use oracle prices to decide when to liquidate collateral. A bad price can trigger unfair liquidations or, worse, undercollateralisation; see depeg.
- On-chain swaps. Some DEX routes and payment apps check oracle prices to protect you from bad quotes.
- Self-custody cards. Cards that let you spend against crypto collateral, for example via DeFi positions, depend on accurate valuations to set your limit.
- Bridged tokens. Moving stablecoins between networks often relies on oracle-like message services. Bridge failures have frozen or devalued bridged assets.
How oracles fail
- Manipulated sources. Reading a price from one thin liquidity pool lets an attacker distort it cheaply, often with a flash loan.
- Stale data. During network congestion or extreme volatility, updates may lag.
- Centralised control. If one company or key can post prices, compromising it compromises every user.
- Bad configuration. A protocol reading the wrong feed or decimals can misprice assets by orders of magnitude.
Most large oracle-related losses involved protocols trusting a weak price source rather than a flaw in an established oracle network.
Checklist when a service depends on an oracle
- Which oracle provider does it use, and is that documented?
- Does the feed aggregate several sources?
- Is there a circuit breaker for extreme price moves?
- Has the integration been audited?
- Do you keep spending funds in plain stablecoins rather than leveraged positions?
For the bigger picture, read about DeFi, the stablecoin depeg risk guide and stablecoins for spending.
Frequently asked questions
Why can't a smart contract just check a website for the price?
What is an oracle attack?
Do crypto cards use oracles?
Who runs oracles?
Sources
Facts were checked against these pages on the date shown above. Terms change; confirm on the official page before acting. General information, not financial, tax or legal advice. See our methodology.