What is a blockchain oracle?
Blockchain Oracles are third-party entities that provide real-world information and data to programs that operate on blockchain technology: oracles connect blockchain to external systems, enabling the execution of smart contracts based on inputs and outputs from the real world.
More precisely, oracles are computer programs that bridge off-chain data to the on-chain world, in a safe and reliable way.
Oracles are beneficial in a variety of situations. For example, consider a basic smart contract for a cryptocurrency bet that reads: "If Biden is re-elected, you will receive 2x your initial bet." When you place a bet through a smart contract, it is irreversibly executed, and once it is completed, it sends the money automatically (if you win). However, the smart contract requires real-world data to determine if Biden was re-elected or not, here is where the oracle mechanism comes in, as it accurately gathers off-chain data and transmits it to the blockchain.
The Oracle Problem: centralization
Blockchains and smart contracts, being built on-chain and, thus isolated from external systems, can’t intrinsically interact with outside data and information, and this is built-in functionality in this kind of technology. This is also one of the technology's key advantages, ensuring decentralization, security, and reliability.
However, smart contracts, especially in the DeFi ecosystem, really need to be connected to the external world and its information in order to express their biggest potential.
Oracles, as explained, are an additional entity that is fundamental to bridge the two completely different ecosystems. The problem comes when centralized oracles are used. These kinds of oracles are managed by a single entity that acts as the only provider of information. Using a centralized entity introduces a big risk and deviates from the primary purpose of blockchain technologies and smart contracts: decentralization.
To solve this problem and avoid inefficiencies, decentralized oracles have been introduced.
These systems aim to achieve these results through Decentralized Oracles Networks (DONs): networks of different oracles that operate in a decentralized environment. This permits to have different data sources and so increased security and reliability. Some examples of blockchain projects that developed this kind of technology are Chainlink (LINK), Band Protocol (BAND), Augur (REP), and MakerDAO.
Different types of oracles
Given the vast amount of off-chain resources, blockchain oracles come in various shapes and sizes, as different delivery techniques and levels of security are necessary.
The most used and recognized type is known as “input oracle”: it brings real-world (off-chain) data inside the blockchain network. For example, it can provide financial market data to DeFi protocols, proofs of payments, weather forecasts, sports results.
“Output oracles” are exactly the opposite of input oracles: they allow smart contracts to send blockchain information and data to systems off-chain. For example: inform a bank network of the competition of a payment.
Oracles that can read and write data between multiple blockchains facilitate interoperability between blockchains, allowing them to be used also outside of the native blockchain where they were issued.
Decentralized Finance is a perfect example for understanding the importance of oracles, as it requires them to access various information about financial markets that are essential for the DeFi smart contracts to work and process all their functions.
To conclude, we can say that oracles enhance blockchain networks' capabilities by providing access to all external resources required, and there are numerous scenarios in which oracles might assist blockchain technology in achieving its maximum capabilities.
by Andrea Marsili