Using Realitio: The crowd-sourced smart contract oracle
EDCON 2019 · 12 Apr 2019 · 12:16
Edmund Edgar explains how Realitio supplies human-generated answers to smart contracts through an escalating bond game. Respondents stake ether, challenges double the bond and reset a timeout, and an arbitrator can settle disputes. He shows contract integration and discusses question design, blockchain availability and applications such as milestone funding and insurance.
Speakers
Topics
From EDCON 2019, hosted by EDCON.
Transcript
thank you so much sniffing it's always great to hear about what's luck it's up to next and finally not last but not [ __ ] not least we have edwin edgar from reality to reality oh which i've asked twice and still messed up hi okay so i'm going to go through this some kind of fast cuz i don't want to cut into everybody's drinking time but i've got a URL at the end that'll give you some more information so i'm going to talk about reality oh we call it Snopes meets Mechanical Turk on meth this is okay we built an Oracle service right back in about 2013 called reality keys I think this was the first smart contract Oracle
in the known universe and we learnt a bunch of things and we've used that information to build our new thing reality Oh which is purely on it on ethereum one of the things that we found was that we've assumed when we started making a smart contract Oracle the what people mostly needed was was sort of getting stuff from websites that the requested websites that had the information that you'd mostly need and we just had to find a way to get that information to the rock chain and that's something that Oracle eyes and chain link and those guys are doing a really great job of right now but the problem that we're now focusing on is if you want to get kind of unstructured human generated data right so if you if your
contract needs some information and there isn't some crusted website that you can use for it often you actually have to get humans to create that information for you so I guess most people here probably familiar with the Oracle problem if you've got a contract the bunch of things that it might want to do the the canonical case is kind of prediction markets and bets if you want a bet about who won this game you you can make a smart contract that will handle that bet really well but it needs to somehow know who won the game right it needs some kind of source of information around the outside world so if you want to do you know insurance on the blockchain if I want to insure against with my office burns down then the blockchain needs to know somehow
your contract needs to know did the office burn down a use case I'd really like to see we've had a lot of people doing kind of icy OHS and things where there's this mortal where you people throw a load of money at developers and then they trust that those developers are gonna going to build the thing and and once those developers have got this pile of money they're not necessarily I incentivize the way you'd like them to be so it'd be much better if you could send that money to a contract and then only unlock that money if they hit the milestones but if you want to do that you need to know okay did they hit the milestones or what was a contract hack that's not that you know really useful thing that you could have and we've just found that this huge long tail of of
information that people need that they can't get from websites so this is what we were kind of trying to design for we want to handle any question with kind of a publicly available answer right any question that people actually know the answer to we want it to be fast in the typical case we want to be cheap to use and where there are some expensive parts that are kind of inevitably expensive we want that funded by kind of liars and idiots and we don't want the people we want encouraging to encourage to use the the platform and put answers insert to have to pay for that and we also don't want the people needing information to pay for that so I'll talk to you in a second about how that works we want low gas usage I kind of find feel icky when
I do something that's more than 100,000 gas so we tried to keep below that for any action in the system and no funny tokens it's all Eva so we want this to be as easy as possible for contract developers to use and for you know if adapt users to use and they've definitely got ether for gas so we're just going to do anything so this is what we built there's a fairly simple economic game behind this what's going to happen is that anybody can put in a question when you put in a question if you want to you can put up a reward for answering the question you don't have to anybody can then answer that question but when they do they have to post a bond posting your bond sets a countdown clock ticking if that ticks
down to zero then that's your final answer in it and it's done but in the meantime somebody can look at that answer and say that's wrong they can change the answer but when they've changed the answer they've got to double the bond so you can imagine this is going to escalate pretty quickly each time you get a new one so you reset the clock so there are people so this time for people to check it and then once a count counts down to zero that's your final answer and whoever gave that Lance last answer or whoever gave the correct answer is gonna get paid and the people who gave the wrong answer are going to lose their money now you may be thinking okay what happens if you know Joe from consensus shows up and puts in some huge pile of ether on a wrong answer so we
then have a backstop which we call the arbitrator contract so at any point anybody can pay a fee to that arbitrator contract to request settlement of the question paying that arbitrator freezes the question until you get a report from from the contract it's generally gonna cost a lot of money to get this arbitration and and the point here is that we want the means of arbitration which I'll talk about in a second to be things that can be very slow and very expensive expensive both in terms of money sometimes you want to use actual resources to investigate something and also in terms of sometimes social process so a lot of the best processes for getting answers in a distributed way
require a lot of people to pay attention to something so it costs a lot of money but we don't want normal users to actually have to end up out of pocket so if you're honest what you can do is you can keep on raising the bond if somebody's put in the wrong answer you can keep on raising the bond until it's let's say you know ten thousand dollars and at that point you can then pay let's say your your $5,000 fee to the arbitrator and then when they will win in your favor you're gonna collect the bond and take the money and make a profit so the approaches that actually work right now for arbitration are something like these these so anybody can make these arbitrator contracts so anybody can just put in a new approach but the stuff that we've got in practice
so klaris is kind of a distributed court system it's not necessarily fast not necessarily cheap but it's a decentralized system for for getting answers and the guys at kleros have built and are just doing final testing on an arbitrator connector that will allow you to escalate these things to kleros you can use augur as the backstop now you may think okay why not ask orga directly augur is very is is an awesome system but it's kind of optimized for settling their own market it's not really optimized for getting information for other people for other people's contracts now we've built this connector that allows you to to settle something
by by creating a market on augur and watching it resolve the developers or get some of them get kind of mad at me for doing this if you parasite off augur then you kind of mess with the economics that that augur is relying on and I wrote a medium post the other day called the parasite in the whale about this whole problem with parasites so if you're interested I'll give you a link to that at the end what nosis are doing is kind of cool so they've got a stakeholder down system that is going to manage upgrades to their contracts what they're gonna do is use that down as the arbitrator so like I say in the vast majority of cases you'll settle with this escalation game but as the backstop
if you end up needing arbitration you can take it to their Dow there's an approach called subject to rock recei which I spoke about at a previous Def Con which kind of messing around with I totally love it as a concept but um but we're still working on it I'll give you a link to that previous talk and you can use trusted for parties now obviously that's not what we're about in aetherium generally speaking it's not something that we want to do but it's off in a practical way to do it given that all of the other approaches although you know org is going pretty well but it's all experimental and we don't really know and we also know it all has kind of security bounds where there are certainly situations where all of these trustless approaches will will break so let me just say a little bit
about using it in practice I'll kind of skip through these but the the main thing you want to do if you go to the DAP and you put in a question you get the ID from the question and then you can set up a contract using that ID and you can just call it like this get final answer passing the question ID and that will give you 32 bytes back with your answer or it'll revert if the if there was something wrong with the if I haven't been finalized or it didn't exist you may want to ask the question using your contract so you can do that like this we're passing in a template ID the question text the arbitrator and the the challenge timeout period and a couple of things I won't bother bother you with sometimes you want to wait
until something happens and then get the information so if I want to say did my office burn down I could make a contract I could make a Condon surance contract that says did I did it burn down in 2019 and then wait till the end of 2019 to claim but if I want if it burns down tomorrow then I want to claim you know the day after tomorrow so what you can do is make your contract so that the user puts in whoever's claiming puts in the question and then they pass the ID to your contract and your contract calls out to reality oh and just checks that it's a question for the quest the the question content that you're expecting that it has a reasonable arbitrator that you think is is good that the challenge
timeout is long enough and that the bond is is high enough to trust that information I'll just skip through formatting questions if you're interested in this you can maybe yeah I checked that in the in documents later and I should say just a little bit about things that won't work so we rely on the blockchain being available and this is true also of a lot of kind of second layer systems if somebody is able to do s the the blockchain up to your time out then that's not gonna work we need a certain amount of precision in the in the questions so since the way you correct a wrong answer is by putting in the right answer if you're not at least 50 percent confident that any of the
answers are correct then you may be reluctant to correct something there are certain kinds of trixie questions that also cause trouble with org are also for example if you put a URL in the question and then you control that URL then you can you know change what's at that URL during that well people are playing the escalation guy so that kind of stuff there are just kind of bad questions that can mess things up I've been pitching this to you guys since your developers mostly as a thing for contracts to use but it can be usable just purely by humans we've got this really interesting way of getting information out of people using this escalation game backstop by all kinds of you know amazing things that are happening now in aetherium so it is
potentially something that can address stuff like fake news and these kind of topical information issues okay so that's all I'm gonna say today but if you're interested I've put up a URL with a bunch of resources this has got it so reality o /e d con so that's got some links to some of the things that I mentioned like subject of accuracy or fork anomic s-- and also my piece on on parasites and also it's got a link to our just discord channel so if she were interested or you thinking about building something using this please jump on our on our district on our discord channel and just say hi and tell us what you're thinking of building okay I hope that helps you and I can't wait to see what people make
with it