How does a blockchain know outside prices?
A smart contract cannot browse the internet to look up today's ETH price or an exchange rate. Yet a lending protocol needs prices to value collateral, and a derivatives contract needs a settlement price. The mechanism that brings this outside information onto the blockchain is called an oracle.
This guide explains how oracles deliver price data and how stale or distorted values affect loan liquidations, using hypothetical numbers. It also covers how users can check a service's price feeds and permissions, and how the service behaves when a feed fails.
How price data arrives
Ethereum.org's documentation describes oracles as services that fetch off-chain data and post it on-chain so smart contracts can read it. A common design has several data providers collect prices from multiple exchanges, compute a median or weighted average, and update the value at set intervals or when the price moves by more than a set percentage.
Some services use a DEX pool's own price as the oracle. That avoids outside providers, but if the pool is shallow, someone with enough capital can move its price for a moment and manipulate the oracle. Many services use a time-weighted average price (TWAP) to make this harder.
The effect of stale or distorted values
When an oracle value differs from the market, problems run both ways. If it updates late and stays too high, loans that should be liquidated remain open and bad debt can build up in the protocol. If manipulation or error briefly pushes it too low, healthy loans can be liquidated unfairly.
The BIS has noted that DeFi's reliance on external data providers such as oracles can itself become a concentrated point of risk. A protocol may be decentralized in name, but if it depends on a handful of providers for one price, that dependency is a weak link for the whole system.
A hypothetical liquidation threshold
Consider a hypothetical loan of 20,000 USDC backed by 10 ETH, with a liquidation threshold of 80%: the loan is liquidated when 80% of the collateral value falls below the debt. Under these terms, liquidation starts when ETH drops below 2,500 USDC.
| ETH price seen by the oracle | Collateral value | Value at 80% threshold | Health factor | Status |
|---|---|---|---|---|
| 3,000 | 30,000 | 24,000 | 1.20 | Safe |
| 2,600 | 26,000 | 20,800 | 1.04 | Close to liquidation |
| 2,500 | 25,000 | 20,000 | 1.00 | Liquidation line |
| 2,450 | 24,500 | 19,600 | 0.98 | Liquidatable |
Health factor = collateral value × liquidation threshold ÷ debt. If the market is at 2,450 but a stale oracle still shows 2,600, liquidation is delayed; if a momentary manipulation prints 2,450 while the market is at 2,600, a healthy loan can be liquidated.
Checking feeds and permissions
Protocols usually document which oracles they use. If you can see when a price feed last updated, its update conditions (time interval and deviation threshold), and how many data providers contribute, you have a better sense of the risk.
Who can change the oracle address matters as well. If a single admin can point a price feed at a different contract, that power is itself a risk. Check whether changes are subject to a timelock that gives users notice and whether they are controlled by a multisig.
Behavior when things go wrong
In fast markets or during network congestion, oracle updates can be delayed. Well-designed protocols may pause new borrowing or liquidations if a price has not updated for a set period, or compare several oracles and halt when they diverge sharply.
Without such safeguards, an oracle failure can translate directly into user losses. Safeguards that are too sensitive, on the other hand, can block withdrawals or repayments during ordinary volatility. Read the protocol's documentation on which functions stop and which continue in an emergency.
Before you use a price-dependent protocol
Work through these steps before using lending, derivatives, or other DeFi services that depend on prices.
- Find out which oracle each asset uses, an external provider or a DEX price, from the protocol's documentation.
- See whether you can check each feed's update conditions, last update time, and number of providers.
- Calculate your own liquidation price and keep a comfortable buffer from the current price.
- Check who can change oracle addresses and whether a timelock and multisig apply.
- Read the emergency procedures for stale or diverging prices.
Limits of oracle safeguards
An oracle ultimately imports off-chain information on trust, so it cannot be fully insulated from problems at data providers or source exchanges. Using several providers does not spread the risk much if they all draw on the same exchanges.
The loan example is hypothetical. When using a real protocol, check its documentation and the oracle's current status with their dates, and keep a generous gap between your liquidation price and the market price.
