Blockchain is ushering in a new wave of technological change that is significantly transforming the way we perform activities such as tracking goods in transit, managing our money, and recording asset ownership. Blockchain technology is still said to be in its infancy as there are still many blockchains that are plagued by issues such as security, speed, scaling, decentralization, etc.
The solution proposed by technologists to sort out these issues is to make use of the blockchain for certain transactions and to take the less critical ones offline. But when everything that happens off-chain is recorded digitally, it will not be sequentially recorded like in a blockchain. So, what can be done to sync a blockchain to record new information that is not determined by the previous on-chain transactions? This is where Blockchain Oracle comes into the picture.
In this article, we will be discussing Blockchain Oracle in detail.
What is Blockchain Oracle?
Blockchain Oracle can be understood as a third-party information source that has the sole function of supplying data to blockchains that permit the creation of smart contracts. At a fundamental level, smart contracts are self-executing contracts that contain the terms of the agreement between a buyer and a seller that is written directly into lines of code. A smart contract evaluates incoming data from an oracle and initiates a flow of execution based on the information received.
For example, consider Alice and Bob initiating a wager about what the temperature on Saturday will be. Alice believes it will be 20 degrees or more while Bob believes that it will be 19 degrees or below. They now design a smart contract that will pay the winner depending on what the temperature is. For the smart contract to find out the temperature and pay the winner, it must query an oracle or a trusted source and use the result obtained to begin a path of execution. After going through a local news website, the temperature value is returned as 24 degrees for Saturday. The smart contract will then execute on its conditions and send the funds to Alice.
Types of Oracles
Oracle provides additional functionality to smart contracts by giving them the opportunity to communicate outside of the decentralized blockchain network. Blockchain Oracle can take numerous forms, and we will discuss some of those forms in this section.
1. Hardware Oracles
This is tasked with sending data to smart contracts based on occurrences in the physical world. These can facilitate the tracking of goods in a supply chain. For example, if an object with an RFID tag arrives at a particular warehouse, this data will be sent to the smart contract.
2. Software Oracles
This includes online sources of information that can be easily accessed, such as public databases and websites. These provide information on public transport, temperature readings, and the current price of financial assets. These are the most powerful type of oracle due to their inherent interconnectedness to the internet. This allows software oracles to supply up-to-date information to smart contracts.
3. Outbound Oracles
These communicate smart contract data to external sources. Using the previous example, after Alice has been identified as the winner of the wager, the smart contract conveys this information to the wallet provider to automatically updating her balance for reflecting an increase in funds. Here, the smart contract itself operates as an outbound oracle.
4. Inbound Oracles
This has the function of supplying data to smart contracts. This data is external to the smart contract, and once it receives information, it will begin its path of execution. The news website that supplies temperature readings is classified as an inbound oracle.
5. Consensus-Based Oracles
The main function of this type of oracle is to query multiple oracle sources and arrive at an outcome based on their consensus. For example, instead of using one website source, four or five of them can be used, and if all of them return the same temperature readings, the smart contract can execute successfully.
The Oracle Disadvantage
Though Oracles offer many advantages, there is one particular disadvantage which is:
Oracles Require Trust
The data sources used by Oracles to obtain and transmit information to smart contracts must be credible. If Alice had gained access to the local news website, it would be trivial for her to return a temperature reading of 24 degrees, thus allowing her to win the wager. Thus, if the data supplied by the smart contracts to oracles is faulty, security concerns will be raised regarding the validity of the executing smart contract. A possible remedy for this would be to request data from multiple oracles instead of from a single one. Smart contracts can also be programmed to not execute at all, and this will require the intervention of both Alice and Bob.
Blockchain Oracles increase the scope of what blockchain protocols are capable of doing by providing them with a means to communicate outside their own network. These require a certain level of trust, and this is contradictory to the decentralized and trustless nature of blockchain-based protocols. Thus, smart contracts need an increased level of complexity to mitigate the trust that is placed on any one oracle.