What is Blockchain Oracle and why are they needed?
Blockchain Oracle acts as a medium between off-chain and on-chain data. It helps other blockchain and smart contracts to access off-chain data (data beyond the blockchain network). It plays a vital role within the blockchain network to amplify the ecosystem for smart contracts to work more accurately. Otherwise, without Oracles, smart contracts can hardly retrieve any data to make decisions within the network.
However, the off-chain data should contain accurate information from the outside world so that there is no forking in the blockchain network and smart contract can be executed successfully. Also, one must know the fact that blockchain Oracle is not the data source itself. It queries, verifies, and authenticates the external data sources and passes on the information to the next level. The data can be price information, a measured temperature, or any successful transaction.
Oracles fight a big problem of consensus within the network. During any transaction process, the nodes are required to replay the transaction to end up with the same result. But the retrieved data through price APIs are always different from each other, as the prices between cryptocurrencies to $USD keeps changing. This might effectively break the consensus process within the nodes as the transaction agreed upon at a fixed price is not known by the network and keeps changing.
Oracle solves this problem effectively by posting the exact data required by the smart contract to complete the transaction. For this mechanism, an Oracle consists of a smart contract along with some off-chain components which can query APIs. The data is sent periodically to the blockchain network to verify the transaction process.
The Oracle Problem
The only fundamental constraint of smart contracts is that they cannot interconnect with information outside their native blockchain ecosystem. But because of being isolated from the outside world, smart contracts possess some extraordinary properties like a strong consensus, prevention of hacking, mitigating network unavailability problem, and much more. Meanwhile, ‘Oracle’ comes into action by providing bridging support through its unique infrastructure between the two networks.
Blockchain use cases such as DeFi are majorly dependent on real-world data and information on off-chain networks. Therefore, the Oracle problem offers a unique portal to off-chain resources while sustaining the security properties of the blockchain. Some of the well-known industries of the market such as weather reporting, gaming, IoT sensors, ID verification, and many more combine with Oracle smart contracts to function more accurately.
It is of great importance that the Oracle mechanism should execute exactly expected otherwise the outcomes of the smart contract can be deliberately erroneous. However, the information or data posted on the off-chain network must be true to the events, or else the consensus in blockchain will never settle on a single decision.
Decentralized Oracles vs Centralised Oracles
Blockchains when using centralized oracles, it nullifies the advantages of decentralism and thus making smart contracts compromised. Such centralized oracles can put each node and whole system at major risk purposely. Also, if a single oracle goes offline, the complete smart contract will not have access to the information. In this manner, the system execution might not take place as desired. Moreover, centralized oracles cannot judge the quality of data they are feeding to smart contract applications such as DeFi networks.
If a single oracle is corrupted, the on-chain data-driven system may lead to wrong outcomes. Therefore, wrong inputs from corrupted oracle sources can result in wrong outputs, this process has a generalized term as ‘garbage in, garbage out. Also, as the transactions on the blockchain are irreversible and immutable, the after-effects of faulty outcomes through smart contracts may lead to irreparable loss of funds. Perhaps, centralized oracles are incompetent for smart contracts applications to work on.
Whereas, decentralized oracles avoid all types of above-mentioned problems and prevent risks from other party contractual obligations. In decentralized oracles, there are thousands of nodes working together in the system, and therefore reliable information is provided to execute the function. Similarly, the smart contracts query multiple nodes present in the oracle to investigate the credibility of the data received. Consequently, decentralized oracles are also known as consensus oracles.
Decentralized oracles can prove to be helpful in the prediction trading community where predictions can be validated by social consensus. Many blockchain projects offer such kinds of oracle services where needed. However, decentralized oracles do not obliviate the trust factor hundred percent but rather distribute the same among several participants.
Different types of blockchain Oracles
There are different types of Oracles on the Market. Sometimes a human being can also act to be a potential source of data or information to the on-chain networking system. However, based on data usage, and information retrieval sources, there are multiple types of oracles that serve different purposes to the network.
Hardware and Software Oracles
Hardware Oracles collect data from the physical world and deliver it to the blockchain smart contract. Data received from camera motion sensors, radio frequency identification (RFID), or other similar physical methods are some examples of ‘hardware oracles’.
Whereas Software oracle uses digital sources such as websites, and database systems to collect the information. Such types of oracles execute data from sources like websites, exchange rates, travel information platforms, real-time data sources, and many other platforms.
Inbound and Outbound Oracles
Through oracles, data or information are sent in and out and therefore they act as a two-way communication channel in the blockchain system. ‘Outbound oracles’ deliver on-chain data to the outside real world i.e. it processes the information held on the blockchain network to the off-chain community. Also, the outbound oracles become vigilant when an event occurs on-chain.
While ‘inbound oracles’ work opposite to the outbound. They import the off-chain data to the blockchain network. Moreover, the imported data on the blockchain can be anything from asset prices to payment verification information.
Sometimes, humans with specialized knowledge can act as oracles for the blockchain network. They may possess information related to a specific category that might be useful to smart contracts. And therefore, human oracles can cryptographically verify their identity to the network while proving the legitimacy of the information from various sources. The process of cryptography represents a firewall so that no fraudster can impersonate and tamper with data.
Compute Enabled Oracles
Compute enables oracles are the most widely used oracles in the industry. These oracles use a secure channel of off-chain computation to provide the data in a decentralized manner. The process of on-chain information loading can be very tedious as it requires technical, legal, and financial constraints to pass. Sometimes, ‘Keepers’ are authorized to automate the running of the smart contract with predefined events. This might also include ZK-Proof ID verification and verifiable random function to run on smart contracts for tamper-proof availability of data sources.
Moreover, as the name is given, computational oracles can perform computations when a set of input data is provided. Whereas, such functions sometimes become impossible to execute on the on-chain platforms. Therefore, computation oracles are also used as calculators to calculate complex regressions of any bond contract and many more such things.
To summarize, through Oracles, the capabilities of blockchain extend to external sources and harness useful and valuable information for smooth data processing. In the era of smart contracts, oracles are the medium to feed smart contracts with lots of data to perform tasks and verify the computations. It is very much similar to the ‘Internet’ which revolutionized the complete information exchanging system throughout the world. Hybrid smart contracts are using oracles to redefine the way of data exchange networks in society.