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

Loading player…

Making Predictions Conditionally by Alan Lu of Gnosis

ETHGlobalFri, Oct 9, 2020, 12:00 AM

Alan Lu, Researcher at Gnosis, gives a talk at ETHBoston about Making predictions conditionally. ETHBoston was an ethereum focused hackathon that took place Sep. 6-8, 2019 at Northwest Building, Harvard Campus. ETHBoston was a hackathon organized by ETHGlobal and a team of hackers, developers and enthusiasts interested in building and creating in the ethereum ecosystem. The ethereum focused hackathon took place for 3 days at Northwest Building, Harvard Campus in Cambridge, MA. For more information visit eth.boston and ethglobal.co

Transcript

OK. So, today I'll talk about how to make conditional predictions. In this talk, I will highlight some issues related to chance and addiction. This is from probability theory. A lot of information about prediction markets, which is actually the topic of conversation, and then about implementing this as a smart contract in Ethereum.

So, conditional tokens, and finally, I'll briefly talk about how you can exchange these tokens and what it gives. So let's start with odds and addiction. Therefore. People are generally interested in the odds of certain events, and in a way it really does have to do with what people believe, what you or I believe, and you could say that these beliefs can even be quantified using probabilities. For example, I can be sure that the sun will rise tomorrow morning, and I can say: the probability of the sun rising tomorrow morning is 100%.

Or maybe I don't quite believe that a certain coin will come up heads. So I would say that the probability of the coin coming up heads the coin coming up heads is 40%. For whatever is 40%. For whatever reason, fine. In fact, this is not quite the complete picture.

Many events depend on each other. For example, maybe I want to think about two different weather parameters for tomorrow: will it be cloudy or clear? Will it be wet or dry? And maybe my beliefs look something like this chart, and if they do , then I can assume that tomorrow will most likely be dry, since the sum of everything in the "dry" row is 60%. This is more than likely, and I also have no idea whether it will be cloudy or clear tomorrow.

So if you add up the columns, you 'll see that both add up to 50%. But if I assume that it will be cloudy tomorrow, I will be inclined to believe that it will most likely be wet. Therefore. This is essentially a concept from probability theory called conditional probabilities. And this is a hint that conviction is a complex thing.

They are such that sometimes one question is not enough to capture someone's beliefs and views. Maybe a little more is needed, and it's worth digging deeper. I also want to warn you about this. This should not be confused with cause and effect with cause and effect . Dependence and causation are different things.

There is a certain connection between them. OK. So, let's put that aside for a moment and talk about prediction markets. Prediction markets are essentially a tool that can be used to generalize views. You go from the opinions of one person to the generalized opinion of all market participants.

This is a great way to gather opinions, as all participants in the prediction market are risking their own funds to some extent. I will talk about several different types of prediction markets. One of them is the categorical market. You ask a question that has several possible outcomes, but only one of them will come true, for example: Who will head the loon conservation committee— loon conservation committee— Alice, Bob, Carol, or Dan? To create a categorical prediction market, provision is needed.

For example, you can convert dollars to "Alice's dollars," " to "Alice's dollars," " Bob's dollars," " Carol's dollars," or " Dan's dollars." The idea is that if Dan wins, his “dollar” will be equal to the value of the dollar used for collateral. This is how you get information from the market for these assets from the market for these assets . The market price of " . The market price of " Alice's dollar" will then reflect the probability of her being chosen.

Good. Scalar markets are similar to them. Ahem. Scalar markets produce a result as a value within a certain range. For example, how many loons will be counted in next year's census?

The lower limit could be zero, if all loons become extinct, or the upper limit could be a thousand. Okay, so there are a lot of loons somewhere. In scalar markets, you convert a dollar, for example, into a “zero- for example, into a “zero- ha” dollar and a “ ha” dollar and a “ kiloha” dollar. And then you get a kind of payoff curve. If they count 250 loons, it's closer to zero than to a thousand.

In this case, the “zero-haul” dollar will bring 75 cents per unit, and the “ cents per unit, and the “ kilohaul” one will bring only 25 cents. You can see how it works in the graph. Now the market price of both assets allows us to derive a forecast of how many loons are expected at the time of the census. So, for example, if the price of a zero-moon dollar is 40 cents in the market and a kilo- the market and a kilo- moon dollar is 60 cents, then you can go back on this chart to get a forecast of 600 moons. This is the expected number of moons that will be counted during the census.

And this part is the combinatorial prediction market. Sometimes it is useful to think about how different issues are related to each other and how these events may depend on each other. In this case, let's try to combine these markets, and this way of creating a combinatorial market allows us to build a grid of assets with different outcomes different outcomes . So, in principle, each of these in the combined markets concerns an outcome from the categorical market and one of the options in the scalar market. But there are only eight of them.

And the idea is that one dollar can be exchanged for the entire set. So everything is a little more complicated. One of the "nun" dollars can actually be exchanged for four of this set four of this set . Actually, those that contain "nun". Similarly, Carol dollars can be exchanged for a full set that matches Carol.

Ahem. And so if you get the market prices for each of them, you can see the joint probability distribution. You see beliefs about the dependencies between these events. As an example, if a an example, if a zero-luna dollar was worth 50 cents and a kilo-luna was worth cents and a kilo-luna was worth 50 cents, I would say I would expect about 500 lunas in total. However, if Alice is elected, then the asset " elected, then the asset " Alice and the Zero Moon" will be worth 15 cents in the market.

And let's assume that "Alice and the 1000 Moons" is worth 10 cents on the market. Both of these indicators together suggest together suggest that Alice's chances of being elected are about 25%. But if she were elected, then the "zero moon" would account for about 60 account for about 60 %, and the "kilo moon" would account for %, and the "kilo moon" would account for about 40%, so we can say that the expected number of moons if Alice were elected is 400. So maybe Alice is not very fond of moons for some reason. Or at least that's what the market thinks.

Oh, okay. So, as another example, you can do it in reverse. So, maybe you see Dan as having the best chance of being elected, right? But, let's say later in the year you weren't following the election results and noticed that there weren't as many moons as there used to be. You should actually, according to this probability distribution, expect Carol to be elected.

So that's another way to look at these markets. So, the payouts multiply. Technically, this is a tensor product, but essentially, they just need to be multiplied. And when the oracle announces that the oracle announces that , for example, Dan was elected , and someone counted 250 moons, then everyone else's assets except Dan are zero, and Dan's dollar is multiplied by 75 cents and another 75 cents. Good.

So how do you implement this in the form of an Ethereum contract? Well, first of all... Conditional tokens are a kind of way of codifying these rules for collateral collateral . And they only apply to collateral rules. While they don't really explain how to exchange them, I'll still explain how it's implemented as a contract.

This is implemented as an ERC-1155 multi-token, meaning a single contract that contains each individual conditional token, and each of these tokens is associated with an identifier. And in this case, the term chosen to represent this identifier is the position identifier. So, also the conditional token contract that we implemented is oracle-independent. Basically, it is any Ethereum account that can provide an answer to a question, as long as it is formatted correctly. And finally, or no, not finally.

So moving forward to define a condition, you take the oracle and a specific question and just hash them together. This is how you get the condition ID. Conceptually, a condition is a kind of oracle and question: you have a question, and you appoint an oracle to answer it. Good. You also need to briefly talk about the collections of results.

You also collect a range of results for a single question. You can create a thing called a result collection, and essentially it's, technically it's a non-empty proper subset of results for a given condition, but essentially you can, for example, specify Alice or Carol, or, you know, you can just say "Dan" as the result set. Well, you can combine these result sets, e result sets, e , by mm, into a combined result set, and the way result set, and the way you look at these combined sets is that you combine them, probably with a logical "AND probably with a logical "AND ". So in this case, um, this outcome set represents the event in which either Alice or Carol is chosen, and, uh, the number of moons is close to 100. So, uh, if both of these things happen, like if Carol is chosen and the number of moons is close to 100, or if Alice is chosen and the number of moons is close to 100, then this, uh, situation represents this outcome set.

Mm, that's a little easier. It's like, uh, this set of results represents a point where, for example, if Daniel is elected, but there are very few moons. Good. So, uh, to get a little bit more technical, uh, to represent these sets, you actually have to hash them into a cryptographic group cryptographic group . So here I am, I choose to use an elliptic curve.

Um elliptic curve. Um , but, uh, but, essentially, you just take this and hash it into an elliptic curve at a certain place curve at a certain place . And, uh, and then to combine them, you just, uh, you know, you just, uh, take the sum of the group. So here you add the IDs for this and that, and you get this ID. If, if you know anything about curve operations, then, you know, there's a way to add these hashes together that makes everything secure.

And, um, if, if you're interested in learning about it in the literature, it's called an incremental multiset hash. Um, this is useful for, um, hashing sets incrementally so that you can keep adding elements to the set without making too many changes to the existing hash. Oh, um, another digression, uh, in this, uh, contingent token system, uh, any ERC20 token can be used as collateral. And finally, to get a position, you simply take one of these result sets or a combined result set and associate it with some collateral some collateral . So here it's, uh, Alice or Carol and 10,000 moons, um, and it's backed up by " um, and it's backed up by " grove," and then, or here's our other position here's our other position , it's just Dan, and it's backed up by "leaf" and something else.

So, to get the position ID, you would just hash them together. It's, uh, pretty simple. And then, like, the idea is that, uh, all of these tokens, they're all contained in a single contract, which is a conditional token contract. So, um, also I want to point out, remember earlier I was talking about prediction markets in general. You have some collateral that can be divided into such assets, and it is considered equivalent to collateral in the same way.

You can do this with ERC20 tokens, but online, in a trustless way, and supported by automatic contract execution. Yes. OK. So you can also divide further, and that's how you come to a kind of combined prediction markets. For example, you can go from "Den" with "boob" support to " "boob" support to " Den" and 1000 moons and "Den Den" and 1000 moons and "Den " without moons with "led" support.

I completely forgot to point this out, but let's pretend it's there. Yes. Finally, all of this is great, these conditional tokens, but a lot of the real value from this comes from the exchange of these tokens. That is, this is where the information is contained, where you get an idea of ​​​​the odds, market probabilities, and so on. There are generally two main ways to do this.

There are warrant books. You may have a whole bunch of warrant books. The advantage of this is that you don't have limited liquidity with order books. You can place very large orders so that they are filled without changing the price too much, depending on the order book. Ahem.

But with these conditional tokens, the huge number of order books that would have to be managed would make working with them very complicated, especially for the user. On the other hand, there are automated market makers, such as Uniswap or simply for ERC20 tokens in general. Their liquidity depends on how much you are willing to fund the market to fund the market maker or what losses the market maker can expect. But thanks to this, you can also value these assets much more easily. I also want to note that with combined prediction markets in general, if you dive into it deeply, generalization can be a very difficult task.

So why not both options? You could create an exchange- type system where the automated market maker is just another participant. And actually we thought about that too. This is definitely in the works, maybe just having a bot that executes all the trades, and that way you don't have to handle all these automated market transactions on the network, which can be quite expensive. Um, um, although there are actually some advantages to doing this, uh, automated market making on the network, and that is that this contract can also act as a probabilistic oracle, like an on-chain like an on-chain probabilistic oracle about future events, which would be cool.

Like, cool. Like, uh, maybe, maybe uh, maybe, maybe , this uh on-chain , this uh on-chain probability works as it should. Um, here's what to expect if one of these candidates is elected. Maybe Dan is pretty good at, you know, keeping projects alive, and Alice is pretty good at it too, but, you know, Bob is not so good. He, he doesn't really care, you know, about how the market is trading, and then maybe market is trading, and then maybe you could think about, uh, governance mechanisms for that.

So yes. Anyway, uh, that's all I wanted to say. Um, yes wanted to say. Um, yes . A bit much material for 25 minutes material for 25 minutes , but yes, questions.

I know we're definitely, as you know, working with prediction markets and we're interested to see what comes out of that and stuff . Are you guys releasing any documentation on all these concepts or all these concepts or maybe some good resources like GitHub so we can start using this contract? Oh, yes. Um, I, I would like to say yes. We are working on it.

Me, I did it this week. This is all new content. So maybe you'll see it somewhere else you'll see it somewhere else . I don't know. So, I know I don't know.

So, I know that adding elliptic curves is important in cryptography, but where, where does this fit in? Yes. Why? Okay. Okay.

The answer to this is: I spent the last week researching some security vulnerabilities security vulnerabilities , and this ended up being the solution. I just wanted to share a little bit about this. So this is for their unique combination storage. Oh, of course. So, uh, it turns out, let me go back to that point.

At first, uh point. At first, uh , when I was doing this, I was just taking hashes from them and adding them. And, uh them and adding them. And, uh , if you wanted to break this contract now, you could do what's called a generalized birthday attack. And, uh , yes.

And it turns out that in order to protect it from this attack, you need to use more complex, uh, methods of combining identifiers, and then semi-prove it. Combining them using elliptic curves effectively turns this into the discrete logarithm problem on elliptic curves, which, if cracked, would break all of our current accounts. So I think that's okay. Yes. Is the future the primary use case you have in mind for these combinatorial prediction markets?

Um, so, um, the primary use case for us—it's not the future...uh, I just wanted to emphasize at the end, as a potential use case for us, it's really just information retrieval. So, just the idea that you could look a little deeper into the conditional probabilities of things happening, that kind of insight could be useful. Do you think finance is a target area? Yeah, maybe, uh, I'm not a project manager, so I'm not entirely sure.

Uh, I think we're talking about that a little bit. So, maybe. This makes a lot of sense for commodity markets, because you use data about weather forecasts, market conditions, and everything else, and that's how you get a result. Maybe, who knows. Approval from regulators is required.

So it all depends on that. We can do a lot. We. That was funny.

Automatic transcript — names and jargon may be misspelled.