Primer – With its disruptive potential, Blockchain technology is the future of our society. The decentralized technology provides a distributed digital database that facilitates transactions by enabling an immutable, transparent, and shared ledger. The ledger’s immutability and irreversibility have helped it gain significant momentum across multiple industries as a thriving alternative to legacy systems. Moreover, its use case extends beyond the realm of crypto with myriad implementation opportunities for all businesses and interactions.
The accelerated adoption of the tamper-resistant blockchain technology is revolutionizing healthcare, real estate, gaming, governance, supply chain, and traceability besides finance and banking. Furthermore, oracles set the stage for isolated blockchain networks to access off-chain information, an essential requirement supporting blockchain deployment in the aforementioned sectors.
Let’s delve into what oracles are and why we need them.
Need for Blockchain Oracles
In simple terms, an oracle is a bridge between the blockchain and the real world. However, before we elaborate on oracles, it is vital to understand the reason behind their existence.
While it’s safe to say blockchain technology is a game-changer underpinning the transition to Web 3.0, certain limitations, such as a blockchain’s inability to access off-chain data, would render its real-world application useless. But that isn’t the case owing to the existence of blockchain oracles. In the Web3 space, oracles are third-party services that provide blockchains and smart contracts access to off-chain data bridging the information gap that exists. Examples of blockchain oracle projects include Chainlink, API3, Augur, etc.
Blockchains and smart contracts are self-contained closed systems that can’t access data outside the network. However, several contractual agreements necessitate access to off-chain data for execution, and this is where oracles come into play. In the absence of oracles, smart contracts would have minimal use, and DeFi would not be where it is today. DeFi relies heavily on oracles to deliver on its value proposition of broader access to financial applications. Most offerings of DeFi, such as derivates and prediction markets, borrowing/lending markets, and insurance products, need oracles for smart contracts to react to real-world events. Oracles play a crucial role in enabling smart contracts to interact with streams of existing data, legacy systems, advanced computation, etc., to execute predefined actions. The introduction of hybrid smart contracts that combine on-chain code with secure off-chain data has greatly enhanced the functionality of advanced blockchain applications (dApps). In addition, they have broadened the scope of smart contract generation and execution. These contracts not only form the backbone of DeFi but offer several use cases across multiple industries and sectors such as insurance, agriculture, pharma, environmental sustainability, supply chain management, etc. Oracles are fundamental to almost all smart contracts whose execution is connected to real-world events.
It is important to note blockchain oracles do not constitute the data source themselves. Instead, the oracles query, verify and authenticate external data and then relay the information to the enclosed network.
Types of Blockchain Oracles
Oracles operate on-chain as well as off-chain. The former involves establishing a secure connection with the on-chain infrastructure, broadcasting/extracting data, sending proofs, etc. The latter involves processing and retrieving requests, transmitting on-chain data to external/traditional systems, and performing off-chain computation to enhance scalability and interoperability. There exist different types of oracles with variations in their functions, validation process, and data delivery mechanisms.
Inbound and Outbound Oracles
Inbound oracles deliver off-chain or real-world data for smart contract consumption (on-chain). They’re the most commonly used and supply information ranging from weather conditions to proof of payments to live price feeds.
Outbound oracles send information from smart contracts (on-chain) to the external world (off-chain). These systems are designed to send commands to off-chain systems to execute specific actions. They’re most commonly used by decentralized banking networks and IoT systems.
Software and Hardware Oracles
Software oracles interact with digital sources such as websites, online databases, servers, or any other data source on the web to supply smart contracts with real-time information. For example, the data delivered by these oracles can include exchange rates, price fluctuation, or real-time flight information.
Hardware oracles transmit information from the real world to smart contracts. They’re designed to translate physical events into digital values that can be processed and read by smart contracts. The information is accrued from electronic sensors, RFID sensors, barcode scanners, thermometers, etc. Compared to software oracles, hardware oracles are harder to compromise. They are of particular importance in supply chain management.
Compute enabled oracles provide useful, secure, off-chain computation solutions that are impractical to achieve on-chain due to technical or financial constraints. For example, ZK Rollups, a Layer 2 solution for Ethereum, use compute-enabled oracles as an alternative to the expensive computation cost on Ethereum.
Cross-chain oracles enable interoperability between blockchains. These oracles can read and write information between different blockchains allowing data on one blockchain to prompt action on another blockchain.
Oracles Use Cases
Oracles enable algorithmic stablecoins, financial derivatives, and prediction markets to work seamlessly. All information integrated into DeFi services is obtained through external data feeds.
Supply chains on the blockchain need to interact with external data for tasks, including tracking shipments, monitoring quality control, and verifying customer identities.
Oracles can enable smart contracts to confidentially verify and authenticate an individual’s identity (document proof, certificates, etc.). In addition, digital identity solutions can collate and update personal data and perform actions as defined in the smart contract.
Oracles monitor data through satellite imagery, web APIs, etc., to verify the occurrence of insurable events. They trigger the settlement of insurance claims in a fully transparent and trustless manner. For example, flight insurance in the event of flight delays/cancellation, insurance on property or crops to hedge against poor weather conditions. Moreover, insurance smart contracts can make payout claims via traditional systems.
They have impacted industries as disparate as betting, environment sustainability, education, gaming, and governance.
The Oracle Problem
Smart contracts on the blockchain are immutable and deterministic, but they’re in no way perfect. Their inability to read the off-chain programming language and connect to the physical world necessitates reliance on oracles. Unfortunately, while oracles represent the middleware that provides blockchains with a secure and robust gateway to off-chain systems, enabling verification of external events for contract execution, they introduce vulnerabilities that are difficult to skirt around.
The architecture of hybrid smart contracts is largely dependent on oracles functioning like an application performing interface (API) to the external world. Connection with the real world is paramount to unlocking their full potential. For example, settlement of financial contracts entails the need for market information in real-time, weather information for parametric insurance, IoT sensors for supply chain management, etc. Blockchain’s inability to natively communicate with the real-world sans oracles implies smart contracts wouldn’t be able to deliver a full range of functionality to the users.
The lack of built-in connectivity with the external world forms the crux of “The Blockchain Oracle Problem.”
As blockchains are isolated networks, they’re able to deliver security and reliability to users. But this very property also prohibits them from obtaining external data resulting in an over-reliance on oracles. While oracles exist as viable solutions for bringing external data to on-chain environments, they’re third-party entities (affecting decentralization) whose reliability needs to be trusted (affecting trustlessness).
Reliance on centralized oracles introduces significant risk by introducing a single point of failure. All contract participants need to place their trust in the entity controlling the oracle. As the name alludes to, centralized oracles are controlled by a single entity and are the sole providers of data for a smart contract. Relying on a single entity for accurate information can jeopardize the security of the smart contract.
In the unfortunate event of the oracle going offline, the smart contract would lose access to its only source of information resulting in improper outcomes. Also, if the oracle is corrupted by a malicious actor or supplied with incorrect data, it will directly impact the contract. If an outcome is based on falsified information, it cannot be reversed, putting users’ funds at risk due to blockchain transactions’ automated and immutable nature. Thus, centralized oracles can exercise considerable control over smart contracts, compromising decentralization. Finally, preserving security and fairness in the face of vulnerabilities like downtime, bribe, malicious manipulations, regulatory pressure, incompetence, and hacks becomes challenging.
The oracle problem encompasses the security, reliability, and trust conflict between oracles operating on non-deterministic data and the trustless execution of smart contracts. With the hope of resolving the aforementioned issues and mitigating fraud, Decentralized Oracles were created.
Decentralized oracles avoid counterparty risk and achieve trustlessness and deterministic results. They combat the reliability issue by distributing trust among many network participants instead of relying on a single source of truth. Implementing a system that queries multiple oracles and multiple data sources ensures no single point of failure and enables increased security, reliability, and end-to-end decentralization.
Decentralized oracles offer seamless off-chain data verification that has proven effective for securing smart contracts. They are responsible for the creation of Hybrid Smart Contracts and have contributed significantly to the types of on-chain collaborations these contracts can support.
Hybrid smart contracts facilitate a relatively safer, fairer, and scalable environment with connectivity to the physical world by blending blockchains’ tamper-proof and immutable properties with decentralized oracles’ secure off-chain capabilities. Furthermore, with no modifications to the existing blockchain infrastructure, hybrid smart contracts enhance and expand functionalities previously limited by code on the blockchain.
However, decentralized oracles do not entirely eliminate the notion of trust but simply distribute it between many participants. This arrangement helps to minimize counterparty risk. Decentralized oracles deploy several security approaches off-chain to extend the guarantees provided by smart contracts. Oracles need to fulfill specific properties that include round-the-clock availability, correctness, and accountability. Data manipulation and false inputs are penalized for mitigating reliability and trust issues. In addition, the utility of these oracles extends to a specific application on the blockchain. It has no bearing on the performance of other smart contracts or the consensus mechanism of the blockchain that secures all contracts on it.
It is crucial to note decentralized oracles are the accepted solution for the oracle problem. But, in reality, they’re not sufficiently decentralized to solve all of the issues that plague oracles. The mechanism is not devoid of issues like collusion between parties, signaling, mirroring, and bribing.
Is there an alternative approach, a built-in functionality, perhaps? Let’s delve deeper.
Can blockchains and, by extension, smart contracts pull in data from the real world instead of relying on oracles that push data into the blockchain?
Blockchain, known for carrying out highly secure and transparent transactions, has determinism integrated into its technology. Determinism is a theory that explains that every event/action is causally determined by preceding events. In the context of blockchains, it implies every node on the network produces an identical state of information for the same input at any given point. No node can have a different state/result to successfully validate transactions and uphold the system’s integrity. Determinism is vital, and in the event of different results, there would be disagreement and a failure in consensus resulting in the entire system being inconsistent and worthless. Supporting only one version of the truth makes blockchains deterministic necessitating determinism of every operation and application on it. Thus, smart contracts must be deterministic too.
Real-world data isn’t deterministic, and blockchain’s immutability limits its flexibility when processing external information. Let’s say blockchains can access external information. Still, there is no guarantee that every independent node on the network will query data from the same source or that the results will be identical. This arrangement would open the network to numerous vulnerabilities, including injection of false data, hacking, etc., putting the blockchain’s value proposition at risk.
The aforementioned reasons prohibit the integration of oracles into the base layer. However, as separate networks, oracles help translate the non-deterministic external information into a language readable on-chain, minimizing all associated risks while ensuring blockchains retain their determinism.
Blockchain network’s capabilities clearly extend beyond the mere transfer and exchange of crypto. Smart contracts further expand the possibilities across a host of different domains, including but not limited to supply chain management, insurance, and digital identity. Oracles have contributed significantly to the tokenization of physical assets, but the oracle problem prevents determinism from extending to the oracle layer, hindering growth and preventing blockchains’ from unlocking their true potential.
But as the blockchain space advances, it witnesses constant innovation and technological developments. One such development is the Internet Computer’s proposal of an alternative approach enabling dApps to make HTTP requests directly.
Canisters (smart contracts) on Internet Computer (IC) will be able to communicate with external servers via HTTP requests. Integration with Web 2.0 is essential for executing and implementing hybrid smart contracts. Most blockchains rely on oracles, but with its Chromium update, IC intends to empower canisters to make HTTP requests enabling direct integration with the Web 2.0 world in a trustless manner.
The problem with the existing setup is that it entails the oracle making all the HTTP requests weakening data integrity by introducing trust assumptions. IC hopes to theoretically simplify the process of accessing external data.
Every node on the IC network will make the same HTTP request with an asynchronous API provided through the management canister. Once the nodes receive a response, they shall sign it and gossip it to other nodes on the network. The next step involves the consensus layer aggregating enough signatures (at least 2/3rd of the replicas of the subnet) to include the response in the blockchain. The IC block is then finalized and routed back to the system for concluding the computation that originated the HTTP request.
IC claims this approach works well when all nodes receive the same response at the same time. Moreover, it protects against a malicious node reporting false information, as long as enough nodes report the same response. Acknowledging possible inconsistency in response, the team at IC outlines a complicated scenario wherein the requests are essentially the same but possess minor differences that don’t matter for the computational result but would make it impossible to achieve consensus on the responses received. These differences include details such as timestamps and unique identifiers. IC aims to address the issue by coding around the inconsistencies using a function that transforms the response to include only specific fields from it. This will help remove values (timestamps, unique ids, etc.) that could differ across responses, affecting consensus. IC is optimistic about receiving responses back into the smart contracts’ state in a deterministic fashion. While the long-term plan includes support for POST requests, the upcoming chromium release supports GET requests only.
Canisters’ ability to autonomously connect with the Public Internet for submission and retrieval of data will open up the network to enhanced use cases without the involvement of third parties and additional trust assumptions. This ability to directly interface with HTTP services will be a game-changer as no other blockchain has directly integrated oracle-like functionality. IC’s subnet-based architecture, coupled with its flexible consensus implementation, enables said integration into its protocol stack. Whether IC will succeed in delivering on this functionality or not, only time will tell.
Today, there is a growing need for blockchains and, by association, smart contracts to obtain external data for the continued expansion of blockchain projects and their new and innovative use cases. Oracles empower smart contracts to seamlessly interact with the otherwise inaccessible traditional systems. Oracles are vital to unlocking a decentralized future. However, in their current state, oracles are vulnerable entities that represent the largest threat to DeFi due to data integrity, deliberate tampering, front-running, etc. The use of oracles presents many challenges, but connectivity between blockchains and external data is crucial for blockchains to have a sustainable impact in practical applications. One possible alternative includes native blockchain oracles for ensuring the integrity and security of the data or a direct integration as in the case of Internet Computer, where dApps would be able to make HTTP requests directly.
Nevertheless, despite the drawbacks and the absence of other tested alternatives, oracles are essential for informing and enforcing decisions as we move closer to a world where decentralized solutions shall dominate the market.