What are Oracles? An Aver Explainer
Whether it’s lending markets, decentralised insurance products, liquidity aggregators, derivatives protocols, algorithmic stablecoins or something else, the vast majority of defi apps rely heavily on oracles, middleware entities that connect smart contracts to resources outside of their native blockchains.
Simply put, oracles enable formerly enclosed networks to consume reliable external information and interact with legacy systems.
Oracles allow protocols like Aver to react to real-world events. Without oracles blockchains are valuable but isolated from many practical applications.
The “Oracle Problem”: Centralised vs. Decentralised Oracles
The whole reason that smart contracts were invented was to avoid counterparty risk and an over-reliance on third parties. Oracles enable contracts to be executed between trustless parties, but (especially when they become over-centralized) they can risk becoming the middlemen they sought to replace. Known as the oracle problem, the preservation of privacy, security, and fairness — and avoiding over-centralization that could damage the relationship between smart contracts and blockchains — then becomes the key challenge that oracles face.
Centralised oracles are controlled by a single entity and act as the sole provider of data for a smart contract. They require contract participants to place a significant amount of trust in one entity. They also represent a single point of failure, which can threaten the security of a smart contract: If an oracle is compromised, so is the smart contract. The accuracy and effectiveness of smart contracts rely heavily on the quality of data they are provided with — and thus oracles retain a significant amount of power over smart contracts.
To resolve the issues presented by centralisation, a more progressive direction is towards decentralised oracles, which try to achieve trustlessness and deterministic results that rely on cause and effect rather than on individual relationships. They seek to achieve these results in the same way a blockchain network does: by distributing trust among many network participants. By leveraging many different data sources, and implementing an oracle system that isn’t controlled by a single entity, decentralised oracle networks have the potential to provide an increased level of security and fairness to smart contracts.
Multiple reputable, independent and publicly available online sources might exist outside the blockchain for a particular event — for example: ESPN, Yahoo, BBC and Sky Sports for resolving sports outcomes. Let’s say the event in question is an English Premier League game, and the outcome we’re interested in is whether the result was a Home Win, Away Win, or a Draw. Because the way in which these sources provide data is highly structured, it is possible to determine the “shape” of the information once the event has completed and been reported upon.
In this way, it’s possible to specify in advance (and commit publicly and transparently to a smart contract) where oracles should look for information, and how they can interpret this information once it is available. These specifications and interpretation rules are publicly available and can be checked by anyone at any time.
When it comes to the point in time when we expect a result to be available, the network can select some number of ‘oracles’ (these are just computers who serve the network) at random, and ask them to attempt to get this information and return a valid result, assuming the information is available from the specified source.
These nodes are rewarded for carrying out this service for the network, but are required to stake funds in order to attest to the result they provide. If an oracle is found to be providing inconsistent information, it is heavily penalised in a process known as “slashing” — where the funds they have staked are taken from them and they are not rewarded. This removes or reduces the economic incentive for oracle operators to defraud the network.
Because there is always a risk of change in independent source providers APIs and feeds, it is generally the case that a feed will require a majority (but not all) of the source results to agree. In our example above, if the ESPN feed returned an unexpected result or could not be interpreted, the feed would still provide a resolution value provided Yahoo, BBC and Sky’s results all agreed.
There are other technology based processes and safeguards to ensure that the oracles are remaining honest — for example, using cryptographic techniques like hashing to validate the correct source and parsing logic were used.
The combination of randomly selecting nodes, removing of economic incentives, technology based validations and requiring multiple independent third-party sources all come together to provide a robust mechanism to bring data on-chain for Aver in a way that is decentralised but reliable.
Oracles are more than just data feeds that connect smart contract networks such as Solana to valuable off-chain information. As well as responsively fetching external data and delivering it on-chain, they represent a filtration system that verifies the trustworthiness of such information — a critical role when external inputs trigger the automation of high-value transactions.