DAPPCON 2018: Batch Auctions on Plasma - Alexander Hermann (Gnosis)
DappCon 2018 · July 2018 · 19:25
The proposal addresses decentralized exchange scaling and front-running through timed batch auctions on Plasma, mapping multiple token order books into a multidimensional search for prices intended to maximize trading volume. Orders would remain encrypted under a DKG public key until batch commitment, with complex optimization performed off-chain and proofs used to verify settlement constraints. The design relies on a central operator and Plasma MVP checking assumptions; orders are eventually decrypted for everyone to see, so it is explicitly not focused on privacy.
Speakers
Topics
From DappCon 2018, hosted by Dappcon Berlin.
Transcript
hello everyone I'm super excited to be here because I can talk about plasma technologies I can talk about badge actions and that's these days like really cool things that are going on in the blockchain ecosystem so I'm a researcher from gnosis and the research of us within the last month was basically focused on how do we build the best market mechanisms that also scale very well about scalable market mechanisms just because we want to build the best decentralized exchange and for that we took a deep dive into plasma technologies because we think plasma
actually offers the best security for our potential users of the decentralized exchange sorry I couldn't understand you can I just go on because I hears noises out of here okay now let's move on don't lose the energy so we are looking into plasma plasma technologies because it's ma'am the technology that offers the best security and what we also do we're looking into batch options batch actions are decentralized decentralized and
discreet in time market mechanism and because it's discrete in time we think it fits perfectly to block change because their disavow and in order to enable all of that we're also looking into cool tool links like distributed key generation little bit into snarks aggregated key signatures and all that we're needing so we worked really hard over the last several months have done travel wreaths workshops and now last Saturday we finally released our paper we're very proud of that and we would be very happy if you guys could take a look at it and give it some feedback later basically we released two papers one is about an optimization problem which I
will explain a little bit later and the second one is about how do we do a data on plasma so my talk has the following structure first I want to give some herbal elations some predictions then we will look into the market mechanisms we will talk a little bit about front-running and then the most interesting part like how do we actually do this on plasma so I want to start off with some teasers so of course you all know like these days most of the people they're still using centralized exchanges and basically it is because they are faster they have the better usability they scale better but of course we think that decentralized exchanges that they are catching up quiet
quickly and that we will probably see in one year already a big shift to these decentralized exchanges the second teaser I have for you is that these days atomicity within traits is super hard like you try to buy a bit over here and then want to hatch immediately in another market over here and while you're buying this one over here somebody else might already front Hetch over here and then you simply have to buy the hatch of the very surprise which is not good so Fran training is in topic and even the normal traditional markets but I think within blockchain technologies it's definitely amplified but we think that our trading mechanisms what we can actually offer we can offer atomic basket rates so basket trades is
that you have a set of tokens and another set of tokens and you're buying atomically with this set of tokens another set of tokens it's it's really cool if you later on think about how you do trade indices and so on and we promise that we can do that completely without front-running now this one is also super interesting so these days we see that we have dominant trading pairs for us in our ECM ecosystem most of the tokens that are traded against the ether but in the future we will think we have many more stable coins and these stable coins probably will change the picture a little bit because the liquidity of these tokens they will split to these different stable coins and we want to come up with a market mechanism that can
also handle these more complex situations so these were the three teasers now let's look a little bit into the market mechanisms which we are actually proposing so already said prior to frequent time like batch auctions but what these what are these actually I just want to give some background so for batch actions we are collecting over the over predefined time and the shortage is predefined time the better it is we are basically collecting orders I want to buy a token a for token B and orders the other way around and then we are always getting an order book and this order book looks quite similar to all the other books you already know the only thing is that the buy orders and the
sell orders that they have an overlap because they are collected over a longer time period and then with this overlap we can calculate for each batch an optimal price so that it the optimal price maximizes the trading volume and then we can settle all these orders with this optimal price and we think this is the best price for every participant so this was the cons of that batch actions now let's take another look at Ring traits it's just the basic concept I want you to feminize with so let's start we have a token a and it token B and there is only a sell order from token a to token B that but no order the other way around
so because we have only in order in one way we cannot settle anything but it might happen that we have also sell order B for a and that we also have is sell order C for a and now what we can actually do we can close the ring and fulfill all the orders so this is the basic concept of ring trade we will not directly use ring trades with something which is kind of similar so I gave you this teaser how do we deal with this new situation what we are proposing is the market mechanism that I want to explain you over here with three tokens imagine we have three tokens a B and C and of course between all these tokens we have
order bugs now what we want to do with these order books we want to map them into a multi-dimensional order book so basically what we do if we are creating an order book with each axis the prices the prices a versus B the prices C versus a and the prices B versus C right this was the last one and now for every heavy point in this diagram basically represents a set of prices and for this set of prices we can calculate the trading volume that we would get if we would look at these order books and now what we are interested in is the price which generates the biggest trading
volume for us and this price will later on give the best benefit to all traders because it will optimize the traders welfare and so what we are basically doing we are executing all ring trades at the best possible price with this kind of mechanism I'm very excited about that it's pretty cool so now I want to explain how that all then works like in the process so we are first collecting orders any token against any token we probably will in our first implementations collect them about like three minutes but we hope that we can reduce this time and then we compute these uniform cleaning prices
just as I explained them before so what is uniform Rises what we want them to have is the maximum trading volume for puzzle prizes we want the prizes to be arbitrary and we want and we have to fulfill some constraints for example that the sum of all tokens sold equals the sum of all tokens per odd basically in order to not generate any additional talking's with that and then we can already settle all the orders so this is how we want to set up the whole process now I promise you that we will show you how to do a batch trading without any front running and I gave you this teaser for it and now I want to explain it to
you the technology that we are using for it it's called distributed key generation and within this friggin distributed key generation we first generate a public key for which the private key is not known and this is what all the algorithm is about so it works like this first we have some bonded participants who generate secrets crypto secrets that are basically pair together and what I will do in the first step they will only provide in the protocol the orange pieces but not the white pieces so they will keep a secret of that and with these orange pieces what we can do we can generate a public
here for which the private key is not known now we move on we are collecting all the orders and they are encrypted with this private with this public key we can commit a batch yes we want to have all these orders in the batch and then only once we have committed to the batch the dkg participants they come again together and generate the private key so with this we are gay basically getting a process within four trade settlement then I also told you that we can have basket trades and within a batch auction you can do they're pretty cool things basically you can put in orders that are conditional so I'm buying here condition as as I'm
buying here conditional the token D with C but only if the orange arrow is fulfilled if C to B is fulfilled and you can make that arbitrarily complex and basically do these basket rates where you're trading the white tokens against the orange tokens so this was all super cool in theory but now we're coming to the exciting part how do we actually do that on plasma so we have specified a specification that has kind of these key features we were running batch auctions all three minutes we will collect about sixty thousand orders in a batch this is around like hundred fifty transactions
capacity we will all build that on the plasma MVP and we will of course like all the trades that will be settled much much cheaper than any on checks will change just because we can use plasma so I gave you this teaser and I think with the specification that I just mentioned we are coming much closer to this shifting point that people really no longer care about centralized exchanges they just prefer the security of the decentralized exchanges now I want to explain like how that all works in plasmas so we start with the basics like how the plasma MVP means and here I really mean the minimum viable product
not a more viable product so plasma is basically a side chain it is built like this there you have this plasma chain which generates some blocks and we have a root chain in which everything is kinda committed and routed so every time we're creating transaction block this block does kind of compress come from meshed it's hash together and then only the hash is submitted to the theorem root chain plasma chains are operated by a central authority and the best feature about plasma exchanges is that if anything invalid happens in the plasma chain then actually everyone can leave the chain and no fan site at risk of course this
is always only under certain assumptions basically that transactions are not centered on the same route chain but we have never ever seen these cases so we really believe in this technology now I want to proceed and how do we actually do that on the plasma MVP with the actions so again we start that we're having a root chain in our plasma chain which is run by a central operator bias and then we are collecting these orders over three minutes we will create an order block and also as all the other transaction blocks they are then hashed together and committed to the theorem
road chain then the operator will calculate all the fancy prices which I told you previously and then we can indirect these prices into the plasma chain settle everything and then already start the next auction so in theory it can go very quickly this is just very very rough picture and now for a little bit more advanced audience I want to go a little bit deeper into detail like how it actually works for this I prepared this kind of detailed chart so we have the theorem root chain and the plasma chain and actually as I told you before we want to use dkg in order to encrypt our orders so first the dkg participants they come together and generate this
public key then we are encrypting all the orders they are all collected by a central operator and then we are generating this order block but within plasma there's always this notion of double signing and of course we also need to double sign our orders and we even need to do it in a little bit more special wave what we are using over here is an aggregated signature so basically every participant who wants to participate in in a batch whereas the order in there needs to hand over it doubles signature to the operator and he then transfers all these double signatures into a bitmap and this bitmap represents
the aggregated signature good now we are the stage where all the transactions are double signed and we know exactly who participates in a batch and then we can move on and the DK Tea Party position participants generate a private key and can then we can actually decrypt all the orders and know what actually is in the orders once this is done the operator can start all the price calculations and he can basically put into the next block all the results into the results are coming the prices we need to put in some snack proofs that prove like all the
constraints I mentioned for example that the prices arbitrage free that the sum of token sold equal to sum of token part and we also need to put in all the volumes with which the orders are fulfilled then we can basically settle the all the orders and move on to the next batch this is basically just the happy case but of course now you're also interested like what happens if the plasma changes goes offline or if the operator does something invalid and I'm going to start like they're basically two cases the first case is when something happens before the double signing procedure but hey that's what we
have the double procedure for then people would simply do not double sign if something goes wrong before the double signing and now if something goes wrong after the double signing we have everything constructed so that we can publicly request the critical information on the serum route chain like a bitmap we can load up to the rich end the prices we couldn't load out at our load up snack proofs we can load up and also volume hash and a private key that's not too much data we can act we loaded up to the CMU chain and then we allow everyone to settle their orders actually via the exit and with that funds are never ever at risk so we are
super excited about it I know this was a lot of details and so on but like the key picture that I want you to remind after the stroke is basically this one because it describes the best what we are doing we are taking lots of water books put them into a multi dimensional order book and then settle everything on the best prices and we do it on plasma so I want to thank you all for your attention and of course also special thanks goes to the team who helped all the time with the incredible work thank you all thank you it's a great presentation so we've got a couple questions here the first is regarding the the reading training mechanism and
finding the optimal price is that something that's done on chain because it sounds like a very expensive operation or is it performed off chain the cool thing is that we can actually do that off chain we really have to do it off chain because it's quite complex it's an optimization problem you simply don't want to do it on chain but the good thing is that the constraints that in the end need to be fulfilled they need to be somehow proven on the theorem chain and we can do that with snacks very efficiently and that's that's the beauty in it okay and then the second question and there are a couple questions about this is about security and privacy and confidentiality how do you ensure the confidentiality of users performing trains carry trades on the plasma train
so privacy we can these days not really insure and what is the second part the country ability so there's a question here about the security modeling and how this system ensures confidentiality of transactions perhaps the person who asked the question would like to clarify what exactly is meant in this context the content how's that word called continuity okay I mean maybe you can just address confidentiality so we think that security is all the time given that people never if they are constantly
online if they're checking these with the same requirements as the usual plasma MEP then risk the tokens are never really add risks and the privacy is given only while we are encrypting orders but later on they will be all decrypted and later on everyone can see exactly which orders were placed so it's not yet focused on privacy we are just happy that we can put this already on plasma exchange only great thank you very much [Applause]