Oracle
An oracle provides external real-world data, such as price feeds, to smart contracts on a blockchain, bridging on-chain and off-chain worlds.
What Is an Oracle?
An oracle is a service that brings outside data onto a blockchain so smart contracts can use it. A contract can read only what is on its own chain; it cannot look up the dollar price of ETH, a sports result or the weather. An oracle publishes that data in a transaction, and contracts read it.
Price oracles are the most used kind. Lending protocols need them to value collateral and decide when to liquidate; derivatives and stablecoins need them to settle. Decentralized oracle networks such as Chainlink have several independent operators report a value from multiple sources and publish an aggregate, typically the median, so one faulty source or operator does not move the result. Other oracles deliver verifiable randomness or the outcome of real-world events.
The oracle is a point of trust in an otherwise automatic system. If the reported price is wrong, stale or manipulated, the contract acts on it anyway. A known attack inflates the price on a thinly traded exchange that a protocol uses as its source, often with a flash loan, and then borrows against the overvalued collateral.
A wallet sees none of this. A hardware wallet shows and signs the user's own transaction; whether the protocol behind it reads sound prices is a separate question, and part of judging a protocol before depositing.
Real-World Examples
Example 1: A user borrows stablecoins against ETH in a lending protocol. When the oracle reports that ETH has fallen below the liquidation threshold, anyone can liquidate the position, even if the dip lasted only minutes.
Example 2: An attacker pushes up the price of a small token on one decentralized exchange. A lending protocol that uses that exchange as its only price source accepts the token as valuable collateral, and the attacker borrows against it and leaves with other users' deposits.
Example 3: A lottery contract requests a random number from a randomness oracle and receives it together with a proof that the operator could not choose the result.
Frequently Asked Questions
Why is a price oracle a risk for DeFi users?
The oracle is a point of trust in an otherwise automatic system. If the reported price is wrong, stale or manipulated, the contract acts on it anyway. In a lending protocol, a price that dips below the liquidation threshold lets anyone liquidate a position, even if the dip lasted only minutes.
How do decentralized oracle networks make prices harder to manipulate?
Several independent operators report a value from multiple sources, and the network publishes an aggregate, typically the median, so one faulty source or operator does not move the result. A protocol that uses a single thinly traded exchange as its only price source is easier to attack: the price is pushed up there, often with a flash loan, and the attacker borrows against the overvalued collateral.
Does my hardware wallet protect me from a faulty oracle?
No. A hardware wallet shows and signs your own transaction; whether the protocol behind it reads sound prices is a separate question. Looking at where a protocol gets its prices, and whether it relies on a single source, is part of judging that protocol before depositing.
Sources
Ready to Choose a Secure Wallet?
Use our tools to find the right hardware wallet for your needs.