Oracle

An oracle is a service that brings off-chain data, such as asset prices, event results or weather readings, onto a blockchain so smart contracts can use it. Blockchains cannot fetch outside information on their own.

Blockchains are deterministic, isolated systems: every node must reach the same result from the same transactions, so a smart contract cannot simply query a website. Oracle nodes fetch data from external sources, often over secure TLS connections, and post it on-chain in a transaction that contracts can read. A decentralized oracle network (DON) uses many independent nodes and data sources and aggregates their answers, for example by taking the median, so that no single provider decides the result.

Oracles matter because much of DeFi depends on them. A lending protocol needs a price feed to value collateral. If someone deposits ETH to borrow a stablecoin, the protocol reads an ETH price feed, and if the price falls far enough, the loan can be liquidated. Prediction markets rely on oracles to report event outcomes, and parametric insurance can pay out automatically based on external data such as rainfall.

The main risk is that a smart contract is only as reliable as the data it receives. An oracle that relies on a single source, or on the price from one thinly traded on-chain market, can be manipulated, sometimes with flash loans. That can let attackers borrow against inflated collateral or trigger unfair liquidations. A common misconception is that the blockchain verifies the data itself. It does not. Oracles bring in an element of trust, which decentralized designs reduce but do not remove.

Learn more

Related terms