What is an Oracle?

Bringing reliable real-world data into blockchains

Tagged

Edward Wilson

Post Date

Quick summary

Oracles let blockchains connect to external data sources. They do this by reliable sourcing data off the blockchain for decentralized applications to execute software on it. Without oracles, smart contracts can’t work. And this would limit what's possible on-chain, such as much of what we enjoy on Ethereum like DeFi.

What is an oracle, and why do we need them?

Data used on blockchains can be categorized as “on-chain” and “off-chain” data. On-chain is  data created through activity on the blockchain. For example, transactions, signatures, contracts, etc. And off-chain data is data that doesn’t come from the blockchain. This can be NASDAQ prices, weather data, sports results, etc.

Blockchains can’t natively read off-chain data. So there must be a bridge that connects the two worlds. These bridges are Oracles.

Oracles make it possible for smart contracts to get off-chain data. They do this by publishing external data onto the blockchain. This gives smart contracts information to make programmatic decisions.

We need smart contracts to connect with off-chain data for exciting use cases. For example, Compound and AAVE need accurate pricing for cryptocurrencies and tokens so people can lend and borrow in DeFi.

What problems do oracles solve?

Blockchains are decentralized databases spread across a peer-to-peer network. This means there isn't a single centralized database controlling all the information. Instead, a group of nodes work together to achieve consensus and ensure the validity of on-chain data.

Consensus mechanisms, like Proof of Work (PoW) and Proof of Stake (PoS) make blockchains deterministic. If anyone wanted to replicate the entire history of a blockchain from its start, they would be able to. If the data on a blockchain can’t be duplicated, then the transaction data is untrustworthy.

But, consensus-based data validation only applies to on-chain data. If a blockchain used a centralized oracle to read off-chain data, then the blockchain would be at risk. That's because this is a single point of failure which can get manipulated. We have seen cases where oracles get exploited, resulting in huge losses.

To overcome this issue, oracles like Chainlink run a decentralized network of independently run nodes. These nodes validate off-chain data to form a consensus before sending this data to the blockchain. This ensures that reliable data gets sent to smart contracts when queried.

The future of oracles

Oracles are the on-and-off ramp to the world of blockchain functionality. Pursuing secure information off-chain in a decentralized manner is an art that is continuously subject to improvement. Just as our bridges have improved over time, we can expect the same of our routes to off-chain data.

Further resources

The Ethereum Foundation on Oracles

What is a blockchain oracle by Patrick Collins Blockchain Oracles Explained by Hashoshi (video)

Decentralised Oracles: a comprehensive overview by Julien Thevenard

Sergey Nazarow: Chainlink founder discussing Chainlink and oracles on the Lex Fridman Podcast

Chainlink 2.0 with Chainlink God a pseudonymous account on the Bankless podcast

UNI the oracle token? An article on Bankless

Why we need decentralized oracles