Blockchain Oracles

Oracles are essential for the realization of the blockchain-based sharing economy. Yet, they are one of the least discussed components of blockchain systems. Here is our tribute to oracles, “smart-contracts’ little helpers”.

What an Oracle is [not]

Oracles, in the blockchain sense of the word, are an important part of the technological stack required for a wide variety of decentralized applications. They are a link between the physical universe and the virtual reality of blockchain platforms and an essential part of the promise of smart-contracts.

At the same time, oracles implementations do not get the required attention in a global community primarily focused on blockchain platforms and decentralized applications. There is still confusion about:

What an oracle is.

What services it can provide.

At what cost.

Perhaps part of the general confusion is created by the name itself — oracles.

When talking about oracles in the blockchain ecosystem, we are not referring to this:

and certainly not to this:

What we are in fact talking about are tools that allow blockchains to learn the outcome of an event. As such they make statements about something that happened in the past.

Oracles do not make predictions about the future. Oracles report.

A prediction market (PM) used to accumulate information about a future event can act as an oracle. In this case the PM can be used as a source of information about what the oracle can potentially report. For example, the PM can inform if the oracle’s more likely report is “Yes” (as opposed to “No”). However, the oracle will always only report on a fact*, in this case — the prediction market’s final outcome.

Why Do You Need an Oracle?

Access to feeds of information originating in the physical world is absolutely essential for the development of the decentralized economy.

All the applications running on a public blockchain require triggers in order to provide a service, usually in the form of an automated action. Some of these triggers could be coming from specific users — for example initiating a transaction or instructing a smart-contract. Others, however, rely on reports provided by oracles. There are generally two types of oracles —machines and users.

Sensors as Oracles

Machine oracles are sensors that generate and send digital information in a smart-contract-readable format.

For example, a sensor can detect that the outside temperature has reached a certain level consistently over the period of a month. This could indicate a drought in a certain geographical region. If the sensor’s (or sensors’) feed acts as an oracle, the information is provided to and recorded by a smart-contract.

Now imagine that the smart-contract is programmed so that if the answer to the question:

“Has temperature higher than 35 °C been reported everyday in a period of 30 consecutive days?”

is “Yes” then a certain amount of cryptocurrency is sent to an address(es). You guessed it, we are referring to the decentralized insurance use-case.

By having sensors reporting on events, we can automate a wide range of insurance-related actions, without the need of an intermediary. Sensors can of course act in tandem with user oracles. For example, after the sensor orcales have reported “Yes”, one or more user oracles need to confirm that the information is correct.

Decentralized insurance is not the only use-case that can make use of machine oracles. Here are some additional examples:

Supply chain management — containers or packages equipped with sensors can trigger smart-contract execution based on location.

— containers or packages equipped with sensors can trigger smart-contract execution based on location. Components life-cycle monitoring — triggering purchases of replacements before system failure.

— triggering purchases of replacements before system failure. Greenhouse emission purchases — automatic debit or credit of a company account based on greenhouse gas sensor readings (or any type of reading in an industrial installation). This relates to Emissions Trading Schemes established worldwide.

— automatic debit or credit of a company account based on greenhouse gas sensor readings (or any type of reading in an industrial installation). This relates to Emissions Trading Schemes established worldwide. High-pollution subsidies — citizens receiving subsidies from the government or a company for living in an area with over-the-norm pollution detected.

— citizens receiving subsidies from the government or a company for living in an area with over-the-norm pollution detected. Tollbooth payments — automatic payments for using public or private transportation infrastructure.

The list goes on and on, subject only to the limits of human imagination.

Artificial intelligence (AI) could also be utilized to improve the quality of machine oracles. Imagine AIs “mining” data available on the internet and providing it to oracle reports useful for various decentralized applications or required for settlement of disputes. AIs get paid in cryptocurrency in accordance with the quality and consistency of their information. AIs can then use the earnings to pay for their continued existence — hardware resources, access to more useful information, software improvements, etc.

This might sound like science fiction, but it is much closer to reality than many believe.

Users as Oracles

Thousands of people reporting on event outcomes and being rewarded in cryptocurrency or tokens. A simple, yet valuable task for smart-contracts.

While machine actions can be programmed and fine-tuned, humans require different types of stimulus. Much like in the case of AIs, however, humans can be incentivized to report good-quality information to the blockchain. The simplest form of award is again cryptocurrency, but there could be a wide range of other stimuli — reputation for instance.

Here is an example. Imagine that a person wants all of their crypto-wealth to be transferred to some of their relatives upon their death. In order for this to happen, there should be someone or some people who report that they have indeed died. Reporting in this case could be done by answering a simple question that only specific users receive (via an app, mail, wallet, etc).

In order for the oracle report to be considered valid and sent to the smart-contract, it needs to receive at least 5 out of 7 replies stating the same — either “Yes” or “No”. The people are answering the question may or may not get some of the crypto upon distribution. Once the condition is met, the oracle reports to the smart-contract and it creates a transaction to a single or multiple cryptocurrency/token addresses. The will of the deceased is fulfilled without an intermediary such as a notary.

In fact, this same smart-contract could be programmed to transfer ownership of any digital property, tokenized assets, loyalty points or gaming and virtual reality assets.

The definition of a “valid oracle response” could also be stretched to include various conditions. For example, the execution of the same contract mentioned above could depend on users who are not related to the deceased. 50 random users could be selected from a pool of thousands to reply to the question “Is [Person X] dead?”. If they can reach a consensus based on various sources of data of their choosing, a valid oracle report is generated and the smart-contract is executed.

The selection of users can be based on information they have selected to share — age, sex, location, marital status, quality of previous reports, number of previous reports, etc. It is also possible to make users stake a certain amount or valuable reputation or cryptocurrency/tokens which will be forfeited if they report incorrectly. On the other hand, the staked amount could be doubled or tripled if they report correctly.

Many brainstorming sessions could be dedicated to the function of oracles and the proper incentivization of their human (user) variation. It is almost certain that once user-friendly oracle implementations are available to non-technical users:

There will be an explosion of useful decentralized applications that empower millions worldwide.

Oracles today

The important role of oracles for the Blockchain 3.0 revolution has already been recognized by some experts in the space. Companies working on oracles include Augur, ChainLink and Oraclize. The former two are built on top of Ethereum and incorporate ERC20 tokens for their business models, while Oraclize acts like a third party that verifies the origin of information, but not the information itself.

Augur

A decentralized oracle and prediction market platform.

The Augur team have programmed complex smart-contracts on the Ethereum network that users can use to create markets and select oracles. The consensus building process for finalizing an oracle response is quite interesting and involves the staking of Augur’s native ERC20 token called REP (“reputation”). However, there are challenges and most of them are related to scalability.

Every market that is created using Augur software utilizes a smart-contract on its own. This means that if there are 1,000 markets, there will be 1,000 smart-contracts running on the Ethereum network only for the Augur use-case. This could create scalability issues. We have already witnessed the impact that CryptoKitties and popular token sales have had on Ethereum.

The various dispute resolution rounds (1) will require transactions of REP, which are more costly than ETH transactions. Keeping in mind that there are also limits to the duration of dispute rounds, the execution of REP transactions might be expensive during peak on-chain load-times and/or may fail to execute in time.

These issues relate to the fact that Augur introduces a consensus protocol on top of another consensus protocol — that of the Ethereum network. This makes the market consensus dependent on the blockchain consensus and creates inefficiencies that may jeopardize the business model of Augur’s oracles and prediction markets.

Despite these challenges, we are confident that Augur’s team will be able to create some of the most valuable oracle implementations in the blockchain space.

ChainLink

ChainLink is blockchain middleware that allows smart-contracts to access real-world data.

Unlike Augur, where all the load is put on the Ethereum network to handle, ChainLink (CL) makes use of dedicated nodes that take care of the load coming from ChainLink’s oracle services. In other words, CL uses an off-chain component to address the scalability issues that may arise during operation. Most probably due to these very same issues, it is the intention of CL’s team to modify the oracle nodes in order to make them compatible with smart-contract platforms other than Ethereum.

The scalability issues related to using on-chain oracles on Ethereum are identified by the CL team:

In permissionless blockchains with on-chain transaction fees such as Ethereum, if “n” [the number of oracle messages] is large, the costs can be prohibitive. A more cost-effective approach is to aggregate oracle responses off-chain and transmit a

single message to ChainLink’s smart-contract. (2)

A major consideration for ChainLink’s off-chain approach is the decentralization of nodes. Node operators must be properly incentivized to run nodes. The effectiveness of that incentive will depend on the size of possible rewards in LINK tokens as opposed to the costs of running a node (hardware, software and connectivity requirements), possible penalty payments and the number of LINK token transfers required (fees). Node operators are allowed to set the price for their oracle node services, so the question is — will their service be affordable for the user?

Again, æternity welcomes all community efforts to improve the design of blockchain oracles and the work of the ChainLink team will be essential in this respect.

Oraclize

Oraclize is a data carrier.

They provide a reliable connection between Web APIs and decentralized applications. The solution developed by Oraclize confirms that data fetched from the original data-source is genuine and untampered with. This is accomplished by accompanying the API data together with a document called authenticity proof (3). In this sense, decentralized application developers and users do not need to trust Oraclize as a intermediary. Oraclize provides two important services to smart-contracts:

Authentication that data originated from a specific source. Conversion of data so it could be read by a smart-contract [data formatting].

As such, Oraclize services could be provided to any decentralized applications platform featuring smart-contracts. In reality they are not creating oracles, but allowing for current information sources to act as such. Oraclize establishes an authentication layer that can actually be beneficial for all existing oracle services. Widespread usage will again depend on cost. Currently, Oraclize’s services are not prohibitively expensive.

æternity’s Approach to Oracles

At æternity we have also realized the fundamental importance of oracles for the future decentralized economy. We have therefore decided to make oracle services part of æternity’s core blockchain protocol. By doing this we are addressing three related concepts — scalability, data format and cost.

æternity provides a mechanism whereby oracle operators can register with the blockchain to answer queries directed at them. Smart-contracts pay to pose questions to an oracle and the fee compensates the oracle operator for interfacing with the outside world — to bring in data and forward it to the smart-contract.

There’s no limit to the kind of data that oracles can bring into the blockchain but it’s important to note that both queries and answers are posted to the blockchain and available for later access by smart-contracts.

How æternity’s Oracles Work

In æternity, an oracle is defined as an entity that exists on the blockchain and lives in the oracle state tree in a full node. As such:

smart-contract developers will be exempted from the need to manage a separate entity but will communicate with æternity blockchain directly.

An oracle is managed by an oracle operator who can create an oracle with an oracle register transaction on-chain. This transaction will register the account of the user as an oracle. One account-one oracle. It will also determine the required fee that users asking the oracle must pay. At first that will be a flat amount in AE tokens or “0”. (4)

Asking an oracle to report can be done by any user with an oracle query transaction on-chain. Scanning the blockchain, any oracle operator will be able to find out about existing oracle queries that are directed towards them. A reply is provided by the oracle response transaction on-chain. The oracle query object is modified by that transaction and closed, making the response permanently available on the blockchain and fully immutable.

æternity’s oracles also have published APIs that define the data format of queries, as well as the format of answers. As such, they allow for format flexibility enabling interaction with smart-contracts written in a variety of programming languages.

For a real-world example of how æternity’s oracles function, have a look at this document in GitHub.

Advantages of æternity’s Oracles

Incorporated inside the main chain.

No need to install anything apart from æternity’s full node software.

Immutability and open availability of all oracle replies*.

Cheap to create, query and reply to.

Flexible data formats for creation, query and replies.

As decentralized as the main æternity chain.

It is important to note that:

Oracle operators are not required to post a bond and the reliability or truthfulness of oracle replies is not guaranteed.

The assumption here is that users will write smart-contracts that rely on reports from a large number of oracles before being triggered. A consensus protocol or a reputation system can be incorporated in the future to address this. It is essential to:

First identify the actual problems, if any, associated with the current oracle setup after Mainnet launch.

Start to make assumptions about the actions required to address them.

In this process, we will be relying on the experience generated by the oracle experts from Augur, ChainLink and Oraclize.

Conclusion

With its unique approach to oracles, æternity will make it significantly more convenient for developers and users to create and use decentralized applications based on smart-contracts. This, in combination with æternity’s focus on user-friendly mobile applications, could start an era of decentralized data verification and allow millions globally to make use of an additional source of income. We believe that:

æternity’s oracles will be the foundation of a global sharing economy built on scalable blockchain technology.

Interested in æternity? Get in touch:

GitHub | Forum | Reddit | Telegram | Twitter | Facebook | Mail