Oracle Use Cases and Examples

Oracles, ideally, provide a trustless (or at least near-trustless) way of getting extrinsic (i.e., “real-world” or off-chain) information, such as the results of football games, the price of gold, or truly random numbers, onto the Ethereum platform for smart contracts to use. They can also be used to relay data securely to DApp frontends directly. Oracles can therefore be thought of as a mechanism for bridging the gap between the off-chain world and smart contracts. Allowing smart contracts to enforce contractual relationships based on real-world events and data broadens their scope dramatically. However, this can also introduce external risks to Ethereum’s security model. Consider a “smart will” contract that distributes assets when a person dies. This is something frequently discussed in the smart contract space, and highlights the risks of a trusted oracle. If the inheritance amount controlled by such a contract is high enough, the incentive to hack the oracle and trigger distribution of assets before the owner dies is very high.

Note that some oracles provide data that is particular to a specific private data source, such as academic certificates or government IDs. The source of such data, such as a university or government department, is fully trusted, and the truth of the data is subjective (truth is only determined by appeal to the authority of the source). Such data cannot therefore be provided trustlessly—i.e., without trusting a source—as there is no independently verifiably objective truth. As such, we include these data sources in our definition of what counts as “oracles” because they also provide a data bridge for smart contracts. The data they provide generally takes the form of attestations, such as passports or records of achievement. Attestations will become a big part of the success of blockchain platforms in the future, particularly in relation to the related issues of verifying identity or reputation, so it is important to explore how they can be served by blockchain platforms.

Some more examples of data that might be provided by oracles include:

  • Random numbers/entropy from physical sources such as quantum/thermal processes: e.g., to fairly select a winner in a lottery smart contract

  • Parametric triggers indexed to natural hazards: e.g., triggering of catastrophe bond smart contracts, such as Richter scale measurements for an earthquake bond

  • Exchange rate data: e.g., for accurate pegging of cryptocurrencies to fiat currency

  • Capital markets data: e.g., pricing baskets of tokenized assets/securities

  • Benchmark reference data: e.g., incorporating interest rates into smart financial derivatives

  • Static/pseudostatic data: security identifiers, country codes, currency codes, etc.

  • Time and interval data: for event triggers grounded in precise time measurements

  • Weather data: e.g., insurance premium calculations based on weather forecasts

  • Political events: for prediction market resolution

  • Sporting events: for prediction market resolution and fantasy sports contracts

  • Geolocation data: e.g., as used in supply chain tracking

  • Damage verification: for insurance contracts

  • Events occurring on other blockchains: interoperability functions

  • Ether market price: e.g., for fiat gas price oracles

  • Flight statistics: e.g., as used by groups and clubs for flight ticket pooling

In the following sections, we will examine some of the ways oracles can be implemented, including basic oracle patterns, computation oracles, decentralized oracles, and oracle client implementations in Solidity.