The transparency and reliability of pricing information are crucial for users looking to trade cryptocurrencies effectively on exchanges and decentralized finance platforms. Such transparency can be powered by blockchain oracles, which enable third-party data providers to supply real-time pricing information to DeFi protocols.
In OKX’s continued effort to foster the growth of the DeFi ecosystem, we have launched a public oracle based on the Open Oracle standard. This article provides a comprehensive overview of blockchain oracles and their roles in promoting the development of DeFi.
What are blockchain oracles?
Blockchains and smart contracts cannot access data from outside of their respective networks. To execute a smart contract on a blockchain, it is often vital to access relevant information from the outside world, since a blockchain itself cannot record the price of a token, the weather information of a city or other useful data without a source. This is where blockchain oracles come into play.
Blockchain oracles are third-party services that allow smart contracts to receive external information from outside the blockchain.
The role of blockchain oracle. Image source: 3commas.io
The oracles themselves are not data sources. Instead, they are layers to query and verify real-world events and to submit this information to smart contracts. If the submitted information matches the predefined execution condition of the smart contract, the execution of the smart contract will be triggered on the blockchain.
Different types of blockchain oracles
Blockchain oracles can be characterized in three dimensions:
The source of information, be it software or hardware.
The direction of information, be it inbound or outbound.
The degree of trust, be it centralized or decentralized.
The source of information
Software oracles process information from online sources such as websites, databases and servers. These oracles extract the relevant information and put them into the smart contract. Real-time flight information, currency exchange rates and digital asset prices are the most common pieces of data processed by software oracles.
Hardware oracles, on the other hand, receive information from physical sources and convert this information into digital values that can be understood by smart contracts. These physical sources include sensors and barcode scanners. Supply chains are common use cases, where hardware oracles extract the status of goods from a sensor and transmit this information into a smart contract.
The direction of information
Inbound oracles provide information to smart contracts from external sources. For instance, the oracle transmits temperature recordings by a sensor (i.e., the external source) into a smart contract.
External oracles enable smart contracts to send information to the outside world. A common example involves funding deposits. When a user deposits funds to a cryptocurrency wallet address, the smart contract will send the confirmation message of the deposit to the wallet provider. Then, the wallet provider will update the user’s cryptocurrency balance after receiving the message.
The degree of trust
Centralized oracles receive information from one data provider or a group of data providers controlled by a single entity. This raises the concern of there being a single point of failure — which makes centralized oracles less resilient to hacks and vulnerabilities.
Decentralized oracles obtain information from multiple data providers and transmit that information into smart contracts. Compared to centralized oracles, decentralized oracles rely on multiple sources — which increases the reliability of the information provided to smart contracts.
Blockchain oracles in DeFi
Decentralized finance has seen remarkable growth in recent years, reaching a valuation of $13.6 billion in 2022.
Oracle tokens have gained particular popularity in the DeFi community thanks to their utility and the asset's historical performance.
Blockchain oracles have played an instrumental role in DeFi development, as they enhance data reliability and accuracy across various DeFi protocols. Various DeFi protocols have launched price oracles to offer transparent pricing data to users. For instance, money market protocol Compound announced its decentralized price oracle, the Open Price Feed, in August 2020. In the OPF, price reporters — such as cryptocurrency exchanges, DeFi protocols and OTC trading desks — can submit margin trading and lending price data using a known public key. Users can fetch the reported pricing data by accessing the public API of price reporters. The price oracle is decentralized, as the submission of and access to price data can be conducted without using the infrastructure of the Compound protocol.
The growing popularity of decentralized oracle platforms — most notably Chainlink — also fuelled the recent growth of DeFi. Chainlink offers decentralized oracles that retrieve and deliver financial data for derivatives and lending. For instance, Chainlink claimed its oracles have retrieved data for over 90% of the volume of derivative lending defaults among public blockchains. This data is adopted by DeFi derivatives providers such as Synthetix, Nexus Mutual and MCDEX.
By relying on decentralized oracle platforms, DeFi protocols can save time and resources while fostering innovation in other areas of decentralized finance.
The future of blockchain oracles
While blockchain oracles serve as a bridge between blockchains and external data providers, security remains a key issue when examining whether or not blockchain oracles may go mainstream.
As blockchain oracles are excluded from the consensus mechanisms of a blockchain, they are not protected by the security mechanisms of said blockchain. This has made blockchain oracles the target for hackers looking to exploit pricing errors, as illustrated by the security incidents of Synthetix and bZx.
The man-in-the-middle attack, in which the malicious actor gains access to the data flow between the oracle and the smart contract, is another security threat for blockchain oracles. The actor then modifies or falsifies the data, which lowers the data quality provided by blockchain oracles.
Without blockchain oracles, smart contracts have limited use cases — as they can rely only on the information in their own blockchain networks. Oracles enable the connection between smart contracts and external data providers, which enhances the data reliability and transparency of decentralized finance protocols. As a result, blockchain oracles serve as the bridge between DeFi protocols and reliable external data providers.