New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

UMA & Across 🛠 Optimistic Oracles How to verify any truth trustlessly - John Shutt

ETHGlobalMon, Oct 9, 2023, 12:00 AM

Join John Shutt of UMA for a workshop titled "Optimistic Oracles How to verify any truth trustlessly" Thank you for joining us for ETHSanFrancisco—our first west-coast hackathon in nearly four years. This was officially our biggest event ever 🎉 👥 1700 attendees 🗺 from 46 countries 🌱 38% new to web3 📮 284 projects And: ETHGlobal just turned five! 5️⃣🎂 Thanks to every single one of you for making this community great 💙 ------------------------- 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] which lets you bring the truth on chain with an optimistic Oracle it's a pretty open-ended system there's a lot of cool things you could build with it and we'll dive into a couple of them and get started quickly so the basic idea of Uma is that it's an optimistic Oracle it can provide and verify any arbitrary data on chain to secure smart contracts and execute Things based on what's happening in the real world or based on cross-chain events or off-chain calculation it's been called a human power truth machine and the reason for that is that you know you can and often do use Bots to automatically propose and dispute and so on but Uma is able to handle natural language questions and it's able to apply human reasonableness so unlike price feed style Oracle it's not trying to determine in advance and then push a price on chain anybody can basically ask a question anybody can propose an answer and post a bond with it anybody else can dispute that answer within a challenge window and we'll get into all the details of that so oracles are really important I personally think that the next phase of crypto really needs to bring in more real world events more real world assets that kind of thing and oracles are critical to that uh the oo is powered by Uma token holders it can be plugged into any kind of D5 protocol or other on-chain smart contract and it's super super flexible it's been used to build Bridges Insurance protocols prediction markets derivatives we have some like optimistic governance stuff coming out soon that's really cool so here's what goes into it uh the basic flow you have a requester the cluster is asking a question for some data a proposer provides an answer and a disputer can challenge the answer if it's wrong it has a dispute resolution process so if it gets disputed it goes to a vote of all of the Uma token holders that do a secret commitment on chain of what they think the answer is so you can't copy other people's answers and then a reveal process where the actual answer is revealed documented methodology of Truth so you describe like your methodology of here's the kind of information that I'm looking for here's how you can figure out what the answer is so if you have something complicated like um there's one project that wants you to calculate volatility of an asset which is kind of like yeah okay are you with a volatility now okay there's two projects that are trying to calculate the volatility of an asset so for that like you need to kind of explain to people like here's how you calculate it you might provide like even a script to do it um or like some backup process to do it by hand and then you have economic guarantees so people have money at stake if they're wrong uh they're going to lose money if they're right they're going to make money um so that's kind of the combination of things that you use to build an optimistic Oracle powered thing and this is just kind of a flow chart of how it works so it kind of starts with the question the proposer posts a bond and gives an answer if it gets disputed then it goes to this DVM process where all the Uma token holders weigh in on it but because of this proposer Bond disputes are extremely rare I think maybe like one out of every 500 proposals and actually probably less when across a cross Chain Bridge is taken into account because proposers don't want to lose their bond so normally you just say no after the liveness period the challenge window you have the final answer and you can use it so these are some things that have been built I talked about this a little bit kpi options and success tokens are like some really cool Dow tools to incentivize communities incentivize investors and like a a way that's really aligned and there's much much more than this and I'm very excited to kind of see what hackers come up with I know the last couple of hackathons we've had some really cool stuff we have a decentralist here so it's like verifying like lists of addresses that meet certain criteria which is a really flexible tool um there's a cool project from youth Bogota where you're verifying news information like basic facts you can like check it you verify it and now you have like a corpus of facts that you can deal with and really trust for the news these are just like small examples there's so many different things um yeah just some examples of questions so again like you can ask natural language questions you don't need to even have like an API that you're pointing at you don't need to have nodes running in the background you just need a question that someone can answer that somebody with access to Google basically is able to determine what the answer is so our Oracle can also be triggered by events so if you have some event that you know is going to happen in the future you can essentially set up a trigger in your contracts and provide incentives for people to inform the contract that the event has happened so for instance if you wanted to have some kind of a payout like maybe uh if San Francisco was canceled and you wasted a bunch of money on plane tickets or insurance or like hotel costs you could have an insurance contract that'll pay out that's event based East San Francisco hasn't happened yet at the time you're buying this insurance but then when East San Francisco does happen you can resolve this like it happened there's no insurance payout or vice versa and then those events can flow into other contracts so once that is settled you can have a callback function in your contract that when the Oracle resolves the answer your contract will automatically do some stuff and the reason for that is when you're making the request you're saying like hey I have this callback so when the Oracle is resolving it's going to call this price settled function in your contract and then you can do all of your other logic including like in this example just doing an insurance payout automatically so all you really have to do is ask the question include the reward the incentives are there essentially this decentralized keeper network is going to take care of it for you now both verifying the truth and triggering all of your events that happen so now the real world can directly affect on chain state so if you know something happened in the real world that can now affect a smart contract and you can build the incentives in place that that information is going to come in and then all of your smart contract logical play out in this permission list and Unstoppable way you can also use it to make assertions and this is a pretty common pattern where you know what the answer is but you don't want people to just trust you so you come in and you ask the question and provide the answer at the same time and then you can use that answer after that challenge window is over so that's actually probably the majority of projects might want to use this pattern and insurance one is a good one too like you might uh you know trigger the request and the proposal at the same time there's no point to even necessarily making the request unless the thing has happened so as the person who's getting the payout the money's locked up in the insurance contract East San Francisco is canceled you just go and say hey it was canceled make the request propose it and then you get paid out after the challenge window and so this is kind of like a way to implement that and really what it's doing is just like wrapping the other functions so you're requesting here you're setting aliveness period of how long the challenge window uh should be because that's customizable you might make it longer or shorter depending on your use case and then you're proposing a price and just emitting an event so that front ends know about it so you can ask questions about past events you can subscribe to updates about future events you can trigger callback functions you can make assertions about the world and you can build a collection of Undisputed facts on chain and voila so this is the real world this is what we're trying to bring on chain here most of the stuff that matters is happening out here it's not just like the the circular kind of crypto economy this is kind of the next phase that we need this is what we need oracles for so we have like a lot of tutorials I'm going to pull up one that's just like a really basic quick start um but depending on what you're working on you might want to go to these more advanced tutorials we have something for um like just a basic deposit box you're putting money in and then you're pulling a different amount of money out depending on the oracle's response we have a prediction Market tutorial so you could deploy a prediction Market an internal optimistic Oracle and this is just kind of demonstrating a pattern where you might have an escalation game before you even go to our Oracle where you only come to us if there's a dispute for instance we have an insurance tutorial and then something we call the optimistic arbitrator which is kind of showing that assertion pattern so all of these things are like too long to get into right now but go to docs.umaproject.org developers and you'll see all of our tutorials that are available but uh we are going to go to the quick start one so the quick start also includes a video this is me in the distant past when my hair was short and this is just going to ask a really simple question how's the text looking by the way is it like smaller okay oh okay so it's just going to ask about the temperature in New York City on a certain day in the past and then you're going to answer yes or no depending on the temperature and we're just going to deploy something to girly test net and just like walk through a basic flow so let's go to ReMax and check this out while remix is loading I'm going to click over to our Oracle interface so this is something that you could use to manually respond to requests that you've made on Gurley so if you're testing on Gurley you could go here and do like an actual like natural flow you'll see the requests come in and you can respond to them so it's a more realistic kind of simulation request failed well it looks fine though okay so this is our contract it's just a really simple getting started contract I'm not going to go into all the details of it but I'm basically just going to go and deploy this to girly so we can interact with it and then walk through the different steps and again if you go to the quick start tutorial page you'll be able to pull this up and it'll make it pretty easy you'll need some girly eat but we have some instructions on how to get that if you don't with the addresses that you're using all right so that's confirmed we just deployed the contract we should be able to interact with it now so let's go and run some transactions so right here we're going to start with this request price function which don't get confused when you see the word price come up in our code Uma kind of started out with a lot of financial derivatives focus and so there was like a lot of focus on price just mentally replace the word price with data in your mind you're requesting any kind of data um so this function is just going to ask like a pretty basic question what we've defined here like did the temperature on the 25th of July in Manhattan exceed 35 degrees Celsius and then it's providing some instructions for your proposers unlike how to resolve it because they're going to have to return a number so one means yes zero means no you're just letting them know here so we're going to make this request confirm that and then once this goes through we should see this pop up in our interface here as a new request okay so we got a new request here I'm going in just like a manual proposer I'm seeing new stuff that's coming in pull this up I'm going to connect it to my wallet so I'm able to propose and I can see the question so did the temperature exceed this one for yes zero for no and again I don't it's not specifying a data source it's just kind of up to the proposer to propose something that they can stand behind that they're willing to risk their bond on so I'm going to go to this random website because it's a test net thing so I don't really need to like check multiple sources here and it looks like the max was 84 degrees Fahrenheit run the conversions manual kind of thing and that was definitely under 35 degrees Celsius so I'm going to read this again zero is no I'm going to propose an answer of zero and since this is a test net request I think the weight period is going to be like 60 Seconds that somebody could challenge this and it might actually be so fast that you won't see the dispute option come up here but once this goes through you should actually be able to dispute it also through this interface so you can test out that flow as well and if you're on Gurley and you're doing this we have a mock Oracle contract and there's some documentation for that online you'll get like 24 23 seconds left if I wanted to dispute myself but if you want to like resolve a dispute obviously there's not going to be a full vote on this on testnet that wouldn't even work you can just basically like push an answer and that'll simulate getting an answer from the DVM the dispute resolution process but in this case we're just going to let it wind down everybody thinks this is correct other people checked the same sources seems like the answer was Zero for no so now that that's gone through we should be able to actually settle this kind of following through it we proposed and we're going to call the settle request function which you could also do okay so this remix hasn't updated yet that this is settlable but it will in a minute okay now we can do it so basically you saw it fail because it thought that we couldn't settle it yet it didn't see that like the countdown clock had gone down that was just kind of like the node updating with the actual State now going to confirm that so once this is settled we'll be able to actually use this answer for whatever we're interested in maybe this is like again like an insurance contract tied to the weather or something in New York give that a minute looks like it's pending okay so we were able to call get settled and I don't know if you can see it down here but remix actually gave you the answer so zero is the answer we can now use that that is finalized so that's the really basic quick start I really encourage you to go into the more detailed tutorials like here's a prediction market for instance all of these should have instructions for actually deploying these on test net or your local environment and just really helps you think through like different things that you might want to implement there's also good instructions for setting custom bonds and liveness parameters this is something that you would think about in a mainnet thing because the bonds are going to provide um basically a penalty for proposers that are bad and a reward for disputers that are good and you need to think through like what are the correct levels you don't want the bond to necessarily be too high because then people are scared to propose you don't want it to be too low because then people don't have an incentive to dispute if you're securing like a hundred million dollars you're going to have a lot more to think about than somebody securing like a thousand dollars to like all of these things are configurable so just think through what makes sense for yourself so the minimum bond is what we call the final fee and that's just like an anti-spam thing and it's about fifteen hundred dollars and the reason for that is to block people from just like spamming the DVM and farming voting rewards because the incentive as an Uma voter is you get rewards if you show up and vote and vote correctly um so people would have an incentive without that final fee to just create a bunch of fake disputes just to like Farm a bunch of uh like Uma tokens for themselves you generally want to set it higher because only the amount in excess of the final fee is going to go towards the disputer's incentives so if you set like a bond of 4 000 half of the excess is going to go to the disputer and this is kind of like a complicated thing but basically like with a four thousand dollar Bond if somebody disputes and they're correct their reward is going to be one thousand two hundred fifty dollars and then 1500 goes to the store and like they're I think the rest also is going to the store in that case just to keep people from proposing and then disputing themselves like front running a dispute that came up um but yeah so like if you don't give an extra Bond disputers have no reason to show up they won't make any money so you do need to like set it higher than the final fee unless you like have some extra protocol kind of incentives for people to show up in dispute like you're running Bots you know that lots of other people are running Bots and you don't need any extra incentive they're just going to like show up in dispute because you know it's wrong um wanted to point out prizes too so basically uh first place five thousand dollars second place is two thousand dollars and this is for Uma or across um I didn't really get into a cross in this presentation but across is a cross Chain Bridge that uses Uma under the hood uh you can use it to move between ethereum arbitrum optimism Boba and polygon it all has single-sided liquidity so no slippage It's usually the fastest cheapest bridge between these chains um so if you're building something cool with a cross you could also qualify for prizes and it uses Uma under the hood to verify that transfers are done correctly and then there's a pool prize of three thousand dollars that's split between all the teams that do any Uma or across integration so there's a opportunity even if you're not like one of the top Prize winners but um we have some more time I did want to like get into what people are thinking about building and maybe like brainstorm um you know how you could do that with Uma or with a cross also prediction Market okay we've got a tutorial for that you can get this deployed in an hour you're done and then you kick back your heels and relax and thank you mm-hmm okay so like a request for quotes okay let me think about that so the quote comes in is that coming in like on chain or off chain mm-hmm interesting yeah I mean it seems like an opportunity that you could gather in a bunch of bids like off chain where it's cheaper and then um the highest one could be like pushed on chain so you could basically say like uh building on top of Seaport and just spitballing here somebody has posted an RFQ and they're like I want a minimum of this for my board ape but not everybody wants to go on chain and spend gas to put in a bid and possibly not win so they go to some like kind of off-chain broadcast thing and there's some set time period and the winning bid the highest bid can be proposed now on chain and Uma can verify that that was actually the highest bid if it wasn't then it gets rejected or if like the time period hasn't exhausted itself it'll be rejected and that'll be a way to like bring that off chain highest bid on chain [Music] um yeah I mean you definitely could I mean you could use like Uma because Uma can see what's happening on every chain because it's just like whatever like human beings can look at or Bots can look at so if you have a RFQ that's coming from some other chain you might use Uma to automate like moving funds to the chain where you need to actually like make the payment like if you're like your funds are on ethereum you need to move them to polygon for something and you're asleep but you know that you want to like buy this type of polygon nft as long as one comes in at a certain price you could use Uma for that like basically give people an incentive to like move your funds on your behalf and then submit the bid so it's like what we're talking about with those event-based triggers you have some new real world event an RFQ came out that you're interested in other people can now like trigger some stuff on chain that's going to like move your funds in place to actually bid and you'll win this auction in your sleep all right after the prediction Market yeah you definitely could like if you see yeah um yeah that's interesting yeah so if people are like submitting things on chain or you could also um I don't know a c Port if you're able to like rescind a bid like if you put in a bid and then you're like wait never mind something else more important came up like maybe you're able to like pay attention to that too so if you're building like an nft trading bot that is keeping track of like what is the most important thing maybe you rank like the nfts you want the most and so you like pull one bid because you need the funds for some other thing I think you could probably do that I think there's also probably a way um you know nfts get stolen all the time so you might not want a bid on one that was stolen and so uh you might like add like a check basically where it's like um I don't know like anybody can do this and submit this bid on my behalf like unless it appears from whatever evidence that this might have been stolen and then there's some kind of like delay baked into that so that you're not like otherwise somebody could come in and like steal something create an RFQ use this automated system to have you bid on it and sell it to you in an automated way and they won't be disputed necessarily because you did say you wanted it you didn't specify you don't want it if it's stolen yeah but it's like also very active because it's like in real time it's like this specific nft did it happen to be stolen can you like tell within this time period um so that seems like a pretty good protection uh against doing that as long as it's like a long enough time period right exactly yeah because you're not going to know in advance that it was stolen it's like probably newly stolen up for sale immediately yep yeah um so the return value is always going to be a number but you're able to ask the question in a way where you can like kind of say what number to return based on what the actual return value is so yes or no is an obvious one where it's like one means yes zero means no 0.5 means this one's not resolvable and just kind of like split the difference but you could have like more complicated types of answers too returning a struct seems tricky uh you know you could probably also do like um you know like encode something like as a number and just really specify somewhere maybe in your uh like price identifier that went through Uma governance of like here's how you convert the end result into a number and you're returning this number value and then you know to like convert it back the other way in like such and such means yeah so the identifiers are approved on chain but the methodologies are stored off chain so you would go to like the umip kind of description of like how to resolve yes or no query for instance or yeah foreign it's on GitHub right now I think it would be better in the long run if we had some kind of like an ipfs type thing so that it's immutable but right now it's on GitHub cool but yeah like I said it's super flexible we've got the booth um it's on like that side at the end of the hall uh we'll be here pretty much all weekend helping you hack on stuff and we really want to provide as much support as we can because you know we want cool stuff to be built we also want to like help you make it to like the finale and like achieve all your other goals and then uh you know afterwards we do have um like grants programs we can provide follow-on support um Alex is here in the audience too like we both uh help hackers like extend their projects and we're also hiring too so if you're interested in working for us um you know we'd love to work together with you over the weekend and then you know see if you want to apply to that and I think that that's it

Automatic transcript — names and jargon may be misspelled.