file icon

What is an Oracle?

An oracle is a service that provides access to “off-chain” information (i.e. information not primarily stored on a given blockchain or DLT) to smart contracts running “on-chain.”

Often, smart contracts are programmed in such a way that their operation depends on information that they can’t directly access on-chain. Because of this, a great deal of trust has to be placed in oracles to represent information on chain correctly.

For example, in a prediction market dApp on Ethereum, a smart contract is defined to make a 1 ETH prize available to a user who correctly predicted the winner of an election. Therefore, the smart contract needs a way to know who won the election before allowing the user to claim the prize - and be absolutely sure that that information is correct. This is an example of an oracle receiving data from an external, real-world source.

Less commonly, oracles can also provide data that is already on-chain but in a more convenient form. An example of on-chain data could be a price feed for a token traded on Uniswap. That price feed could then be used in a variety of ways, such as allowing liquidations in a lending protocol. 

Oracles are thus integral to the functioning of DeFi, and present a risk to the entire ecosystem if they fail, are gamed, or are attacked. That’s why in some of the more common oracle networks, such as Chainlink or Tellor, game-theoretical approaches are used to protect the oracle network from such attacks.

Further reading: