Cryptocurrencies are a fast-growing field that suddenly attracted people from a variety of professions: finance, mathematics, economics, theoretical and applied computer science, cryptography, etc. Each one of those have brought in their vocabulary and buzzwords with them. With so many buzzwords being thrown around daily it is sometimes very hard even for professionals to understand what is going on. Today we’ll demystify one more buzzword: oracle.
So what is a blockchain oracle, what is it useful for, and what types of oracles exist?
Table Of Contents
- Blockchain Oracle Definition
- Usage of Oracles in Smart Contracts
- Types of Oracles
- MakerDAO Price Oracle
- Augur oracles for decentralized prediction markets
- Chainlink decentralized oracles
Blockchain Oracle Definition
The term oracle in the context of blockchains has first been popularized by the Ethereum crowd when they started talking about using real-world data inside smart contracts. When you analyze a smart contract system you think about it as of a cryptographic protocol, and thus professionals tend to rely on cryptography vocabulary.
In cryptography, an oracle, or an oracle machine, is a term used to describe an abstract black box service that simply performs its job, and you don’t think about how it works. For example, when you transfer some $ETH to your Binance deposit address you don’t really care where the gas price is coming from. From your point of view, you could say that the gas price is being provided to you by an oracle.
Usage of Oracles in Smart Contracts
In the current meaning within the cryptocurrency industry, an oracle is a service that supplies some real world data onto the blockchain so that smart contracts can query this information. As you may already know, the whole point of a blockchain is that it knows everything about itself: how many blocks were mined, who mined them, all balances, all transfers, all transactions, when they happened and in what order. However, the blockchain knows nothing about the outside world: what’s the weather like today, who is the president of the United States, what is the price of bitcoin, who won the Champions League. If you want to use this information inside a smart contract you need to figure out a way to put this information onto the chain, and that’s where the oracles come in.
Want to make your own Oracles? Check out our Ethereum Dapp Kit!
Types of Oracles
The simplest type of oracle is an admin oracle. This is simply one person, or more correctly one private key, controlling the value. For example, if I had a blockchain-connected IoT system for watering my plants, I could be the admin of the weather oracle. Every hour or so I would measure the temperature outside and send this information to a smart contract.
The downside of this approach is that while I do trust myself, it would not be wise for e.g. an insurance company to rely on my oracle. I may stop caring about it and stop updating the information, or I might start lying about the information that I provide if there is money at stake.
Thus, various teams and developers have set out to create more robust oracle systems that can be used in financial applications, that can be trusted to handle billions of dollars honestly. Let’s cover some of the most famous oracles currently running on Ethereum chain.
MakerDAO Price Oracle
Arguably one of the most important oracles in the whole blockchain world that’s currently running is the MakerDAO ETHUSD price oracle. While the MKR/DAI token pair, and the whole CDP loan system is fully decentralized, at the end of the day it does have an Achilles’ heel - the system relies on an oracle that can supply accurate ETHUSD price information. As of writing this article, this oracle is responsible for the robustness of the whole #DeFi ecosystem on Ethereum (~$500 million USD), as well as for the market caps of both MKR (~$600 million USD) and DAI(~$80 million USD).
With so much on the line, how do they take care of the oracle’s robustness? The creators of this oracle, the MakerDAO team, have utilized a multi-tiered approach to this oracle’s security.
The first layer of data is the price feeds. As of writing this article, the MakerDAO system has 14 independent price feeds, controlled by 14 individuals and/or corporations. These feeds supply the data into a medianizer smart contract, that takes prices from all 14 sources and takes the median of the prices. This way as long as more than 50% of the oracles are providing correct price data the system stays secure (so up to 6 oracles can be compromised or collude and they will not be able to change the final oracle data).
These oracles can be voted in and voted out by the MKR holders and have a delay of one hour. There are people monitoring oracle prices 24/7, and in case an oracle gets compromised it can be quickly voted out and replaced.
Augur oracles for decentralized prediction markets
MakerDAO had the luxury of having a well defined problem for which they need an oracle - the ETHUSD price. But what if one wants to create a decentralized prediction markets platform for events like football games and political events?
Augur is the project that set out to solve this problem, and their token REP commands a ~$130 million USD market cap as of writing this article. What is their solution to the oracle problem?
Augur is a very complicated system, so if you want to find out all the little details of it you should look at their whitepaper. For a high level understanding let’s review a simple case of using Augur.
- Anyone can create a market. Essentially, this is like asking a question that can be either a multiple choice question or, for the sake of simplicity, a binary question. For example, Will 1 BTC be worth more than 1,000,000 USD by end of day December, 31st 2020.
- Until the market ends (December 31st, 2020), anybody on Earth can bet on either “yes, it will be worth more” or “no, it won’t be worth as much”.
- When the market ends the person who created a market will act as the oracle for it.
- If they provide the truthful answer there is nothing that needs to be done. Simply wait until the dispute period is over (3-10 days) and collect your payout.
- If they provide a wrong answer, or somebody disagrees about a technicality (e.g. there was no timezone specified, so which price over a 24 hour period should the oracle pick?), a dispute gets opened and that’s where the $REP tokens come into play.
REP token holders act as judges in this case and they vote on which outcome they think is the right one, and the majority decides on which outcome the system will think is correct. Those who have voted for the correct outcome get a financial reward, those who voted for the wrong answer do not. This financial incentive for every vote, combined with “Augur is working and trustworthy = REP price goes up”, is what secures the Augur decentralized oracle.
To summarize, in Augur whoever created the market acts as the oracle, and the REP token holders act as judges in a court - they review disputes and make sure that oracles do not lie.
Chainlink decentralized oracles
For the majority of its lifetime, $LINK has been a meme token hyped exclusively by 4chan. Google link marines if you want to discover the memes associated with the token. However, this year the organization behind the Chainlink ICO and the $LINK token has shipped a big update and started aggressively marketing and signing up partners. LINK has definitely been one of the money making tokens this year and a lot of people have now heard about it. But what does it do?
Chainlink provides smart contract developers with a way to query for a variety of pre-approved data sources (and developers can request more to be added by contacting Chainlink team). Instead of simply relying on the Chainlink organization to provide the data, which would simply be a centralized oracle as discussed earlier in this article, Chainlink instead aggregates data feeds from many sources and many data feeds into one answer, similar to the MakerDAO system.
Unlike MakerDAO system, however, where oracles are providing their services for free presumably because they hold a lot of MKR whose price depends on the oracle working reliably, Chainlink requires data feed owners to stake LINK tokens in order to participate, and provide data feed owners with a monetization channel. Those who request fresh data from Chainlink need to pay some LINK that gets distributed among data feed owners, and misbehaving oracles get their staked LINK deducted as penalty.
This way, just like multisig wallets are safer for holding your crypto, similarly using Chainlink is safer than using a centralized oracle for your application. However, unlike the wallet example where you decide who owns the signatures required to unlock the wallet, if you are a user of Chainlink you rely on their organization and their community to hold these signatures. Hence you see the partnerships being announced, as Chainlink-the-company seeks to find trustworthy data feed owners. It remains to be seen if the economic incentive + whatever legal clauses Chainlink might have in their contracts end up bootstrapping a secure network of decentralized oracles.
Maybe one day Maker and Augur switch to using Chainlink? Allowing developers to easily deploy their own blockchain oracles and manage them, is a problem we are currently aiming to tackle with the upcoming release of our dApp development kit.
Support Team Saturn continue developing: