The blockchain is a decentralized database whose data can be trusted because it is the sum of other previously recorded transactions. That data can then be used as an input for all sort of transactions (called smart contracts).
Yet, one of the challenges is that there is actually not a lot of physical data on the blockchain. The way around this is to use trusted third parties called Oracles which are expected to speak the truth. Their job is to capture “real world” knowledge and store it on the blockchain. That data becomes immutable and part of the long chain of transactions.
An obviously financial example is stock prices. In order to write a smart contract which would rebalance a portfolio, one would have to use an oracle to capture the stock prices of assets in that portfolio.
Some people expect that oracle will eventually becomes obsolete in a world where all possible data sources are available “natively” on the blockchain. For example, if stocks where actually traded on the blockchain, then the price data itself is in the blockchain and the rebalancing algorithm does not need to use and rely on a 3rd party oracle.
Can we go without oracles?
If we’ve crossed path in the last couple weeks, you know that I am researching the blockchain these days. (but no, I am not doing an ICO!). As part of this work, and I wanted to see if we could actually not rely on oracles, but rely only the participants good behavior and their ability to form a consensus with the right incentive. Staking is one of the key concepts of the blockchain world and I think this solves our problem here.
The Smart Contract
Let’s take a simple example: we want to write a smart contract which lets an arbitrary number of people bet on an outcome. For the sake of simplicity, we use only binary draws (the thing people bet on actually happens or does not).
In the “traditional” smart contract, participants would be asked to bet on whether the statement is true or false and their bet would be placed in a shared wallet. The oracle would then deliver the truth and all the participants who bet on the right outcome should be able to withdraw their share of the shared walled.
If we did not want to rely on a 3rd party oracle, we would have to ask the participants themselves to contribute the truth, before the payout can happen. Our smart contract would then have 3 phases:
- Betting phase
- Consensus formation phase
- Payout phase
Unfortunately for mankind, we have to assume malice: some participants will lie and submit lies as truth.
One way to prevent this is by requiring a “stake”. The smart contract only allows people to place bets if they are staking an amount larger than their bet along with the bet to show their intent to contribute truth.
Once the event has been realized, all players are asked to contribute its outcome if they want their stake to be returned to them. If they don’t, then their stake is lost. Participants do this by voting on what is the actual outcome. Once enough participants have voted, the truth is determined by seeing which proposition got more “votes” compared to it share of bets (not necessarily the majority).
All the players who have placed a bet on the right value have a strong incentive to vote: not only would they get the stake back, but also their share of the jackpot.
Players who have placed the wrong bet, on the other end, also have an incentive to vote on the right value because they would get their stake back. If they did not, not only would they have lost the bet, but they would also lose their stake. If all the losers where cheaters, then they could, in theory, break the smart contract, but if only a single one of them is indeed a fair participant, then all the losers but this one would lose their stake. This is a typical prisoner’s dilemma which lets us expect that most losers would not try to lie in order to not worsen their situation.
In order to clarify things, let’s take an example: people have been asked whether this story will get strictly more than 100 reads before November 5th 2017. They are each asked to bet $1 on what they think is the most likely outcome and they are also asked to stake $2 to come and contribute the truth after November 5th. Betting is only open before that post goes public (I shared the draft with players).
At the publishing time, 65 people said that yes this story is good enough to get 100 reads and 35 people placed the bet that it would not. We have a pot of $100 which will be shared among winners.
Time passes and we are eventually on November 5th. Unfortunately (I am biased), this story did not get the 100 reads it deserves. Each participant is asked to contribute to the truth. Out of the 35 people who placed the right bet, 34 contributed the truth (the last one forgot about the bet and the story!). Most of the 65 people who placed the wrong bet were honest (or too scared that their fellow losers were more honest than them) so 50 of them contributed the truth. 13 of them did not bother to vote as they were too disappointed and did not care much about their stake and 2 cheaters lied.
The voting is pretty clear: 85 (97% of votes) people claimed that the story did not get its 100 claps, while only 35% of bets where for that proposition. Consensus was formed and these 85 people got their stake back. The winers also each get $2.8 payout.
In my mind, decentralized staking is one of the most important elements of the blockchains economies and incentives. In this example, we can encourage (enforce?) good behavior and actually turn each participant into an oracle, eventually removing the need to share and trust a third party.
One of the benefits of removing 3rd party oracle is to also reduce the cost to operate such a contract: there is no need to pay for that oracle. In the example above, 100% of the bets are passed down to the winning participants. The house could very well use the lost stakes as its payment for operating the contract.
Additionally, this “framework” can also be incremented with many other aspects. For example, one could add the ability to trade bets by adding a “cooling” period between the betting period and the consensus formation period where participants can trade their votes (and cash out early or minimize risk exposure…).