Before diving into blockchain oracles, it is important to know what smart contracts are and what they do. I have written it in details, however I will put it here in a couple of lines.
Smart contracts are self-executable computer programs that run on the blockchain to enforce and facilitate agreements made between two anonymous parties without the need of a middleman.
To give you an example, you can make an agreement with a dealer for goods to be delivered at your home. The agreement states that payment of money would be triggered and automatically deducted form your bank account when the goods (in expected condition and form) are delivered.
Now that you know what smart contracts can do, let us move to blockchain oracles.
Smart Contract’s Shortcoming
Smart Contracts are decentralized. By nature, blockchain operations are completely external from other centralized networks. This restricts smart contracts from accessing external data.
You may now ask what is the need to access external data? For smart contracts to function properly, a data source is needed. Without access to these sources of information, use cases for smart contracts drop to just a tiny fraction of their potential.
There is a lot of data in the non-blockchain world that can be of much use to smart contracts. Of course not everything can be moved to the blockchain because blockchain holds sequential data and much of the data in the non-blockchain world is non-sequential world.
Secondly, blockchain cannot understand or process all forms of external data. For blockchain to make use of the data, it is important to convert the data in a format that is understandable to the blockchain.
It would be great if we have something that can bring in data to smart contracts from the non blockchain world, or send data from smart contracts. And that is where blockchain oracles come in.
What are Blockchain Oracles?
Smart contracts might need to access external data. Oracle is an agent that acts as data carriers to connect external APIs to dApps (decentralized Applications).
Oracles are tasked with serving a bridge between the blockchain world and the non-blockchain world. It gathers non-sequential information (note that blockchain contains sequential information only), converts it into a sequential stream of information which can be understood by the blockchain.
For our example of car dealer delivering goods to home, this entire scenario plays out in real world with an external or non-blockchain system recording the events. As soon as the delivery happens at home, an event is triggered from the non-blockchain world to the blockchain system.
This event is triggered with the help of oracles. Blockchain cannot access data from the outside their environment. Oracles act as a feed to provide external data and trigger execution of smart contracts when a pre-defined set of conditions are met.
Types of Oracles
Oracles can be of different types, and I have explained the major ones in brief below –
These are data feeds from the physical world. A smart contract can need information from the physical world in order to execute itself.
For example, a car reaching a pre-defined location (marked in latitudes and longitudes) where movement sensors must detect the vehicle and send the data to smart contracts.
Another example can be of RFID sensors in the supply chain industry that can help blockchain track the supply.
Oracles that provide data to smart contracts from outside blockchain network are known as inbound oracles.
For example, a payment in bitcoins to the supplier when the goods have been marked as delivered.
These are oracles that send data from the smart contracts to outside blockchain network. This can be used to activate or deactivate, lock or unlock services in the real world.
For example, a payment made on blockchain smart contract will activate services for the consumer.
Software oracles are those that interact with the online world, like APIs. These oracles are responsible for extracting the required information and provide the same to smart contracts for processing.
Blockchain Oracle Use Case – Flight Insurance
The other day I read a wonderful use case on Ethereumdev.io. The example is of flight insurance where there would be the following three actors:
The task of the oracle is to fetch data on whether the flight was delayed or not. The smart contract will work in 5 steps –
- Insurer will create a contract and lock x times the price of the cost of insurance in it
- Client will pay the insurance price
- The contract is locked
- Oracle tells smart contract if the flight was delayed or not.
- If the flight was late the client receive his deposit and the money from the insurer, if the flight was on time the insurer get refunded his guarantee and get the fee paid by the client.
The Oracle Problem
Smart contracts work in a decentralized environment and it relies on oracles for information to take required action. This makes oracles an extremely powerful and important part of the process.
If by any chance the oracle is compromised, it would simply mean that the smart contract has been compromised. This is called “The Oracle Problem”.
In simple words, a centralized oracle service undoes any benefits that might have been reaped by a decentralized smart contract.
The Perfect Oracle
The perfect oracle is still elusive.
The model developed by Augur is based on token holders voting on the truth. Other token holders can dispute the same and the process resolves in a loop, theoretically converging to truthful oracle outputs.
Gnosis is yet to come up with a serious solution to the problem and have left it to the users/developers to create a perfect oracle service which then can be integrated to their platform.
Future Potential of Oracles
With time you will see increasing number of use cases for smart contracts and that will give rise to newer and better oracles.
Better structures will be developed and more innovation is likely as more and more investments are made into the technology and the industries that harness the power of the blockchain.
These structures will also need to address security concerns that currently exist and cryptography will play an important role in this case. You can expect increased and better blockchain to web communication in times to come.
The development of a unified and integrated platform for communication between blockchain environment and non-blockchain environment is important.
Blockchain oracles are third party services which are not part of the blockchain. The main challenge with oracles is that people need to trust these sources of information. Trusted computing techniques should be developed and used.
Oracles empower blockchains by helping them co-exist with current data structures. This is and will play a big role in making decentralized applications go mainstream.
The usage of oracles in blockchain improve the potential of the technology to disrupt the world as we know today.