Understanding Oracles In The Blockchain World – A Not-Too-Technical Primer
In the world of distributed ledgers, oracles provide a link between blockchain technology and the real world.
In this article, you will be introduced to how oracles work and why they are important for the blockchain industry.
What are oracles and why are they important?
An oracle is a tool that provides off-chain information to a blockchain network.
While blockchain technology has helped usher in a new era of decentralization and trustlessness, challenges arise when blockchain-based applications must interface with legacy, off-chain programs. This is especially true for applications that leverage smart contracts. This is why the growing interest in DeFi (decentralized finance) has further bolstered the need for oracles.
To understand the role that oracles play, let us consider an example.
Say Alice and Bob want to place a bet on who will win the big upcoming boxing match. Alice says it will be Boxer 1 while Bob bets on Boxer 2. They send ethereum (ETH) to a smart contract designed to pay out the funds to the winner after the match. Now, without an oracle, the smart contract would not be able to execute as it would have no way of knowing what happened during the fight. However, if Alice and Bob’s smart contract is designed to interface with a sports website to find out the winner, then it can successfully execute its payout. And that’s where oracles come into play.
Oracles provide an essential mechanism through which the real world and blockchain-based applications can interact, communicate, and exchange data. It is imperative that blockchain-based solutions are able to interface with real-world events otherwise their advantages are impaired. As a result, oracles are essential to the mainstream adoption of blockchain-based smart contracts.
Third-party services that act as oracles smart contracts do not create the data they provide. Oracles handle the sourcing, verification, and authentication process for the data, which it then relays to the smart contract. Additionally, oracles do not always transmit information to the blockchain, some oracles are able to communicate with the real world upon direction from the controlling smart contract.
In this section, we discuss the broad categories oracles can fall into. It is important to note that a single oracle can fall into many categories at once.
Software oracles access, collate, verify and interface with web-based sources of information with the aim of sending it back to a smart contract. These oracles can use any information found online, from news to data stored on online databases.
Software oracles are well-utilized due to their ability to relay data in real-time. For blockchain-based applications in areas like forex trading or the supply chain, it is essential to relay things as they happen. Software oracles can be used in weather applications, to track exchange rates, and more.
Hardware oracles are tangible and designed to acquire information from the real world. These tools will typically leverage sensors or scanners to read and relay the data. An example of this would be a sensor that scans cargo barcodes for loading at a port.
Once the cargo ship reaches a predetermined weight, as is determined by the weight of the packages, the scanner relays this information to a smart contract which then closes the loading bay. In this instance, the scanner serves as the hardware oracle.
Inbound and outbound oracles
This classification is based on the direction of the date which the oracle is relaying. If the data is going from the blockchain network to the real world, this is called an outbound oracle.
Conversely, if the data is going from the real world to the blockchain it is called an inbound oracle.
Centralized and decentralized oracles
This classification considers the source of the data which the oracle is reading. If the oracle receives data from a single party, it is a centralized oracle. While this option may seem easier, it does come with a single point of failure risk. If the source of information is wrong or otherwise compromised, the underlying smart contract is flawed as well.
A decentralized oracle, also referred to as a consensus oracle, acquires its information from many sources. They collate data and typically use human consensus to pick the data they trust. As a result, these oracles are more robust and less likely to compromise the smart contract with unreliable data.
There are blockchain-based decentralized oracles which provide other blockchains with information. This is especially useful in the context of prediction markets. An example is Augur (REP).
A contract-specific oracle refers to those designed to work with a specific smart contract. It works on one oracle per contract ratio. While expensive to deploy and maintain, especially where there are many smart contracts, they provide room for customization to a high-level that may prove worth the trouble for certain developers or applications.
Lastly, while rarely utilized in this context, human beings can also serve as oracles. If a party relays a piece of information and cryptographically signs it, this information can be employed on-chain. Additionally, due to the use of cryptography, there is a much lower risk for compromised data.
Addressing the challenges
The importance of oracles cannot be underrated. They provide a vital bridge between the blockchain and the real world.
However, there is a significant problem with centralized oracles. While they interface with the very robust and secure blockchain tech, these oracles do not have the same level of security due to their centralized point of failure. It would be trivial for a malicious party to take control of the single source for their own gain.
Moreover, even if the single source is uncompromised, there is still the man-in-the-middle risk. This is where a party is able to intercept communication between the oracle and the source with the aim of amending the data in some way. Fortunately, decentralized oracles provide an alternative, while staying more robust due to their design.