Smart contracts or decentralized applications run on the blockchain without any intervention or third party interference. These smart contracts work exactly as intended by its developer. Most of these dapps are written in a programming language called Solidity. The statically typed programming language follows a ‘if this then that’ logic for executing instructions. The developer has already provided instructions for the smart contract to run in particular situations. Smart contracts run on the blockchain and cannot interact with any program which is not written in the original code. An important question arising here is that if smart contracts cannot interact with the outside world then how can they collect or analyze real world data. Oracles play a key part in collecting data from outside world and relaying it to smart contracts. The decentralized application can then analyze these data points, arrive at a conclusion and execute a set of commands which have already been programmed.
What are blockchain oracles?
Blockchain oracles collect data about real world events and then relay this information back to smart contracts or decentralized applications. Oracles play a key role in the working of smart contracts dependent on outside data. Specific applications cannot complete their working until they analyze data which is stored outside the blockchain. They need some triggers to arrive at a particular conclusion where they can execute a set of predefined instructions. In most cases, the oracle provides the trigger after which the smart contract can make a decision. An oracle could collect data such as temperature at different hours or time of the day and then send it to a smart contract. Oracles play a key role in ensuring that smart contracts are able to work exactly as intended by their developers. An oracle could be used to trigger a certain possibility in a multisig wallet.
Perhaps the best case example for any oracle lies in a prediction market such as Augur. Augur is a decentralized prediction platform which allows participants to place bets on outcome of real world events. The Augur network cannot interact directly with participants nor rely on them to report factually correct outcomes. The platform could be manipulated into accepting an event that never occurred if it depended on users for reporting data. An oracle can be used to relay important data from outside world to the Augur platform. The platform can analyze this data and draw relevant conclusion. Another possibility is an oracle where people report the outcome of an event but the platform considers it as true only when most network participants have reported the same outcome.
Oracles could also form a critical component of a multisig wallet where funds shall be transferred only when certain important criteria is fulfilled. This criteria or the event could be dependent on the completion or occurrence of some real world event or dependent on some other data points. Oracle will collect that data and feed it to a smart contract. The smart contract will analyze the received input and complete a fund transfer if the event needed for the condition has occurred. Individual users of a multisig wallet do not rely on each other for reporting an event as the oracle will work in an unbiased manner and report factually correct findings.
Types of Oracles
Oracles can be broadly classified into two major types, namely software oracles and hardware oracles. Software oracles are oracles that rely or collect data from other sources such as the web. The oracle collects data from the source and then redirects it to a smart contract. This is the simplest working of any oracle as it only collects data from the source and transfers it to a smart contract. The oracle is dependent on the original source for authenticity of reported data as any incorrect data could trigger an unintended event by the smart contract. On the contrary software oracles are the most powerful options for collecting data as they fetch data from the internet directly and cannot be manipulated. Software oracles are fast and reliable because they are connected to the internet and they can easily collect data for smart contracts.
Hardware oracles collect data from real world and then relay this data to the smart contract. A major difference between software oracles and hardware oracles is that hardware oracles work in the outside environment and collect data points. A hardware oracle could collect temperature readings after specific intervals of time. The oracle would then feed this data to a decentralized application which needs this as input for its efficient working.
Oracles could also be classified into centralized oracles or decentralized oracles. A centralized oracle is where the a single input is fed to the oracle either from a source or from an API. Centralized oracles rely on a single oracle to feed data. There is no way to verify the authenticity or accuracy of the data being provided. Hence decentralized oracles were developed. A decentralized oracle depends on more than one source for collecting the input data. More oracles collecting data helps ensure that only correct and reliable input is provided. It helps to weed out a corrupt, dishonest or malfunctioning oracle from the network.
Oracles used in prediction markets
Decentralized prediction platform Augur relies on oracles for its efficient working. It is a prediction and betting platform which relies on members for accurately reporting the outcome of events. It uses a decentralized oracle system to ensure that no rogue oracle feeds a wrong input which would trigger an unintended action in the smart contract. Even though we may take several precautions to ensure that oracles feed the correct input to the smart contract but it may not happen all the time. There is a possibility that the oracle may malfunction and would begin relaying incorrect data. Hence it is extremely important to incentivize oracles to send the correct input to the smart contracts. On the other if the data received from any oracle deviates from the mean input provided by other oracles then that oracle must be penalized.