Oracle

A blockchain oracle is a service that delivers outside information, such as asset prices, weather data, or event results, to smart contracts so they can react to things happening beyond the blockchain.

Smart contracts are powerful, but they have a strange blind spot: they cannot see anything outside their own blockchain. A lending app cannot check the price of Ether on its own, and an insurance contract cannot look up whether a flight was delayed. Oracles fill that gap.

Oracles are some of the most important and least visible pieces of crypto infrastructure. Many DeFi apps you might use every day rely on them behind the scenes.

What Does Oracle Mean?

In crypto, an oracle is a system that takes data from the outside world and makes it available on a blockchain. Smart contracts can then use that data to make decisions automatically. For example, a contract might pay out only if a sports team wins, or liquidate a loan if a token's price falls below a certain level.

Think of a judge in a sealed courtroom who is not allowed to look outside. The judge can only rule on evidence that someone carries in. An oracle is the trusted messenger who brings that evidence through the door. If the messenger is honest and accurate, the ruling is fair. If the messenger lies, the ruling is wrong, no matter how fair the judge is.

Why Blockchains Need Oracles

Blockchains are designed so that every node can independently check every transaction and reach the same result. If smart contracts could fetch data from any website, different nodes might get different answers, and the network would fall out of agreement. To stay consistent, blockchains only work with data that is already on-chain.

This is great for security but limiting for real-world apps. Oracles solve the problem by posting outside data onto the blockchain as a transaction, so every node sees exactly the same information.

How Oracles Work

The basic idea is simple, even though the systems behind it can be complex.

Collecting Data

An oracle gathers information from sources such as exchanges, data providers, APIs, or physical sensors. Strong oracles pull from many sources to reduce the chance that one bad source skews the result.

Checking and Combining

The data is then verified and often combined, for example by taking a median price across several exchanges. Decentralized oracle networks use many independent operators who must agree before a value is accepted.

Posting On-Chain

Finally, the oracle publishes the result to the blockchain, usually through its own smart contract. Other contracts can then read that value and act on it.

Types of Oracles

Oracles come in different shapes depending on where the data comes from and how it is delivered.

  • Price feeds: Provide asset prices for lending, trading, and [stablecoin](/glossary/stablecoin) protocols.
  • Software oracles: Pull data from online sources like APIs, websites, and databases.
  • Hardware oracles: Use physical sensors or devices, such as shipment trackers, to report real-world events.
  • Cross-chain oracles: Pass information between different blockchains, supporting [interoperability](/glossary/interoperability).
  • Randomness oracles: Generate verifiable random numbers for games, lotteries, and NFT drops.

Centralized vs. Decentralized Oracles

A centralized oracle relies on a single provider, which is simple but creates a single point of failure. A decentralized oracle network, such as Chainlink, spreads the job across many independent operators and data sources. This makes it much harder for one party to feed in false data.

Push vs. Pull Oracles

Some oracles push updates on-chain on a regular schedule or whenever a price moves by a set amount. Others work on a pull basis, where an app requests fresh data only when it needs it. Push oracles keep data ready at all times, while pull oracles can save on fees because they only post data when someone uses it.

The Oracle Problem and Its Risks

Blockchains are often called trustless, but an oracle reintroduces trust. A smart contract is only as reliable as the data it receives. This challenge is known as the "oracle problem."

If an oracle reports a wrong price, a lending protocol might liquidate users unfairly or let attackers borrow far more than they should. Some of the most damaging DeFi exploits have involved oracle manipulation, where attackers briefly pushed a token's price on a low-liquidity market, sometimes using a flash loan, and tricked a protocol into using that false price.

To reduce these risks, well-designed protocols use decentralized oracle networks, combine multiple data sources, and use time-averaged prices rather than a single snapshot.

Speed matters too. During sharp market moves, an oracle that updates too slowly can report stale prices, which can cause unexpected liquidations or missed ones.

Why Oracles Matter to You

If you use DeFi, the oracles behind an app directly affect your money. Loan health, liquidation prices, and payouts often depend on oracle data. Prediction markets need oracles to report who won an election or a game, and many stablecoins rely on price feeds to keep their collateral in check. When researching a protocol, it is worth checking which oracle it uses, how many data sources feed it, and whether it has a history of oracle-related incidents. A protocol with weak oracle design can be risky even if its smart contracts are otherwise well written.

FAQs about Oracle

Why can't smart contracts get data from the internet directly?

Every node on a blockchain must reach the same result when running a smart contract. If contracts fetched live web data, nodes could get different answers, so outside data has to be posted on-chain through an oracle first.

What is the oracle problem?

The oracle problem is the challenge of getting reliable outside data onto a blockchain without reintroducing a trusted middleman. If an oracle is wrong or manipulated, the smart contracts relying on it will act on bad information.

Are oracles only used in DeFi?

No. DeFi price feeds are the most common use, but oracles also power insurance, gaming, prediction markets, randomness for NFT drops, and cross-chain communication.

Ready to start your crypto journey?

Join 3.000.000+ satisfied customers.

Buy crypto

Latest articles