What is an Oracle?

Lesson 10

An oracle is a bridge between the blockchain and the real world. They act as on-chain APIs you can query to get information into your smart contracts. This could be anything from price information to weather reports. Oracles can also be bi-directional, used to "send" data out to the real world.

While smart contracts are programs that run entirely autonomously, the first thing that they require is an input. It is this input that triggers a smart contract to be executed in the first place. A straight forward use case of a smart contract is betting against someone on whether the price of Bitcoin can go beyond $100,000 before the end of the year. These p[arameters then get deployed onto the blockchain.

One the end of the year passes, money gets deposited or withdrawn from both parties accounts based on the outcomeof whether Bitcoins price goes over $100,000 by the end of the year. But how exactly is the price of Bitcoin retrieved and what is in charge of sending this price data to the smart contract?

That is the job of an oracle, it extracts some data from the websites that keep track of Bitcoins prices and then sends it to a smart contract. No matter how secure the smart contract is, an oracle is still its weakest link. A smart contract cannot be completely decentralised until it can retrieve data using a decentralised mechanism thats resistant to any form of manipulation.