Crypto Lexicon
Blockchain Oracles
A blockchain oracle writes off-chain prices on to a chain so smart contracts can read them. How price feeds work, push versus pull, and why oracles fail.
Why a Blockchain Cannot See a Price
A blockchain is very good at agreeing on its own history and completely incurious about everything else. It has to be. Every node must reach the same answer from the same data, so a contract cannot simply ring up an exchange and ask, because two nodes asking a second apart would get two different prices and the whole thing would fall over.
Outside data has to be written into a transaction first, where every node sees one identical value. That writing step is the oracle. It is also, quietly, the place where a trustless system starts depending on somebody in particular.
How an Oracle Feed Works
A feed is a record on chain holding a value and, just as importantly, a timestamp. Publishers gather prices from several venues, aggregate them, and post the result. The aggregation usually takes a median rather than an average, which limits how far one broken or manipulated venue can drag the number around.
A contract then reads the record, checks how old it is, and decides whether it is still safe to use. That timestamp does more work than the price does.
Push and Pull Designs
A push feed, the model Chainlink data feeds use, updates on a schedule or whenever the price moves past a threshold, and the network pays for updates nobody specifically asked for. A pull feed, the model Pyth uses, lets you attach a signed price to your own transaction for the contract to verify. Pull is cheaper and fresher. Push means the number is already sitting there at the exact moment a liquidator needs it, which is usually a bad moment to discover it is not.
How Oracle Failures Cause Losses
None of the usual failures involve breaking any cryptography. They are all variations on the feed confidently stating something that is no longer true.
The Three Failures That Recur
- A stale price. Updates stop arriving. A careful contract notices the old timestamp and refuses to act, which freezes borrowing and withdrawals. A careless one cheerfully keeps lending against yesterday's number.
- A manipulated price. An attacker shoves a thin market that the feed happens to read, borrows against the inflated collateral, and leaves the bad debt for everyone else. Which venues sit behind a feed matters far more than whose logo is on it.
- A publisher that leaves. Oracles are businesses, and businesses close. When one deprecates its service, every protocol reading it has to migrate before support ends, on a deadline set by the departing party rather than by anyone who needs it.
What to Check Before You Trust One
The practical rule: ask which oracle a protocol reads, how many independent publishers stand behind that feed, and what the contract does when a price goes stale. A protocol that can tell you its staleness threshold has thought about the problem. One that cannot say where its prices come from has outsourced the valuation of your collateral to a party it would rather not name.
Knowledge check
Three quick questions on this entry. Pick an answer to see whether it is right.
Question 1 of 3Which description matches a blockchain oracle?
Question 2 of 3Besides the price itself, what does an oracle feed carry that lets a contract protect itself?
Question 3 of 3Which of these also belongs to Blockchain Infrastructure?
Frequently asked question
What is Blockchain Oracles?
A blockchain oracle writes off-chain prices on to a chain so smart contracts can read them. How price feeds work, push versus pull, and why oracles fail.