DEXs for a Multi-Token Future
ETHCC 3 · March 2020 · 22:07
Christiane Ernst discusses decentralized exchanges designed for a future with many tokens.
Speakers
Topics
From ETHCC 3, hosted by Ethereum France.
Transcript
cool hi everyone my name is Chris I work at canosa on decentralized trading protocols and today I get to speak to you about Texas for a mighty token future on patch auctions and ring trades already a lot of information on the first slide so let's just look at what we are looking at today and the first two times I came to ECC I spoke about the Dutch X so that today I actually want to move on from the Dutch X and tell you about the limitations they are off to then tell you about a new exchange protocol we've been working on which we currently call the diffusion so again before we really dive deep into the details let's just zoom out again
and ask what's the motivation why are we building another decentralized exchange so we like to find efficient and fair market mechanisms for trading that are actually tailored and adequate for blockchain so that they can be used in discrete time that you have on blockchain because you only have block time also we would like to create something that is fully decentralized and permissionless so for example you have permission decentralized exchanges where for example de automating is actually done off chain and set it on chain we are thriving to build something that is fully permissionless and lastly also something that is tailored for low liquid tokens which you have plenty of
and so what we did we looked at auction mechanisms to solve still to solve this and some auction mechanism mechanisms actually promised that they may lead to better prices and are less prone to front-running so the first thing that we looked at where the Dutch auctions so who here is familiar with the Dutch X okay about half so just a little recap on it so it actually comes from the Dutch flower market where sellers came together in bunches wanting to auction off em crates of tulips for example and they were to get rid of the noise in the auction hall so they said let's start with a
really high price let's ask for 3 euros per tulip and per unit and then let's drop the price until we find somebody who's interested in buying so they dropped the price the first person interested is at 1.8 per unit and wanting to buy 5 of 20 and this kind of game continues until the entire volume is so it and but the nice thing about this is that everybody actually ends up paying the last price so we took exactly this concept and applied it to the blockchain and the Dutch X so sellers would come together to batch together the say token and in the auction they would action off in the that could
bright em would auction off these head Hawkins for bidders to come during that auction so we really liked this mechanism for mainly two reasons one it kind of got rid of the whole front-running problem and and bidders had an incentive to reveal what they were really willing to pay because if they revered this they ended up paying the last final price and if they kind of try to mask their bit and only bid later on they would maybe miss out of the auction however I want to pinpoint three limitations of this system also applying it to the blockchain one was that it was very slow so the way we implemented is that the price would drop over a six
hour period and that's not really something that traders would expect to wait for so long to exchange their tokens also sellers didn't actually have a price guarantee because they had to wait for bidders to show up during the auction and which was also sort of made difficulty by the fact that information was not readily information made available for them to come at the right time though it was useful for low liquid tokens because of the long patching period and it actually still required to have a sort of more prominent counter pair so say with ether for example so it wasn't quite as tailored to low liquid tokens as we'd hoped for
so we took these learnings and a bunch of other things that we've been working on and we came up which is currently the working title of the diffusion a different fully decentralized permissionless trading protocol again I'm zooming out a little bit and tell you about the vision we have of the future we envision the future to be a mighty token world and with ESC 20 tokens new ones being coming to life every day and also the entire new news case use cases you see every day together with really tokenizing everything and we see that there won't be one dominant sort of trading pair as
you might have in the current world but also with the rise of so many different stable coins there will be the need to exchange any token to any token so with that vision again why are we doing this we really think that the diffusion protocol will lead to fairer prices also for low liquid tokens so with that in mind let's look at the theory behind it and see how we applied it to the blockchain so how do we think we can achieve this so we're introducing a novel trading mechanism which is basically based on three separate mechanisms of features in themselves ring trades batch auctions and uniform clearing prices and I would go into one
by one of these terms now to explain what that actually means so what are ring trades so usually when somebody wants to do a trade say died for USD C you need to have a counterparty so if I want to exchange die and receive used EC somebody needs to offer me UCC for die so if that doesn't exist it's usually a market maker who does it at my expense for ring trades you don't actually need this all I need is to have somebody who wants to sell us DC for packs and packs for die and we can all trade with one another without having the exact counterparty and this ring trades can actually be arbitrary long rings it doesn't have to
be constrained to just three what does that mean well it does increase tradable liquidity and we've applied exactly this mechanism actually to crack in other books that were just sitting there unfit and we saw that more orders were matched so increases liquidity in Abel's illiquid tokens because I'm not required to have for my very low liquid token the exact counter trade available and it also means that anyone can exchange any token versus any token without the hassle and the fraction of going say through ether so what our batch auctions this is not a batch auction this is a normal usual
content continuous auda book which is prone to front-running so you have the notion of a the notion of a maker and to take on the left you see the bids this is what I'm willing to pay for the token and they ask what I'm willing to sell the token for so as you heard in the presentation earlier there's a spread in between and if somebody now wants to want to execute a trade they come in and it's being orders a process sequentially at the price that they're being put in in contrary on a batch on a book actually batching happens of a period of time where orders are collected batch together and executed at the same price
where supply and demand meet at an optimal price what does that mean so firstly it takes away the so notion of a maker and a taker it also means that the sequence of the order execution does not matter which means it's much less prone to fund running and it fits the discrete time space that we have here and there can't be any high frequency trailer for example okay moving on if we put together rings and batches something happens that we like to call what mighty dimensional order book and the diffusion has exactly one multi-dimensional auto book so here you see it across every of those two tokens but in fact it's really
only one order book where we display any against any other token okay batches are cleared at uniform clearing prices which means everybody who participates in this batch gets the same single price price clearing what what is optimized what what prices are we looking for so the criterion that is maximized for it's actually the traders welfare so what does what is traders welfare so we've defined it as say somebody wants to sell at most sixth I and receive at least at least 6 USD C and so it sixth I received six point two years DC we say that's the utility of
zero point two in fact it's actually more complicated than this and if you're really interested in fair price finding and how it works on the diffusion I really highly recommend to hear Felix's colleagues of mine talk at 4:30 later this afternoon ok but what does that mean now so there's no price discrimination of the orders because the sequence doesn't matter and everybody is cleared at the same uniform clearing process they also get at least the limit price so in usual order books when when traders want to do an order they usually get what they actually they get their limit price here this is the sort of the the minimum they would be receiving it's less prone to front running put together
with ring traits and batches actually okay having said all of this it the diffusion is permissionless and fully decentralized however calculating these optimal prices and with this combinatorial problem that you have every token versus every talking token maximizing so traders utility and this is not easy it's an np-hard problem and can't be done computation chain so this is actually done off chained by some something we call a solver anybody can be a solver and submit a solution to the blockchain the smart contracts will pick the best solution
and everybody who does submit a solution has to abide by the same rules and has to look at the same constraints that means every traW order has to be respected by its limit prices and amounts that a trader wants to sell or buy and take into account the actually balances that a user has plus the sum of the tokens going in has to equal the sum of the tokens going out so nobody extracts value this is what we call a token conservation and there can't be any arbitrage within a patch so nobody can trade along cycles and take out value which also means that a price of A to B has to be the reciprocal price of B
to a so anybody solving this maximization problem has to abide by the same rules and the best one gets picked by the smart contracts and everything is settled on chain okay I've told you about the theory let's look a little bit about how we applied this to the diffusion architecture and how we put this on chain first off it's fully decentralized which means the protocol doesn't have an owner there aren't any admin keys there's no pausing there are no upgrades possible anyone can list their tokens to the smart contract layer and as I mentioned a bit the optimization being solved off chain it's actually validated and
settled on chain and this is a little picture of how the diffusion works so let's go through a trade by a user so if I wanted to trade a first deposit and my tokens on to the diffusion smart contract I place my order only from the next batch onwards so batches are these cycles in which trades can happen which we've defined to be five minutes long and they happen one after the other so in the next batch my orders and deposits are available for trading a solver can pick this match it and set it set it matched and set it on chain and then in
the batch there after I'm able to withdraw my fence again this is a little bit much detail but I want to tell you about the orders because I is this knowledge later on when I tell you about the first use case so I said it's fully unchain and people put in limit sell orders partial feeds are possible and a market order can be mimicked by a low limit order and within every order a user can say from which batch to which batch it's valid so sort of pre scheduling is possible as well orders are completely independent of their deposits so I can have artists in
the system without having the deposit for it I can also have deposit and multiple orders say I have a hundred died on the exchange I want to trade I UCC die gemiini die packs and whatever gets fed uses the liquidity that I have so this is also a great asset for market makers because they shared liquidity between orders this is a feature in order back I tell you about some limitations of the system so they aren't any atomic trades possible due to the batching nature which also means for example that there are no flash loan attacks possible facilitated by the diffusion protocol there is no instant
finality so a user actually doesn't know ahead of time if their order will get matched and they don't know the prize ahead of time other than it will be their limit price or better and the diffusion in this very first version is also not useful as a price Oracle however it also doesn't use a price Oracle because everything is calculated intrinsically in the protocol which is kind of cool I want to tell you about the first use case which we think is very powerful for now let's call it the stable current converter and it actually plays on the fact that stable coins are a little volatile around say use dollars around the $1.00 mark it's somewhat
similar to like if you know if you're familiar with the unit's whirlpool or curvy fire it's a little bit familiar with concept it's really good for liquidity provision and market making also by sort of anyone and it plays with the fact that liquidity is shared between all the trusted stable cons so how would it work a user would say okay I personally trust I Park Zoo's DC and Germany and would say I would trade up two percent every time there's a trade so I will offer one die if somebody gives me one point zero two packs or any of the other stable coins so I select the spread and then the system creates standing orders at a very very high like
amount level that will never get filled so they last for a long time therefore high amount and every time this happens I trade on this 2% and basically let let my funds sit there for this to work I have to deposit at least once and the cool thing here is that the liquidity is really not siloed to like a pair but it's shared between anything that I select so it's really capital efficient so there's no maintenance fees to it I wouldn't have any gas cost after having set up my orders I can still cancel at any time and it's shared liquidity so where are we I've told you all these
cool things and we are actually getting there so I'm super excited to tell you a little bit about the stages we've gone through so this project has been in a research stage stage for more than two years mainly finding this optimization criteria which is really hard to define and see what really works and solving this mathematical problem is also quite difficult so this has been going on for two years we went in to audit early January and have a back bounty running which is nothing has been reported but - feel free to check it out if you want we've been doing mainly testing on the smart contracts ourself and last week
also with a synthetics community and I think there's currently two hundred and twenty thousand US dollar worth in the smart contracts so we're looking at a launch what does the launch mean so people usually need something to interact with and so we're there's this interface coming very very soon we are currently getting a few last user feedbacks on the better version if you're interested come by our booth and we'll sign you up for some user testing okay lots of information just again quickly the takeaways ring trades batch auction and uniform clearing prices on aetherium lead to hopefully fair price finding for
decentralization which helps sort of permissionless integrations and capital efficient liquidity provision if you now think what did she talk about or I want to know more or I didn't understand we have this deaf portal which is just very early stages but you can find the smart contracts and the audit report you can find some documentation and some statistics and data on the smart contracts on there and if you have any questions later come find me or us at the booth I don't know if we have thank you yeah I think we have two minutes for a
question hey you said like that it won't finish like be final within a transaction like when when we expect like an art can actually be finalized after n blocks or after them like what's it so it's within ER so if you enter a batch and within this batch the solver actually has four minutes out of five minutes to find a solution so anybody can submit solutions within the first four minutes and in the last minute it should actually finally how and if your mod order has been matched does that is that the question you were hinting at
yeah I think so it's gonna be a couple of blocks later and then there's a callback or like how do you how do you as a user in a smart contract know like this actually got executed or you need to look at the locks your oh yeah there is a trade event the trading yeah I have a question so how do you define the like the battery sort of the Rings so to say I mean it can happen that maybe they are not overlapping so there are a number of orders and so there needs to be a logic probably - if there's nothing overlapping then they can't be matched but essentially that is what the solver does so the server finds the optimal solution of anything that's in the
system but so there could be like thousands of order in the system the server looks at all of these orders plus the balance is available from the traders and finds an optimal solution based on the maximization criteria set wellthanks them so if they are no overlapping orders there won't be any matches I think there's one more if we have time for one more so what's the incentive mechanism for the solvers to operate right so something that I sort of abstracted away here is that there is actually a fee for trading which is ten basis points off the volume so 0.1%
and half of that goes through the solver because the server pays for solving the maximization problem while being written in the first place being hosted solving it and settling everything on chain paying for the gas costs so it's actually relatively expensive to be a solver and so the fees will go to them the reason I abstracted away from the fees is that they're already included in the limit price so other than unusual exchanges where you pay your trade and then you pay the fee it's actually still the limit as kept regardless of the fees thank you cool thank you [Applause]