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

Loading player…

UMA 🛠 Accessing the long tail with UMA’s Optimistic Oracle

ETHGlobalSun, Oct 9, 2022, 12:00 AM

Join Nick Pai and Sean Brown of Radicle for a workshop titled, "Accessing the long tail with UMA’s Optimistic Oracle." This workshop is part of ETHNewYork 2022, a three-day in person hackathon that will feature hackers, mentors, enthusiasts, sponsors and speakers who are all gathering in New York June 24-26, 2022 to talk about the future of money, finance, the web, ownership, the way software works and the way power is distributed. We're excited about a new frontier. ---------------------------------------------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

So, today we're going to explain what UMA is, what optimistic oracles are, and for the hackers in the crowd, we're going to give some ideas for some projects you could build with optimistic oracles. I think we have a pretty decent quick hack idea, but also just give some examples of how UMA's used in the wild today. Um to help you guys out no matter how far you are at in the process. Um and I'm Nick. I'm an engineer and this is Shawn, product manager.

And yeah, let's begin. So, so uh just starting with the basics basically, uh UMA is an optimistic oracle. I think to talk about what an optimistic oracle is, we need to first talk about the fundamentals. What is an oracle? Um an oracle is a system that is built to uh trustlessly and reliably bring data on chain so it can be used within smart contracts.

So, if you have a smart contract uh for like a derivative on the price of say gold, you need to know what the dollar value of gold is and you need a way to actually get that data on chain because smart contracts have no notion of you know, off-chain data. Um so, in you know, DeFi, uh what do people think about when they think about oracles? They typically think about things that we call price feed oracles. So, an example of a price feed oracle would be something like Chainlink. Um what are price feed oracles good for?

Uh basically, price feed oracles have a trusted set of actors that push prices frequently and are good for deterministic types of data. Um so, they're used a lot in DeFi for things like, uh, you know, securing lending protocols and running like liquidation engines there. And they're very good for, you know, times when you need data quickly and you care less about like flexibility of the types of data you can get access to, or you care less about, um, you care less about like a concept of recourse, uh, and you also don't need any element of human judgment. So, things like crypto prices are probably the best example. What is an optimistic oracle?

So, optimistic oracles are a different take on how you approach this oracle problem. Um, optimistic oracles, uh, we say enforce correctness after a dispute. Um, so, what are they good for? Uh, they're good for basically bringing any type of data that is like, uh, generally, uh, verifiable on chain. So, you can ask a much broader set of questions of the oracle.

So, rather than, you know, only being able to get things like crypto prices, you can ask it like very, very general questions. Um, and we'll go into, like, why that is and like how the oracle actually works. Uh, but it's good for things like, you know, not only can you get access to the price of ETH, but you can get access to, uh, basically the answer to any sort of, like, yes or no question that you can ask it. So, like, what like who won the Lakers game last night, or uh, like who won this political election, or what happened on this other blockchain network. Those are all things that optimistic oracles can serve very easily.

This is, uh, very complicated diagram. So, uh, we'll share slides afterwards and I would recommend going through it then. Um, but just at a very high level, uh, what does the data request process look like? Um basically with price feed oracles, the way they work is that uh this permission set of actors will come to consensus on prices beforehand and push these prices on chain very frequently. With our optimistic oracle, basically somebody needs to say, "Hey, I need the this piece of data."

Uh so they need to submit a request. Once that happens, um anybody, so a completely permissionless set of people, or not a set, but uh like anybody can come in and say, "You know, you're asking for the outcome of the sports game last night, or you're asking for the price of ETH." And I can submit a bonded proposal saying I know the answer to that question, and it's this. Um that answer then sits through this liveness period or verification period where anybody else can view that and uh decide if they agree or disagree with it. If everybody agrees and nobody disputes what the initial proposal is, then this is accepted as truth, and this is where the word optimistic comes from.

So it's kind of similar to like optimistic roll-up fraud proofs where there's like a verification period where things are verified. Um But so if nobody disputes it, then it's accepted as truth, and that's the like data point that's used. If somebody disputes it, then it basically gets escalated to a larger court system or dispute arbitration system. Um again, there's a lot here, so I would go through the diagram, but that's it at a high level. And Nick's going to go through a couple demos of uh things you can build.

Cool. Um so this this next section's mostly for builders, developers, and I'm just going to walk through some very simple toy examples of contracts that use the optimistic oracle. I'm going to explain how they are very simple versions of real apps that are out in the wild right now using the UMA optimistic oracle. And then we'll walk through some of those real-life applications at the end of this. Um so, the GitHub repo, the quick start repo that we just put together is live at the URL there.

We use um TypeScript, Hardhat, ethers.js, TypeChain, pretty um standard stuff in the industry today, but it could be I guess it's just a good place to go if you want to just get started quickly with the latest of the tools that real Solidity Solidity developers use today. So, I'm going to explain a really, really simple um contract first called the deposit box. I'm going to extend that with what I think could be a potentially useful application in the real world, but maybe not, but it does actually use the optimistic price request very well. And then the third I'm going to explain how you could build a prediction market very simply.

Well, actually we built it. I'm just going to explain how it works. Um so, the user story is there's a deposit box. Let's treat it as a black box. That's why it's black.

Um a user deposits 10 ERC-20s into the box. And the idea is to keep it safe there. Um safe from their own hands in case they trade it. So, call it let's say 30 days later the user wants to withdraw money from the deposit box to pay for cookies or coffee. And the user wants to withdraw $10 worth of tokens.

Now, recall when the user first put in tokens, they put in 10 tokens. They had no idea what amount of dollars they were putting into the box. So, 30 days later the user wants to withdraw $10 worth of ERC-20s. How does the black box know what what $1 worth of tokens is. Well, the deposit box can make a price request to the UMA Oracle.

This is a very contrived example because you could have asked this to a to a price feed Oracle as Shawn explained earlier. It's very For most tokens, it's pretty easy to understand what $1 worth of that tokens are. But, you could ask this to the UMA price Oracle, and you'll you'll ask what hey, what is $1 worth of tokens today? Um and the UMA Oracle is going to respond to it. So, I'll give a really quick segue on how how does the Oracle know how to answer the question?

So, the actual price request that the deposit box is making to the Oracle is a question. What is $1 worth of tokens today? Voters, who are off-chain actors, need to look at some sort of legal contract or some sort of rules off-chain or methodology to understand like how to respond to this question. So, a real-life example that we use to secure contracts that store like the COMP token, c o m p, is uh the offset uh the off-chain set of rules might be look at these three exchanges and take the median of their prices at the current time, and that is the price you should return. So, UMA Oracles are secured by these off-chain contracts with rules that voters can easily follow.

And it's the the onus is on the writer of the contract to define these rules correctly, and then voters should be completely neutral about how they respond to them. So, in this example case, the deposit box is has asked the UMA Oracle, what is $1 worth of tokens today? The UMA Oracle says one token is worth $5, so the user will receive $2 back. Let's extend this. That that deposit box is not super useful.

I um you could have used a different Oracle for that. Imagine I deposit the $10 into a 10 10 ETH into a lockbox. Um this is something I've been thinking about and actually just was talking about today with some some uh co-workers. Um, say I wanted say my daughter was 1 years old and I wanted to give her 10 ETH, but I didn't want her to be to be able to withdraw it until she was older. And and not just based on her age.

I didn't want her to withdraw it when she was 20. I wanted to sort of incentivize her. So, I I I set a rule that she could withdraw the money if she graduated college. Um, this is something that is easily verifiable by an off-chain set of rules, but it's not necessarily easy to define on chain. There's no sort of bot that's tracking my daughter's life and responding to this automatically.

So, say for the next 20 years she tries every day to trick me and asks um she requests to withdraw 10 ETH. Every single day I'm going to look at this set of contracts and I'm going to answer no. If she ever wants to dispute me, she can dispute me and she can raise this question to the DVM and then UMA voters can can then answer this question, "Hey, um the the box might ask UMA has Nick daughter graduated college yet?" Someone might propose, "No, she's 4 years old. She has not graduated college yet."

So, the example UMI identifier for this might be a yes or no question, "Has my daughter graduated college yet?" Voters UMA voters, remember, are credibly neutral and they're going to they're going to vote according to the rule set that's described. So, this UMI is um or or this this this methodology might be vote yes if if she if there is proof that her name has appeared on the graduation list for some certified college. This is obviously a very hazy set of rules, but it's just the just a toy example here. And vote no otherwise.

And the contract could take the result of that vote and uh unlock her assets. Is this a useful product? Maybe not. Um, but I think it would one thing that actually it could be useful for is if you um in the future say you lose communication with your daughter. Um, Uma voters will still continue to vote on this question.

Has she graduated college yet according to that set of rules? So, um maybe it has some use case, but it's just a little bit of an example of a deposit box that could not be used on a different price feed oracle. Um, okay, so I'll explain the prediction market. This this is a very simple example of how prediction a prediction market today called Polymarket is built on the Uma optimistic oracle and this is how it's sort of built today. So, say users want to bet on the question uh who's going to win the Kentucky Derby?

So, you as the user you might put 10 USDC on the horse Seahorse to win the Kentucky Derby. Um, you're going to deposit this into a contract written by the prediction market uh developers. And the prediction market is going to immediately ask the Uma oracle did Seahorse win the Kentucky Derby? Uh say say the user originally deposited this 10 days before the Kentucky Derby started. So, there's actually no answer yet.

The the contract needs to be written in such a way that um the prediction market contract needs to be written in such a way that um it will throw out answers where voters answer to the question that the the question hasn't resolved yet. There's no way to know if Seahorse won the Kentucky Derby if the Kentucky Derby hasn't started yet. So, the oracle's going to basically just give a standby signal to the contract and the contract's going to wait around um until the Kentucky Derby actually happens. And then someone will be able to propose a price. The proposer wants to do this cuz they might earn like 50 bucks or just something some simple reward for responding to the question.

Assuming no one challenges it, the uh the contract can then pay out users. And so, this that's a very simple example of how Polymarket works today. And imagine they're running this on many, many different markets that are all asking questions to the optimistic oracle, maybe 10 a day, and individual people around the world are responding to this for a little bit of a reward. Um and very few of these actually get challenged because they're relatively easy to verify. They're They're pretty hard to verify on the price feed oracle.

Like, it's not not easy to um to answer questions like um like presidential elections or whether insurance contracts smart contracts got hacked. So, today we'll just walk through some of the some of some of the the products out there that actually do use the oracle, and we can reduce their use case to the questions that they ask. Um Do you want to give this? Cool. Yep.

Yeah, so uh these are some examples of protocols that use UMA today. And like Nick said, the questions they ask. So, Polymarket is a prediction markets platform, and you know, they ask questions like, "Did the Trail Blazers win their basketball game last night?" Um so, you can, you know, create prediction markets on UMA uh based on very arbitrary, flexible types of real-world data. Um the second one, the purple one, is Sherlock, which is a decentralized insurance protocol.

And they ask UMA basically, "Was this protocol hacked, and should my uh DeFi insurance contracts uh should it cover this insurance claim?" Um So, another good use case is, you know, enforcing legal contracts where there's some degree of ambiguity and you need some sort of human element to uh resolve these things. The third is Across, which is a cross-chain asset bridge and Across uses UMA's Oracle to ask for information about uh transactions that have happened on other networks. So, if you're trying to bridge USDC from, say, Optimism to mainnet and uh basically Across is asking questions about uh like certain USDC deposits and if like relayers are basically like forwarding uh funds. It's Yeah, it's pretty complicated, but like was this relay correct?

So, like was this transaction correct and were the fees that were taken out of it correct? Um The last or the fourth one is uh basically asking for the price of a specific DeFi token. So, here it's asking for the price of the FOX token and can be used in things such as like structured products or like bespoke financial contracts. And then we'll the last one um is asking what was Boba's TVL in February of 2022. So, this is used within these things that we call KPI options, which are essentially trying to tokenize uh like arbitrary uh KPIs or metrics or around certain protocols.

Um so, here you can create like a financial contracts where the payout is actually uh determined by uh Boba's TVL in February of 2022. So, this is really a reiteration of that uh with you know, what we're actually calling the products. So, uh prediction markets uh are good use case. bribes. Optimistic governance is one thing we didn't talk about, but uh basically we have a set of contracts where you could ask the Oracle, does this like arbitrary transaction follow a set of off-chain rules for a DAO?

And if it does, it allows it to be executed. Um and then KPI options we briefly covered, and then synthetic assets is like a pretty simple use case, but basically tokenizing uh derivatives based off the price of like any real-world thing. And then the fun stuff. So, prizes, uh we're giving out 10,000 total dollars. Uh $5,000 first place, 3,000 is second, and 2,000 is third.

Uh we have a link where we give a more in-depth explanation around the criteria associated with it, but like to really distill it simply, it's basically the best use case that integrates UMA's optimistic Oracle. We also are hiring extensively. Uh we have a referral program, so right now we're hiring for a product lead, front-end engineer, smart contract engineer. So, if you're looking for jobs and want to apply, please do. Um we also have a referral program, so if you have friends that are interested, you can make money off of that.

Um if you follow that QR code, it links you to our referral program details. And yeah, thank you. Uh here we have some resources. Uh there's actually should be more than that, but we'll publish these these slides afterwards that link to our docs, uh the quick start tutorial that Nick went over. Um within the docs are tutorials that go through that quick start tutorial and the example contracts.

And then we're all here for the next few days enjoying this experience with you guys. So Thank you. ARE THERE ANY QUESTIONS? YES, SO THE QUESTION was not just anyone can propose an answer to a question. Actually anyone can propose an answer to a question but you you just have to stake a bond.

The bond keeps you honest and prevent disincentivizes you from just spamming answers. So you'd post a bond that's usually much larger than the reward but anyone can propose an answer. Anyone can also propose a bond and challenge you. And if someone challenges you the the answer goes to a vote to the UMA Oracle at which point there's no further escalation and the UMA Oracle will just resolve the question. Yep.

So the the voters which are UMA holders are paid in UMA to respond to votes and they're paid if they vote with the correct answer. So think about participating voters who vote correctly earn a relative they they accrue a share of the network and it's sort of taken out of the it's in it's diluted from the people who don't vote correctly or don't participate. Cool. Thank you. Yes.

Automatic transcript — names and jargon may be misspelled.