UMA 🛠Optimistic truth verification | We know it works, but what's its full potential for web3?
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join Hart Lambur from UMA for a workshop titled "Optimistic truth verification | We know it works, but what's its full potential for web3?." Thank you to everyone who joined us for ETHBogotá 🇨🇴 and helped us kick off Devcon Week. With over 1400 attendees from 62 different countries, ETHBogotá was our biggest hackathon in Latin America ever! ----------------------------------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com #ethereum #web3 #blockchain #eth
Transcript
foreign [Applause] [Music] I'm gonna jump into this you guys honestly feel free to chat and chit chat we're gonna keep this super casual um and just uh I will do a few slides uh and then go into a demo um that will hopefully work live and won't break on me um and we're just gonna showcase how we can bring real world events off-chain data on chain using uma's optimistic Oracle um and again kind of late at night so we're going to keep it Loose um anyone have any questions just interrupt me um we're just gonna have some fun so okay um I bet most of you have been by our booth already um and for people that are either watching the stream or not I'll keep this quick so what is Uma we are what we call an optimistic Oracle we look at this as a mechanism that can in a in a truly trustless and decentralized way uh provide and verify arbitrary off-chain data so uh we're trying to ask things about the world we're trying to ask events that happened it could be price data um it could also be event data who won a football game did this protocol get hacked what happened on this other chain um those are all events that we want to record on chain uh validate as them being truthful or not um and then let them be used by smart contracts and smart contracts application applications um so yeah the optimistic Oracle we look at as this primitive concept uh in the blockchain space uh just uh the simple a simple way that we can use to validate statements of Truth um and to walk you through this at a really high level how this works the concepts are pretty simple we let anyone propose a statement as uh true uh so they could say hey the Jets won of the football game last weekend someone made a joke because they just never went but I don't know anything about football so Jets won football game last weekend this is true anyone someone proposes that anyone on the network then has the opportunity to dispute it during a challenge window if there are no disputes that that statement gets taken as truth and it gets written on the blockchain for people for protocols to use in their applications um if there is a dispute those disputes get escalated to the Uma token holders for them to resolve that resolution process uses a really fun crypto economic game um that actually vitalik invented back in 2014 um and that crypto economic game has a commit period and a reveal period and we can prove with Game Theory uh that you will get the a truthful answer provided No One controls more than half of our token Supply so all told you can really think of the optimistic Oracle as a method that uh prevents us from having to do the hard work of asking our token holders what the right answer is rather we are trying to stay in the optimistic path where we say hey here's do you agree with this and provided people agree we stay in the happy path very little work needs to be done um okay so what goes in optimals we have these requesters that request data proposers that propose data data and disputers that say Hey That's not right we have this dispute resolution process already figured out and we we need our voters to ultimately our Uma token holders to ultimately understand what the concept of Truth here is and that's the limiting factor that's the only limiting factor in the types of questions we can ask of the system as long as a reasonable group of human beings can decide what an answer is whether this thing happened or not we're set and then all of on our side what we've spent a lot of time energy doing is inserting economic guarantees around how secure this protocol is how much value can it secure and at what point could this thing be attacked okay so um these oracles can answer many many types of questions um poly Market is a prediction Market that's a heavy user of our Oracle uh they use it to ask all sorts of real world questions some of them are related to sports some of the related elections some are related to like covid data anything of that sort of sort um Sherlock is an insurance protocol that uses our optimistic Oracle to ask effectively the question was this protocol hacked uh a cross is a cross Chain Bridge that uses the optimistic Oracle to validate actions that happened on other chains um because essentially other chains data is like off-chain data to to um the destination chain um then we've used the this protocol to create a variety of synthetic tokens or fundraising products things we call success tokens or kpi options um these are erc20 tokens that resolve to a payout based on what The Optimist Oracle reports so we've got a couple slides in here that I'm going to skip over and we can come back to at the end of like events be using events in your contract to trigger oracles we'll come back if there's interest in those um and I'm going to keep jumping ahead until we kind of get to our demo uh and then start to get into questions that you all may have um this I will focus on because I think it's useful a common design pattern we've seen used by our optimistic Oracle is making assertions um and this is no different than asking a question and answering yourself all at the same time but we've seen it to be a really useful pattern when developers are actually building on this Optimist Oracle so essentially you're going to say hey I assert this to be true and then you use the Optimus Oracle to verify it provided no one disputes that that statement is I think this is true gets taken as fact um yeah so this assertion pattern and I'll show you guys a little bit of code Snippets here and then we're going to go into like a real demo and just ask questions and we'll have fun um this this function that I think can be quite useful in many of the hacks happening this weekend I want to make an assertion in a trustless or decentralized way and so I'm going to request here price uh all this level with you guys we use the word price in here because we used to be focused on price data the Oracle is now much more than that this should really be request data um but it's an artifact of our older code base so we want to request data we're going to set a custom liveness period this is the length of the challenge period and we're also going to propose an answer to the same question we asked and effectively we're making an assertion here that if nobody disputes it within that given liveness period it will get taken as truth and so this is something we can use to assert hey this action happened on this other chain hey this contract was fulfilled if we go back to this concept of real world data this event happened in the real world I'm asserting that to be true and I'm giving uh I've decentralized it because anybody can disagree with me but provided there's no disagreement we're all we're all good I can use that as statement or assertion to do interesting and useful things any extra questions on that it's a good challenge so the way that I prefer this depends on your use case and sorry the question is um the question was what happens if you do dispute it how do you like unwind this assertion you made and um there's a few ways to approach this depending on your use case the most common pattern we've seen is that as soon as an assertion is disputed you basically throw that out so the application that's inserted this will just say okay that assertion is not true if you want to do it again go ahead and make that assertion again and the person would have to dispute it a second time so in that way and there's edge cases you can talk about about what if you had a whole bunch of disputes and you kind of spam things that way um we can talk about that offline because I think we have reasonable solutions to that um but generally speaking the simplest pattern is I'm going to assert this to be true if somebody wants to dispute it fine we'll still use the UMO token holders to see who's right the person that proposed it or the disputer will use the and those will kind of go to war um uh and they'll earn each other's Bonds in that um but we won't block the protocol or the application from doing useful things does that make sense all right so there is still a bond you'll see there's a bond currency here too the idea in this assertion is I think there's many use cases where you are here's one mental model like pretend um I was talking to a guy who's thinking about like a fantasy football game here too he wants to build like a decentralized fantasy football game and I was telling him like if he was doing this in a centralized way this this guy I'm blanking on his name would just you know he himself would say here are the scores hear the scores hear the scores right what you can do here is you can decentralize that process by instead asserting here are the scores like I'm the guy doing this work here's the answer um but anyone can tell me I'm wrong and I don't need a reward I don't need to reward myself for doing this like I want to be providing the service but I've decentralized it by opening up this pathway where somebody can say hey you're lying you're cheating um that's not right does that kind of make sense if if you did incorrectly so um as a proposer if I'm making this assertion I post a bond if uh someone disputes me and it turns out that they were right yes I lose my bond right but if I was right I actually earned the disputer's bond so I doubled my money make sense cool I like this this question's good so we're gonna keep going here um all right you can use the options Oracle to ask questions about past events subscribe to updates about future events this is a very cool way to actually frame it I want to use the options Oracle to tell me if this protocol ever gets hacked or to tell me if this action ever happens and then I want my smart contract to do something else um trigger callback functions when event happens make an assertion about the state of the world you know this sort of stuff and this wasn't my presentation that I put together but John added this picture of a field of green at the end and I quite like it so here you guys go um uh okay I'm gonna do a demo right now but we are hiring QR code for our jobs pledge I always got to put the we're hiring thing out there um because it's a hackathon with Brilliant Minds and we want to hire you um so let's go into the fun stuff where we're going to just do a little demo and walk through this code um none of this is particularly um fancy and it's all pretty well documented but sometimes it's fun to just see people click buttons and maybe see me like mess up um hopefully not but if you guys go to docs.maproject.org um the first page will be like go to our getting started um section and we have here what we call our minimal viable optimistic Oracle integration and what we're going to do here is ask the question um did the temperature in New York City on July 25th exceed 90 degrees Fahrenheit um and American wrote this tutorial I would use Centigrade it's okay um but you guys just weather so we are going to go ahead and jump into remix here and I'm doing this all live so what do we have here see if I can make this a bit bigger um we have a very simple contract that is uh creating an instance of the optimistic Oracle interface by the way guys like I am technical in the sense that I studied computer science but I haven't written code in like like a decade so I'm doing this it's not that hard this is like doable um uh we are asking what we call a yes or no question and we're inserting the question here of what's the temperature did the temperature oh this one's in Centigrade now that's funny okay not in Fahrenheit is it above 35 degrees Celsius um we are setting some parameters of the system including setting a reward in this case to zero which we could change um and we make a price request we're also setting the liveness period here to 30 seconds this is for demo purposes so that we don't have to sit here waiting for aliveness period to tick by um and then we've got our other functions to settle this so what do I need to do I need to compile this and then I need to go select metamask make sure I'm on Gurley which I am um also folks it's quite difficult getting girly eth right now I just looked at trying to I don't know if anyone else has seen it's like kind of hilarious um we do have some girly eth that if you ask very nicely we might be able to send it to people uh because it's a very difficult thing to get um so I got this I should be doing my transactions while I'm chatting we are going to deploy this great and this will take a second for it to deploy and yeah I shall tell you that um you should in our Discord if anyone needs girly eth just ping us and we'll try our best to send you something um ping us with an address you don't mind getting doxed on because it is a public Channel um all right so that was successful cool deployed contracts so I have deployed this oo contract I followed the instructions here by memory but they're pretty simple and they just did what I talked about to actually deploy this optimistic Oracle contract and now what we're going to do is we're going to actually propose this question now that the contract is deployed we're going to go and actually call this request data function and if we go back and we look at this what is request data doing this is the one that's actually making the uh requesting the the price requesting the data with those custom liveness period of 30 seconds so this transaction is taking a second to mine and when it does mine what we are going to then do is go into our interface this is a front-end interface we have where um yeah let's just say we're able to see the question we just asked okay and here is where um oops my wallet here is where anyone can propose an answer I'm going to propose zero here doesn't really matter what the testing purposes is I'm going to propose this so this is someone is saying no the temperature wasn't above 35 degrees on this date this could be anyone or if you're using the assertion pattern I was talking about earlier you could propose this yourself when you are asking the question um so this goes in and you see we've got I don't know if you guys can see this we've got this countdown window of the time left in which people could challenge this assertion or challenge this fact that someone's saying no here um and we are going to let that tick down um I'm not going to demonstrate like the dispute case right now we let that tick down and we're done so now um if I'm doing this right I can go back and actually settle uh settle the the transaction which is going to now confirm that hey okay yeah go ahead uh yeah um that is a very very good question so the question is what do people do if the question is poorly worded um and what we do if we look back here we have this what we call our identifier which we call yes or no query and this corresponds to effectively a rule set we've written off chain that everybody agrees to follow and in that rule set we TR we try to have rules for the circumstance you're talking about like what do we do if it's a shitty question and generally speaking that the rules that should specify that it's like okay if it's a bad question just always respond no would be one answer if it's a bad question respond 0.5 like between one and zero respond something where you kind of split the answer um if it's we have like like that kind of agreement there too and in that case again if if the consensus is that this is a badly worded worded question that would be the response and the um the uh the DAP that's implementing it or the protocol that's implementing Oracle should handle that use case does that make sense um so let's see so now if I call get settled did that work Chris or did I do something wrong yeah hold on I gotta why am I getting all this stuff yeah this is my data that says zero right here so my decoded output I got back my response so it worked we got our answer simple life cycle pretty simple demo we're not doing anything rocket science here we're asking a question there's a challenge period we've got an interface where people can respond to it this interface this whole thing here where we have um these uh this this response uh period like you could imagine this being done by um Bots or some automated process off chain um this is still like an interface where people could manually dispute things if they're like that's not right and so there's a lot of flexibility it's a very generalized or flexible system to let us accomplish those things um all right so I went through this settling the final answer and that's it in our tutorial at the bottom we have some more advanced examples that go into doing more things but for the most part um this remix uh package gives you like the basic building blocks of what you need to do to actually use the options Oracle to get a piece of data and to kind of ask this generalized question um in terms of other resources uh first of all anyone hacking this this uh this weekend please do use our Discord channel to Ping us and ask us questions we're going to be up at our booth a lot um but the Discord channel is just good for us to answer quick and dirty things in case we're like back in our hotel rooms or something like that um there is also a very useful video um that I'm not going to play right now because it's going to play ads which we don't want but there's an awesome video of John on our team walking through this uh this tutorial too um and yeah I think and then if we go back into our Discord Channel um this is maybe a little bit small but lots of uh links and resources to our doc site our website um some ideas of things we can build with the optimistic Oracle um and a blog post with again more ideas of hacks we're interested in um and with that I think I might just spend the next next four minutes answering any questions anybody might have okay could I use the Uber Oracle in that instance because like maybe that's where I would ask because I want to submit a Bible verse so I think there's actually like a whole Suite of interesting call it like trade automation tools you could build here where um I could imagine like you have uh you're like basically have a trading strategy like if this then that in a trading strategy um and you want that to be executed it's based on real world data but you want that to be executed on chain um and something like the options Oracle could be very effective at actually doing that like you could just have it those orders be automatically submitted and have other people dispute them if they're fraudulent or not following the rule set the trade-off is that unless we do sort of sort of some fancy things you'd have to wait this challenge period here too and I think in some use cases that might be okay like if you want to rebalance your portfolio based on events and it's not like super high frequency time sensitive that's probably okay if like when my portfolio gets I want to keep my portfolio 60 40 balanced between Ethan wbtc or something like that and when it gets out of whack I like rebalance it then something like that could work really well if it's something that's super time sensitive the challenge period does matter or does have an effect so I should be really specific really precise with the language so the people proposing answers and the the the actors the entities that are proposing answers and the actors that are disputing answers those people are either Bots or humans depending on the context so across this cross Chain Bridge we use has a bot that proposes repayments to relayers and then there's a disputer bot that disputes that if it's incorrect um poly Market that uses uh uses us for all sorts of prediction Market stuff it's actually all done by people people propose an answer and people dispute it if they think it's incorrect um and so it really depends on the use case here yep what happens almost you know not again like the idea would be the um there's there's different ways of architecting this right you could say um you could design your protocol that says anyone can make an assertion so there isn't actually an outstanding optimistic Oracle request but if a protocol gets hacked I can assert uniswap got hacked at that point in time and then and only then then it's like a fresh request if that makes sense so there's different ways you could architect this um to depending on exactly what you're trying to get around seems Seems like bad architecture in my opinion yeah all right guys we are perfectly on time which doesn't mean we have to end here but uh if anyone has any other questions hit me up get me now or uh Discord um on Twitter uh right we are we should have uh no not wrong thing but we're on we're on Twitter at Uma product Uma project uh you can find me on Twitter at hal2001 um and Discord uh in our sponsor Uma channel is the best way to get in touch with us right now and happy hacking
Automatic transcript — names and jargon may be misspelled.