#DappCon22 : Day 2 - Making People Tell Your Contract The Truth, Edmund Edgar

DappCon 2022 · September 2022 · 21:32

Edmund Edgar, co-founder of the Kleros arbitration protocol, discusses getting smart contracts to reliably learn the truth about real-world events at DappCon 2022. The talk covers oracle design and decentralized dispute resolution as ways to bring off-chain facts on-chain without a single trusted party.

Speakers

Topics

From DappCon 2022, hosted by Dappcon Berlin.

Transcript

so please welcome to the stage Edmund Edgar from reality eth [Applause] good morning thanks for coming in on this filthy morning Berlin um since it's dapcon I want to talk mainly about stuff that we've built stuff that we shipped um stuff that you can use right now to make your doubts better and then if I've got some time at the end I want to talk a little bit just to do a little bit of kind of conceptual stuff and then talk a little bit about what I think is quite an important thing that we're trying to build next um so I'll just say a little bit about myself if I can make the slide go [Music] turn it on my help

okay so back in about 2013 um I was reading about um smart contracts and the the Oracle problem on bitcoin talk but there were no oracles so I built what was the first um smart contract Oracle reality keys um and back then I kind of saw the problem like a lot of people some people still do as like how do we kind of Bridge to apis and websites like how do we get trusted information that we already have on the internet somewhere and how do we get that to the blockchain and there are a lot of really good projects now that deal with that problem um but I also saw the um a lot of the most interesting use cases involve actually creating

information right we need to actually get people we need to get information from humans we need to be able to ask questions and get people to give us the right answer um so that's what um this project is is all about so this is reality eth um we've got our own dap front end but a lot of the apps that use it um have their own front ends for um for the way they use it talking to our contracts um what we're trying to do here we want to be able to handle any question with like a publicly available answer right any so anything that humans out there know um we do it just with the blockchain there's no ipfs for reasons that I will explain um it's deployed all over the place it's on mainnet it's used a lot on gnosis

chain it's also on arbitrum optimism um pretty much any free software um team will put it on we're not doing start net because that's proprietary but pretty much everything else it's designed for fairly low gas usage um so you we reckon you shouldn't have to take more than like a hundred thousand gas for anything uh there's no admin Keys there's no governance there's no token it's a contract um and it's cheap to use um and where we do have to make some humans do some work where we have to actually create some costs for somebody the idea is that we want liars and idiots to fund that that process so let me tell you a bit How We Do It um so it's based on a fairly simple economic game

um anybody can ask a question and when you ask a question you can put up a reward if you want to for the answer to that question but most of the time we find that people don't need to do that when you answer you post a bond that then sets a clock ticking so this is something that you decide when you set up the question how long it's going to be so usually 24 hours something like that um and then in the happy case probably about 98 of cases or 1999 of cases um the first human to answer the question is honest and correct um so what's going to happen is the clock's just going to start ticking say it was 24 hours and in 24 hours it's finalized and then that's the the final answer

um but in some cases somebody may see that they've put in an incorrect answer and what they can do is they can change it to what they think the answer should be um but when they do that they have to double the bond and doing that is going to set the clock ticking again goes back to zero um and then that can carry on as long as you like so in theory you can keep on extending and extending extending the time but every time you do this you're doubling the bond um so fairly quickly we're going to get to the point where you know no people are going to have more money than they're going to want to put into the system um so in you know of the cases where something's contested the the vast majority are going to end like this um the clock's going to kick kicked down

again nobody's going to challenge and that's the final answer um but you're probably looking at this and thinking okay but then the person with most money is just gonna be considered correct and they're gonna win all the previous bonds um so we so we then go to the arbitrator contract um and this is designed with kind of the sort of a money Legos approach um so you can plug in whatever mechanism you want to do arbitration um the most common one right now as I'll mention is claros which is a really nice fit we kind of Internet an internet court system um but anyway what happens here is that you're gonna um pay a fairly expensive fee to request settlement um when you pay that fee that freezes the question and we then wait for the arbitrator to rule right

um so the thing about the arbitrator is this can be a really expensive process it can be a slow process and it can be kind of a socially expensive process right it can be a lot of involve a lot of people coordinating um now we are seeing some cases recently where people do do the thing successfully without an arbitrator um especially when if they're using their own token for the bond and they're trying to get a decision on something like um how did this snapshot vote go because a lot of the time recently we're seeing this used in governance um there's a very nice sort of gnosis um snapshot integration uh with uh with gnosis safe um and so so some of the time if you're just trying to get effectively a majority vote of your own token holders

then you can assume that um if you're just trying to to see what your token holders voted on an off-chain system then probably half of the once you've got like the maximum Bond you can get is going to be half of those tokens and that present represents the the Judgment of java controller um so in that situation people aren't using an arbitrator but most of the time you do um so how do we do arbitration there's a bunch of ways um you could use trusted third parties I mean there's a lot of stuff being used out there that you know that does um if you've got a token or a dow you can have them vote again very socially expensive processor a slow process but that's okay because it's only used in these very exp very exceptional cases um and then what we're seeing

um you know really used a lot so for example Omen um prediction Market was using this and a lot of um a lot of daps right now are using this is is reality plus claros using cleros for arbitration um and clairos have this little adapter which means that even on a chain where clairos doesn't where that you don't actually have cleros even when you don't have the clariss arbitration system on the same chain that you're that you're operating on um we can still switch over to the main chain to pay clearos and then send a message back to whatever chain you're on um to get the judgment and again that's an annoying thing to have to do to switch the chain but it doesn't matter because it's hardly ever done it's only done an exceptional circumstances if everyone was kind of kind of rational

and self-interested and wise I mean they're not they're stupid but if everybody was knew what they were doing then this would never happen right um game theoretically you should never even need to call the arbitrator as long as they're there um but in practice it happens occasionally um and then finally I'll talk a little bit about the end about the thing we're building with kind of a forkable layer too um so I'm just gonna go back to nuts and bolts a little bit um and talk about how you actually actually ask a question so you can put your question into the DAP um if you want to that's one way to do it or you can send it from your contract and when you have your contract do it you're going to pass in the template ID I'll talk about that in a sec um some text

um the auto trader address the timeout period for how long it's going to take after somebody gives an answer for that somebody can can test it before it's finalized and then a couple of other things like the minimum bonds and stuff that you sometimes want um then you want the answer when then when your contract wants the answer it can call one of these two methods against it um so result four is the simple one um this is gonna if the if the question hasn't been finalized yet then it's just going to revert and do nothing um but if it's been finalized then it'll give you the correct answer um and and then what we added recently result for once settled um this does something similar but sometimes you don't know when a question

is going to be settled right so let's say you you might be doing a sponsored walk and you're saying okay did I complete the sponsored walk because if I completed it you want to be paying me the money um and maybe it rained on that weekend and the thing got put off for a week um you don't want to just have to close the whole thing down um so what we've done is we've we've built a thing where you can answer that this hasn't been settled yet and we'll reopen the question and all of that is handled inside the reality youth contract so all your contract has to do is just to know that it has to call result result for one settled um and if it's not ready to answer that yet then it's just going to revert and if it's answered then it's going to give

you the answer okay I'll just say a very little bit about how these questions are formatted let's give me a sec so a question in our world is this kind of chunk of Json um looks like this you've got a title with some text um you've got like a type of question like a yes no question or it could be a bunch of options um for a multiple choice question you may have a category into a language and some other stuff um it's separated into into templates and parameters so um the most common thing you do is um you've got a um kind of some built-in templates like this um so you've got most of the text is in this kind of pre-registered um little document and then you've got some placeholders so you just pass in

text that's going to fit into those placeholders so let's say we're doing an insurance thing we want to ask was this fly on this date delayed by more than three hours um you'd pass that um that text text in so the the initial setup would do this bit and then every time you ask a question you do something like that um but that's still a little bit kind of wasteful we're using a little bit more gas than we need um so instead we can do it this way um you can create a template yourself um so if it's life insurance we're asking the same question over and over again except for a couple of little things that are different just the flight number and the date um so you can just call this once to create your template and then every every time you want to um to ask a

question you can pass in the flight number and a little separated character and then the the date and then that'll do it for you Okay so we're dealing with humans so there's a lot of ways they're going to screw it up um the the first problem is we need to have an available blockchain right we have a liveness assumption generally so so if you said that you can contest an answer within 24 hours then the blockchain has got to be available within you know during that 24 hours um which is normally not a problem with with ethereum or no says chain or these kind of kind of regular layer one type systems but it could be a problem with some layer two systems they don't always have that uh that promise so you need to work out to watch for that um if there's a lot of ambiguity in in

the question that can kind of mess things up uh humans will come up with kind of kind of tricky questions um you need you need the information about the question to be available so uh earlier I said there's no ipfs involved in this um there are some situations where you might be able to ask a question and then um withhold the and just put in the ipfs hash um and then withhold the content of the ipfs document um and then and then put in an answer and nobody can test that I can contest that answer there are some City situations where that's kind of safe to do depending how you're using it other times where it's not so I don't know we prefer just not to do it but finally of course we need the arbitrator to be uh to be secure um so like I say we we've had a a lot of

people using um using cleros which is a very nicely built um fairly robust system um we had a a question that was escalated to claros about who won the U.S presidential election um we had some people who thought it was Biden and some people who thought it was not clear um several I think correctly managed to resolve that one um and so so so so I think everything I've set up until now is all about kind of how you use the thing um what I'm going to say now is a little bit conceptual and then a little bit about the thing that we're trying to build which I kind of think is important and I'm looking for people to kind of collaborate with on this

um so the the basic kind of models that underpin um most blockchain systems um and a lot of systems built on on top of blockchains I guess we can kind of think of these sort of types so you can have sort of purely economic systems kind of basic sort of you know majority vote types of systems which is the a lot of down governance right now right a lot of Dow governance is you've got a bunch of token holders and 51 of them can decide what's done with uh what the Dow does um a slightly more sophisticated thing you can try to do is to add shelling games so was also kind of what um Bitcoin does and what ethereum does

um and also what cleveros does where where you're um you're trying to re to replace the assumption that you have um 51 of economic power being honest um you can improve that assumption and say that 51 of the um economic power has to be honest and not cooperating and not collaborating with each other right so um it's okay if you have a majority of like selfish profit-oriented uh people as long as they're not all collaborating with each other to be selfish um but the really firm underpinning of ethereum and Bitcoin and you know a lot of these systems is social um what Vitality called um subjective Democratic um so we've been discussing this recently in the ethereum context talking

about what happens if stakers starts a censor um the stake right so it starts a censor blocks um so we're saying we've got like like um Kraken and coinbase and these guys seem to have a lot of staking power um and potentially they could be you know regulated enforced to apply like ofax sanctions or something um um what we do in that situation is we would go to the um the subjective layer we go to the social layer um we thought the blockchain effective into two we would make a new version on which um you know say coinbase or whoever it was um whoever is censoring the blockchain those guys are going to get get slashed and then we're going to have like an open version

um where where they're going to presumably or they may continue to buy an open version oh sorry we're gonna have an open version uh with the slashing and then we're gonna have like the ofak version without without the slashing um and then we can just see what the market wants to do and the thing about this is um firstly we hope that the market will favor the open version right um but they may not and even if they don't even if most of the market cap goes to the ofak version and like the ticker most people consider ethereum to be the ofax ethereum and open ethereum is like the free ethereum is just some weird like Niche Anarchist thing at least we still have our working blockchain in that situation right um so so what we'd really like to do in

this situation where we're trying to arbitrate um truth is we'd like to Fork ethereum right we'd like our underlying blockchain to be able to fork and say um this arbitrator made a an uh um a decision that was bad this arbitration has been captured therefore we're going to remove that arbitrator and any questions they've arbitrated we're going to just put back into a pool for another arbitrator to handle now we can't Fork ethereum uh over this but what we can do is we can make a layer 2 Ledger and we can Fork that um so that's what we're working on right now is we want to take something like zks Inc um probably ZK sync but a layer 2 system um make a clone of that system and then

in if you build if you issue a token on top of this Ledger or if you um if you have like a dow if you have governance on top of this Ledger it can always resort to this ultimate kind of root of Truth um people like if anything is captured we can always talk that ledger and carry on with an honest Ledger and and hopefully that honest Ledger will also be the one with any other valuable assets on it okay so um so that was what I'm working on um there's more information on the uh on the site at reality.eth uh with your favorite Gateway East limo whatever you like um I'm Edmund Edgar on Twitter I

basically live on Twitter um so if you've got you know any questions anything I can help with trying to use that system um or if you're interested in in the thing about the the subject subjective Ledger and you'd be interested in collaborating on that uh you know please uh please give me a shout okay I think so thank you Edmund [Applause] can I ask the first question because I have the mic how do you incentivize people to come and and participate on this like as a user what's my incentive to come and so the um ultimately the incentive is that if you put in a book if you correct something that's incorrect then um then you can make money that's that's the main reason to do it um but what happens and if you're trying

to get a question answered in the first place and once there's a bond in there there's an incentive for somebody if it's incorrect to correct it um but right at the beginning we have the the reward that you get um if you need to put that in now we find that most of the time um the people who are using this are actually interested parties right so people have got something that they want to settle so usually the person who's um you know who's finished the sponsored walk and they want to um to get that that money moving um usually they will put in the correct answer and then nobody else will challenge um but if you want to you can use it as this kind of general purpose fact checking system where you want to know something so you put in the money and uh

and you get the answer fair enough any other questions there is one over there uh yeah so is there any validation on the questions themselves because uh how how do you avoid uh to people to turn into something like an assassination Market yeah so um it's an open blockchain and it's got composable Parts um we this is this system since it has no governance this system cannot govern

what kind of questions people ask right um and and even I mean I mean even in in the assassination case the the problem in trying to even if you like made it down tried to regulate this the problem in doing it um is that you don't actually know what people are using information for right um so if you want to know if somebody died it may be because they've got a perfect legal Insurance life insurance contract right you you know you don't know um now the arbitrator may have some terms about what kind of question that they will arbitrate so I think I can't remember but I think that clairos has some kind of Ethics um rules about you know certain kinds of questions that they will not do um so It ultimately comes down to that

and when when you're playing the realities game you're effectively like betting on what the arbitrator would do so if the arbitrator is saying um you know we're not going to answer questions about rabbits um that then you know ultimately you shouldn't put in a bond with a question about okay and how the application will handle that there will be the one vehicle an answer about that um yeah so so what'll happen um there's there's a there's an answer invalid um which all question all questions kind of fundamentally have which is like um FFF in HEX um so when you write a contract that uses this you want to be able to just put in some code to handle what would happen if you got invalid

um and depending on the application you might want to um like void whatever you were doing uh you know you might want to split something 50 50 it just depends on the application okay thank you room for one more question over here uh couldn't someone break the system by just staking and basically inputting the most funds into a question like if if I'm basically the stronger fund holder then I can just say Okay this question is right and every time someone answers that's where the outright comes in okay right so so so so yeah so if you do it without an arbitrator and you don't have

some kind of special situation like you're doing a vote of your own token holders or something um then that's exactly what could happen Okay um so yeah that's the reason having the arbitrator thank you so much sorry we need to invite the next person onto the stage so thank you so much Edmund uh Round of Applause perhaps thank you guys