An oracle is a mechanism that supplies smart contracts with information that is not natively available in the blockchain state. Oracles are especially important in DeFi because financial applications often require market prices and other external information.

Blockchains are intentionally isolated from arbitrary external data. A smart contract cannot simply send an HTTP request to a website and treat the response as part of blockchain consensus. An oracle provides the infrastructure required to bring external information into the blockchain environment.

An oracle can collect information from multiple sources and deliver an aggregated result on-chain. Different oracle systems use different approaches to data sourcing, aggregation, updates, and validation.

In DeFi, oracles can provide the value of collateral, determine liquidation conditions, support derivatives, and provide other market information required by financial contracts.

Oracle security is therefore a major part of protocol security. If a protocol receives an incorrect price, an attacker may potentially borrow too much, trigger inappropriate liquidations, or manipulate the economic state of a system.

Oracle designs range from centralized data providers to decentralized systems that aggregate multiple independent sources. The existence of an oracle does not by itself determine how decentralized or secure the complete protocol is.