An oracle is a data feed or a search agent used by a smart contract to obtain information outside its native blockchain. Using a web API interface, it can communicate with news websites, traditional databases, other blockchains and their DApps, and much more.
Without an oracle, a smart contract would only work for situations where all the needed information to be executed was found on the blockchain it resides on. For example, without an oracle, an Ethereum smart contract could not move funds based on the price of Bitcoin.
If a smart contract wants to trigger conditions that exist outside their native blockchain, it needs an oracle to communicate with third parties on the internet to find what it needs. For instance, let’s say that there is a smart contract that says Joe will get 100 ETH if the Chicago Cubs win the World Series. Well, it needs some way to identify the Chicago Cubs, track baseball scores, and news. That’s where an oracle comes in. The oracle will track and deliver that information to the smart contract at the appropriate time the World Series is played.
Allowing blockchains to communicate with the outside world and fetch the data they need is critical to their function. Imagine having an Excel spreadsheet, where you have the prices of the top 10 flavors of 2L bottles of soda. You want the real-time prices but you can’t be bothered to look online and enter in the price manually every day. If only you had a snippet of code to fetch it for you! That’s what an oracle does for a smart contract. Without them, a smart contract is just a bloated “if, then; else” statement.
There are different types of oracles that serve different purposes:
- Software Oracles - Software oracles look up information on websites. Examples of required data could be temperature, prices, and flight times. The software oracle extracts the information and sends it to the smart contract.
- Hardware Oracles - For smart contract conditions that needs data directly from the physical world, there are hardware oracles. For instance, when an employee enters the building, there is a movement and visual sensor to automatically clock them in and begin paying them for their time. These sensors then send the data to a smart contract, which triggers their pay at the end of the day.
- Inbound Oracles - A type of device or software oracle that provides the smart contract with data from the external world. For instance, when the price of Bitcoin hits $7,000, buy 3.5 BTC.
- Outbound Oracles - A type of device or software that gives smart contracts the ability to send data to the outside world, like a smart lock to the front door, that receives information on the blockchain that the owner has been verified through their mobile app and now the door needs to open.
- Consensus Based Oracles –When using only one source of information could be risky and unreliable, Consensus Based Oracles come into use. For further security, a combination of different oracles may be used, for example, 3 out of 5 oracles could determine the outcome of an event. An example is a prediction market bet on the outcome of an election.
For more info listen to this episode or read the full article here:
Thank you for listening! Crypto and Blockchain Talk - Making You Smarter
SUBSCRIBE to our social channels and never miss an episode: