πŸš€ Premium Banner Placement β€” Reach 100K+ daily crypto readersAdvertise with us β†’
LIVE
BTCβ€”ETHβ€”SOLβ€”BNBβ€”XRPβ€”ADAβ€”AVAXβ€”DOGEβ€”LINKβ€”DOTβ€”MATICβ€”ATOMβ€”LTCβ€”TRXβ€”TONβ€”BTCβ€”ETHβ€”SOLβ€”BNBβ€”XRPβ€”ADAβ€”AVAXβ€”DOGEβ€”LINKβ€”DOTβ€”MATICβ€”ATOMβ€”LTCβ€”TRXβ€”TONβ€”
β€”β–²0.0%
DeFi

What Is a Blockchain Oracle?

4 min readGuide
What Is a Blockchain Oracle?

A blockchain oracle is a service that feeds outside information into a smart contract: a price, a score, a temperature. Blockchains are sealed off from the internet by design, so a contract cannot look anything up on its own. The oracle is the messenger that carries the outside world in, and Chainlink is the one most of DeFi relies on.

Why can't a blockchain just look up the price itself?

Because every node has to reach the same answer. If a contract called a website for the price of ether, thousands of nodes would call it at slightly different moments, get slightly different numbers, and disagree about what happened, when never disagreeing is the entire point of the network. So outside data has to arrive the way everything else does: as a transaction, written into the chain once and read by everyone afterwards.

How does an oracle work?

Think of a court that only accepts sworn statements, and prefers several witnesses to one. Instead of trusting a single messenger, an oracle network uses many independent operators. Each fetches the price from several exchanges, they publish their answers on-chain, and the contract takes the middle value. Aave uses feeds like these to decide when a loan no longer has enough collateral behind it, and stablecoin and derivatives contracts use them to know what a dollar is worth right now.

What happens when an oracle gets it wrong?

It is one of the sharpest risks in this corner of crypto. If a feed reports a bad number, even for a moment, contracts act on it faithfully: loans are closed out that should have been fine, and attackers have deliberately shoved thin markets around to make a feed lie. Careful oracle designs defend against that by pulling from many sources, ignoring outliers, and refusing to update on a single suspicious jump.

When you are weighing up a lending or trading app, find out which oracle it uses and how many sources sit behind the number. That one detail says more about how safe it is than the interface ever will. Our guide to smart contracts covers the code on the receiving end.

← All guides