Blockchain oracles: A complete guide

Summary of blockchain oracles

  • Developers often program smart contracts to activate when certain real-world events take place
  • Oracles automatically provide that real-world information to the blockchain without human involvement
  • Incorporating off-chain data allows decentralized applications (dApps) to deliver a much wider variety of user experiences, such as trading, prediction markets, gambling and more

What is a blockchain oracle?

Oracles provide blockchains and smart contracts with real-world data that otherwise would not exist on the blockchain. 

Because blockchains are purpose-built to track information stored on their networks, they can have a hard time accessing information from the “real-world” that does not originate from the blockchain itself.

By allowing blockchains to gain access to real-world data, oracles allow developers to create a broader range of decentralized applications (dApps)

Each dApp consists of smart contracts — pieces of computer code that execute certain functions when predetermined conditions are met. These work similarly to the services the apps on your smartphone provide, but without relying on any human intermediaries. 

Blockchains can be isolated networks that do not have direct access to real-world events or conditions. Oftentimes, blockchains can only access data that already exists on their networks and therefore cannot access data that isn't directly created and stored on-chain. 

By feeding real-world data, such as stock prices or the outcomes of sporting matches, into smart contracts, developers can significantly expand the functionality of the applications they create.

For example, using an oracle service, a developer could create a decentralized prediction market application.

Using smart contracts, the application would allow users to speculate on the outcome of any future event with other people worldwide. These could include bets on which country will win the next FIFA World Cup, who will win the next American Presidential election or any other outcome of the developer’s choosing.

Using real-world data from oracles, the prediction market could automatically settle bets without requiring a human intermediary to approve who won.

blockchain oracle image

Why are oracles important?

Without oracles to provide access to off-chain data, blockchain networks would have no access to information like stock market prices, user identity data, sports scores, the weather, transactions on other blockchains and much more. 

Instead, blockchain would likely require human involvement to provide the information. This leads to centralization risk, which would undermine one of the key differentiators for blockchain networks: decentralization.

Many decentralized finance (DeFi) protocols could not exist without oracles and their ability to bring data onto source information while still remaining decentralized . 

Lending protocols like Aave (AAVE) that allow users to lend and borrow tokens require close monitoring of token prices to function. If these prices could be manipulated by a single individual, it would ruin the decentralized nature of the protocol.

Trading protocols like dYdX (DYDX) rely on oracles to return price feeds for tradable assets. If these price feeds were only supplied by a single individual or company, the trading service would entirely rely on this centralized feed to operate its decentralized trading platform.

Gambling protocols like Augur v2 (REPV2) need oracles to retrieve sports scores. If the protocol did not rely on the consensus of the network as to the outcome of a particular match, but instead relied on a single individual to provide the outcome, the protocol would rely on a single source of truth that could be subject to manipulation.

Ultimately, oracles play an important role in connecting the decentralized world of blockchain technology to events in the physical world. While we have historically relied on centralized, “trusted” intermediaries to perform this duty in the past, oracles offer a more transparent and tamper resistant way of verifying outcomes.

How does a blockchain oracle work?

An oracle has two components:

  1. An on-chain smart contract
  2. An oracle network

If a dApp needs real-world data from an oracle, the dApp’s developers connect its smart contract to the oracle’s smart contract. The oracle’s smart contract monitors the linked dApp smart contract for off-chain data requests. 

When a dApp’s smart contract requests off-chain data, such as the outcome of a certain event the oracle’s smart contract passes that data request to the oracle network. 

An oracle network is a set of computers that cooperate to find and verify data. After they find that data, reach consensus on its validity, and reform the data to be blockchain-readable, the network passes that data to the oracle smart contract.

Finally, the oracle smart contract passes the data back to the original smart contract to execute and validate the initial transaction with the additional context provided by the off-chain data from the oracle.

Trade-offs of blockchain oracles

While DeFi oracles can be helpful, they require dApps that use them to make certain trade-offs.

Some protocols receive praise for being "oracle-free" and not relying on oracles for information. Blockchain users who grasp the trade-offs of oracle networks can better understand DeFi and better evaluate DeFi tokens.

Attack vectors

Blockchains often remain isolated for a reason — to keep their data safe. 

Allowing oracles to bring outside data on-chain carries certain risks. 

Many oracles use proprietary infrastructure and networks (for example, the three layers of decentralization in Chainlink Price Feeds) to secure and transmit data. 

Hackers can attack this infrastructure in ways they can’t attack blockchains. So, while oracles can add helpful information to a blockchain ecosystem, they also have the potential to make it less secure if the network is facing a coordinated attack.

Data manipulation

There are many ways oracle attacks can hurt users through data manipulation. 

For example, a hacker could manipulate an oracle to report the wrong Bitcoin price to a decentralized market. In that case, traders may buy or sell at a loss relative to the correct market price.

Similarly, incorrect price information may trigger loan defaults and liquidations on decentralized lending and yield farming platforms.

Inaccurate information about sporting events can trigger wrongful payouts on gambling dApps. User losses from this kind of manipulated data can be triggered suddenly and be costly to users.

In 2022, a well-known DeFi platform on the Solana blockchain called Mango Markets (MNGO) was exploited due to oracle manipulation. 

The hacker first artificially drove the price of the native token, MNGO, up nearly 30x. Then, the hacker drained the protocol of its funds by taking out massive loans using the artificially-inflated MNGO token as collateral. 

The oracle was receiving a bad input via an inflated token price, which had the side effect of incorrectly assuming the hacker’s collateral was worth significantly more than it actually was.

How to limit oracle risk

Some oracles are riskier than others. For example, smaller or newer oracle networks may be more vulnerable to attack than larger and comparatively older ones that have been reliable over time. 

Newer oracle networks may have battle-tested infrastructure, which may leave some questioning if there are undiscovered points of vulnerability.

One way to limit oracle risks is to engage with protocols that either don’t use oracles or use oracle networks that have a demonstrated track record of being reliable.

Uniswap (UNI) is a top example of a DeFi protocol that doesn't use an oracle and thus has the security benefit of being "oracle-free." 

Due to the nature of liquidity pools and how they price assets, Uniswap doesn't rely on external pricing data. Instead, Uniswap is able to generate all of the data  it needs to function directly from its own smart contracts.

Popular blockchain oracles

While no oracle is guaranteed to be safe against cyber attacks, there are several leading services that many DeFi traders and protocols use: 

Chainlink (LINK) is DeFi’s foremost oracle network, enabling over tens of trillion of dollars in transactions to date. Chainlink offers a variety of products, including the Cross-Chain Interoperability Protocol, a robust network for transmitting data between different blockchains. Check out our Kraken Learn Center article What is Chainlink? to learn more about how this protocol works.

linkChainlink Price


Pyth (PYTH) helps secure and provide data for hundreds of dApps, mostly DeFi dApps on the Solana (SOL) network.

pythPyth Network Price


API3 (API3) provides data for about hundreds of different dApps. The network aggregates data directly from first-party oracles to offer various services across dozens of blockchains.

api3API3 Price


Band Protocol (BAND) is based on the Cosmos (ATOM) software development kit and has its strongest presence in the Cosmos ecosystem. The oracle network play an important role in securing dozens of different dApps and blockchains. Check out our Kraken Learn Center article What is Band Protocol? to learn more about how this protocol works.

bandBand Price


Get started with oracle networks on Kraken

Most leading oracle networks have tokens that contribute to the network's infrastructure and derive value from its success.

Kraken offers digital assets for most of DeFi's leading oracle networks and the assets that use their services right at this moment.