What are Blockchain Oracles?
A blockchain oracle is an institution that collects information, verifies them and provides them to a smart contract. Data can come from other smart contracts (on-chain oracles) or from off-chain sources.
On-chain oracles are typically price oracles. Off-chain oracles can handle many data sources including prices.
The need for off-chain oracles
Smart contracts running on a blockchain cannot access traditional data from outside the blockchain. But connecting off-chain data and on-chain processing has immense potential for the development of decentralized services. For example, finance smart contracts need price information from exchanges, insurance smart contracts need information about damage events, and supply chain smart contracts need to be informed about the location and condition of a container. There are many more applications of off-chain data.
The problem is that miners, witnesses, validators, or in general, block producers cannot access data from outside the blockchain. For example, it would be too difficult for them to provide the temperature in Berlin on Monday at 12 pm or tell when a shipping container crosses the border.
This is the point where oracles come into play. Oracles have the task of providing off-chain data to on-chain smart contracts.
Off-chain oracles try to solve this problem by providing off-chain data. They collect data from external sources and submit them to smart contracts (on-chain).
The need for on-chain oracles
On-chain oracles provide information that are generated in a smart contract and are accessible through other smart contracts. Typically, these data are token prices or stable coin prices from decentralized exchanges. Price information are used by decentralized lending protocols to determine the collateral, calculate the amount of token to repay the loan or to trigger any liquidation.