Blockchains do well in the storage and verification of information that is existing within the blockchain network. Smart contracts cannot get the information that is existing off the blockchain network, such as websites, APIs, weather stations, stock market and others. The reason for this is that blockchain networks require a deterministic outcome; this means that the nodes should be able to get the same results on the same transaction.
Here come blockchain oracles to help.
An oracle becomes an interface that links off-chain data with smart contracts. Oracle system collects data off-chain, processes it, and makes this data available to a smart contract on-chain. For instance, a DeFi application may collect cryptocurrency rates using the oracle system and use this data to determine the value of collateral.
It always consists of two parts - an oracle contract that exists on-chain and off-chain parts that gather the required data off-chain (from APIs, for instance).
However, oracles can give much more information besides cryptocurrency values. They may be used to provide information on financial markets, weather forecasts, results of sports matches or any other external events depending on the particular oracle and its data sources. In such way, smart contracts are capable of interacting with information which is external to the blockchain.
Yet, there is an essential issue arising from the above fact: how to make sure that the external information provided to blockchain is correct?
In case if only one centralized information provider gives a wrong information, a smart contract would work using the wrong data. Decentralized oracles are trying to decrease this problem by involving multiple nodes and data sources and combining their reports before information would be delivered to the blockchain.
This situation is often referred to as the oracle problem. Accuracy, availability, freshness of data and resistance to manipulation are some important aspects.
Thus, the oracle does not miraculously make the real world information credible. It rather provides a platform for bringing it into blockchain ecosystem.
Oracles come into focus even more when considering blockchain applications based on external information.
For instance, in the field of decentralized finance, the information from the feed can be used by smart contracts to calculate the value of collaterals and other financial conditions. In case of insurance applications, they can make use of external information, like the weather feed, to evaluate whether certain conditions took place. Another blockchain application can use event results or any other verified external information to trigger contract functionality.
There are several types of oracles. Some oracles offer continuous updating of data feed, whereas some of them only answer particular requests. Also, oracles can vary in their dependency on either centralized services or decentralized network of independent participants.
It should be noted that smart contracts do not have the ability to simply browse the internet and choose the required information. Oracles represent the tool which makes it possible.
Thus, oracles represent a significant component of blockchain infrastructure.
Without oracles, most smart contracts would work only with information stored on blockchain. Oracles allow blockchain applications to interact with the external world in a more comprehensive way.