Gnosis Protocol v2 Fighting the MEV Crisis with Batch Auctions one CoW at a time
ETHCC 4 · July 2021 · 46:29
Felix Leupold explains how Gnosis Protocol v2 uses batch auctions and competing solvers to protect trades from front-running and MEV. He describes uniform clearing prices, direct matching through coincidences of wants and the use of Ethereum liquidity for unmatched orders.
Speakers
Topics
From ETHCC 4, hosted by Ethereum France.
Transcript
okay hello everyone i'm here to talk to you about cow swap today or more importantly about the underlying trading mechanism that is powering cow swap today that mechanism is based on batch auctions and it is what we think a key mechanism to prevent maximally extractable value or minor extractable value at the protocol layer so the title of this talk is how we can fight the mev crisis with batch auctions one cow at a time my talk is structured into three parts
roughly the first and the first one i'm going to talk about what are the pain points of decentralized trading today i will then segue into the core ideas of gnosis protocol version 2 the underlying mechanism behind cow swap and then in the end talk a little bit about how we apply that mechanism in practice today with our trading ui that we called cow swap so pain points of dextrading today if any one of you has tried to make a trade on chain in the last six months you might have noticed that transaction management these days is really really hard we hope that this will become better with eip1559
so choosing the correct gas price might be easier after that but right now it's still extremely hard for a retail user to decide what gas price to pick and we ran a little study on uni swap trades where we basically checked for a given trade in a block how much gas did that trade pay and how much gas did the cheapest transaction in that block that had roughly the same complexity roughly the same size as the unisport trade had and with that we figured out that the average user today is overpaying their gas fee by roughly 11 doing this yourself is quite hard so choosing the correct gas price is hard if you were to say well i'm going to low ball my gas estimate and i'm going to
take a slow or you know just a low gas price then you're running into problems that the prices that are on chain are changing quite frequently markets are volatile and so are the best execution paths that you can use for your trade let's assume you're using a dex aggregator and you want to trade use dc for eth we ran a study that for a size of about 10 000 us dollars we checked how often does the best execution path change basically within well what what is the what is the interval in which the best execution path changes and depending on the current volatility that turned out to be somewhere between 15 seconds in one minute meaning that if you sign a transaction today
or at some point in time and then it sits in the mempool for about a minute or longer it's pretty likely that it's no longer the best execution path and there's even some chance that the transaction may fail after all because the price will have updated and so what you need to do is you need to set a quite lags slippage tolerance you need to be willing to trade not at the price that was shown to you in the ui but potentially at a worse at a worse price and this problem is amplified for multi-signature setups even more because there you are guaranteed to have a delay between authoring the transaction trying to decide what you want to trade and actually sending it if it's just a multi-stick that you control it might be a couple of minutes between you can get like between the time that
you can get all your devices together but if you're a distributed team in different time zones there might be a couple of hours until all your team members have signed and if you're a decentralized organization that maybe needs to go through a vote there can even be days from the time that a transaction is proposed to when it is executed and so the price changes in this time frame make it really hard to make sure that you're getting the best execution and then the last point i already hinted at if you're not setting a lag slippage requirement if you say i want to have a really tight price and a really low gas price then you run into a very high likelihood that your transaction might end up failing and when we have gas prices like we had in the beginning of may or at the end of
last year a failed transaction can cost you easily a hundred two hundred dollars for nothing and in our case study we found that about eighteen percent of uniform trades and about ten to fifteen percent of dex aggregator trades uh were failing and that was taken in some um one week in in january so the key takeaway transaction management for retail users is really hard the second problem with dextrading today is mev minor extractable value or how it's coined more recently maximally extractable value and i'm sure most of you you know how mev what mev comes from where mib comes from but i'm still just going to briefly describe it again the core reason why we have at least
index trading mev on ethereum today is that the execution price of your trade depends on which index within a block your transaction is mined so we took just a random block from ethereum from mainnet here and we dissected it and we found that there are five trades on the same token pair ether yfi most of them were on the same protocol even but all of them have a different price some of them have a slightly different price but there's even like a significant price difference in some of these trades and now of course as a user you look at this and you say well i would i would like to get the best price of them can you please put me in a position where i'm where i'm receiving the best price however this is not up to you to decide the miner has the ultimate control over
how to assemble trades within a block and you can be sure that the miner doesn't put you in the best spot that is well that is best for you but instead the miner will add transactions on his be on her behalf into this into the block composition to make sure that they can extract as much value as possible there's three kind of classic examples of mev that i'm just briefly going to repeat here the first one is called front running one example of frontrunning would be for example a smart contract hack or a very heavy liquidation where somebody was able to buy a debt position at a discount basically any transaction that gives you some value gives you some benefit
a miner might see that transaction in this case it's tx3 and the miner might say well instead of you getting the benefit i want to get it i'm just going to create a new transaction that goes in just before yours and snipes away that opportunity from you in which case your transaction is likely going to fail another example which is maybe more relevant to everyday dextraders is when is is called back running which may happen for example if you're doing a if you're not using a dex aggregator but you're doing a 10 million trade or even a 1 million dollar trade on sushi swap you're going to change the reserve price of the sushi swap pool quite significantly but the reserve prices at uni swap and balancer and what other amms they are on chain
are going to remain the same so someone a back runner has an incentive to come right after your transaction and basically take that arbitrage make sure that all the amms on chain have the same reserves and show the same price in which case your target transaction would be um succeeding but there's somebody that goes in right behind you and uh and tries to take that arbitrage away and then kind of the meanest case of mev is what we call sandwiching and that comes from the fact that today when you place an order on uni swap you might think that it's a market order but in reality it is a limit order that you where you control the limit price by the slippage tolerance that you are setting in the ui and if you're for example saying that you're willing to buy eth and you're
willing to buy it with a large slippage tolerance maybe something like three or four percent then this means that a miner can actually go in just before your transaction raise the price of eth to your limit price to your you know maximal pain point then execute your transaction which might if it's large enough rise the price of even more and then the miner would basically reverse their initial trade and sell that eth put the price back down and because they've bought low and sold high they likely have made a product profit mev is becoming a bigger and bigger topic this graph is taken from the flashbots team which are which is a team that is doing tremendous work in democratizing and visualizing mev
basically making sure that we as a community understand the problem and start reacting rather than thinking like oh well as long as nobody exploits us we are fine we can keep building protocols that are prone to mev and on this graph you can see that well in the year 2021 we've seen kind of an exponential growth in the amount of value that is being extracted from traders by miners but not only in numbers also on twitter you can see various celebrities complaining either about mev or asking how they can invest into mvv protection projects or even the the coindesk article was suggesting that well why don't we start suing mining pools that are registered in jurisdictions which don't allow market
manipulation because well at the end of the day minor extractable value could be seen as market manipulation and so we could we could try to sue them of course this is not what we want to do we are not in the business of suing anybody we want to build technical solutions to this problem and so as a community i would say we've found three layers on which we can attack or try to minimize or prevent mev the first one is the is the blockchain base layer so ethereum as a protocol in itself and there have been various proposals on how we can prevent mav at the base layer but our take on this is that if we look for example at eip1559 these kind of changes are likely to take years before they come into
reality we have built such a good protocol that everyone loves and we're kind of reluctant to make changes and mev is there today so we think we need something that not only relies on a blockchain that might not have mev but also a mechanism that is that is minimizing the extractable value the second layer which is where i would see the the flashbox team for example is saying let's leave ethereum as it is but let's build additional infrastructure on top to allow well in this case it's um basically what flashboss is doing is is creating a new communication channel between the traders and the miners in which you can say well i'm not only just telling you i want my transaction
included based on a gas price but i'm actually attaching a condition i say i will only pay you if some condition is met after my trade has gone through so it may be that i'm not failed or an arbitrager might be saying that i only pay you if my arbitrage opportunity was extracted but so it's it's yeah it's not really changing anything on the mechanism it's not really changing anything on the blockchain it's just an additional piece of infrastructure to well more effectively in a way communicate between the traders and the miners and then we have the application layer which is where we also see our protocol kaoswapanos protocol and there are some other projects on this layer as well but we think we need different market mechanisms different trading protocols
today so that the amount of mev that is in the system can be reduced so let's talk about how we can achieve this with nosis protocol one step back to the transaction management is hard slide as a problem uh there's the there's the first one of the first principles that we need to we need to agree on that we need to achieve in order to have a better trading mechanism is we need to stop people from signing executable transactions where they're saying here i want to trade on uniswap and giving these transactions directly to the miner via the public mempool because those trades are very likely to contain mev and if you're giving them via the public mempool to the miner
we have seen that they will maximally extract you they are not acting in your best interest they will just try to get as much out of them as possible so what we need to do instead is instead of signing an on-chain executable transaction we just sign a message that is saying i'm willing to trade this token for that token at a specific price and maybe with a timeout and then we can give that signed message to a third party a professional third party which in other systems might be called a relayer a notice protocol is called a solver and that professional part you will do the trade execution on your behalf now you might ask so how am i guaranteed that the solver is
acting in my best interest well first of all there's a longer lasting relationship between the user and the solver if the solver was misbehaving the user would just not use the service but on the other side at least in gnosis protocol solvers are also bonded with with basically a stake in the system and most of the malicious behavior that we can see today are actually provable after the fact you can pretty much look on chain and you can see oh yeah i was i was screwed by the miner here and so if you have a solver that is bonded we can have a protocol that slashes or penalizes misbehavior and pays any damage that has been occurred back to the user and maybe just by itself the delegated trade execution model already has a bunch of advantages
first of all the trader does not commit to a concrete execution plan the trader doesn't say i want to go to uni swap or i want to go to sushi swap the trader just says i want to trade a for b at that price and this allows the solver to make adaptions adaptations to that route at the time that your transaction is executed so if we are in a very volatile market and the best route changes frequently the solver can decide well what we thought 30 seconds ago was the best route is no longer the best possible execution but i found another execution which still satisfies your limit price and this is super valuable for multi-signature wallets but even for regular users because the solver can retry your trade again and again even if the underlying
route changes the second advantage for traders is that you only pay if your trade gets executed sending this off chain message just the signature is free because well signing something doesn't cost you any gas and when a solver executes your trade of course the solver has to pay for gas um but that only well basically the way that that the solvers are incentivized is that from your from your trade amount basically from your proceeds let's say they can take a small a fraction that you you sign beforehand here's the amount of my buy token or the amount of my cell token that i'm willing to give to the solver that settles my trade for me
in the case that it goes through so you only pay a fee if the trade is executed and you can pay your fee in a token that is different than eth you don't need to own native eth in order to be trading vianos protocol and that's a super nice experience because well you you don't have to sell your precious ease you could it feels like it's you know it's a gas-less trading experience and we feel like this user experience is actually much better than the existing sign and pay for your trades with eth now at least in the single trade execution model that i just showed before there is the drawback that it is slightly more expensive to do this to do this execution because we now have to verify two signatures we have to
verify the base layer zero ethereum transaction signatures and then we also have to inside a settlement contract verify that your intent actually comes from you that you've authorized our settlement contract and so there's just a little bit of gas overhead that that makes trading slightly more expensive in the case you're all by yourself however the second cool part about this delegated trade execution is that you don't have to be by yourself solvers can now aggregate multiple intents to trade together and settle them all atomically in one etherium transaction and this in itself might already give us gas advantages because when let's say two traders are trading against uni swap
today they would be in two separate transactions two separate calls into uni swap two reserve updates um and this would cost well more gas than if we had if we would bundle them together and just do one invocation into the uni swap pool so just by batching users together we can we can in this model even be more gas efficient the other cool thing that aggregating user orders together allows us to do is that the solver now has first of all control to apply certain soft rules on the matching that it wants to do but also that it can use the balances of each user to trade them peer-to-peer rather than settling them with on-chain liquidity
and so this is kind of the the second core principle of noise protocol which is that all our trades are settled in batch auctions with uniform clearance prices now just to maybe recap again where does mev come from mvv comes from the fact that today in ethereum you have a block with multiple trades on the same token pair and they trade at different prices and then you can see some some searchers or miners that come in and try to buy the the pair at the lowest price and sell it at the highest price and basically assemble their trades in a way that maximally benefits them and this kind of mechanism where you have a kind of first come first served time price priority uh comes from traditional finance and in traditional finance it makes a lot of
sense because we have a continuous market and when something happens in the real world we want to incentivize players to update the market price as fast as possible so that we have an efficient representation of all information inside let's say the apple stock price or whatever we're trading however on ethereum we don't have a continuous system ethereum only gives us new information every 12 to 19 seconds when a new block arrives and when that block arrives all the information that is included in that block arrives at the very same time all transactions have the very same timestamp so applying such a principle of first come first serve price time priority to ethereum is in our opinion not meaningful at all and this is why in gnosis protocol we
say well let's batch all trades together and if they're on the same token pair they should all get the same uniform clearing price because there's no advantage in giving them some some ordering priority just to maybe give a little bit of a more intuition of how batch auctions compare to continuous traded order books on the left side we have a continuous order book and the key here is that well you have the bit curve and the ask curve and they will never overlap in the moment that somebody enters this order book and says i want to buy something at a price where there's an offer on the other side it will immediately settle these the bid and the ass curve will never overlap they will always kind of almost kiss each other in the middle at
the bid ask spread that's a little bit different for batch auctions because we're collecting orders over time there might be somebody that is willing to buy ether for up to two thousand dollars and somebody else that is willing to sell ether for as little as eighteen hundred dollars so there might be an overlap in the bid and the ask curve and by the way these kind of auctions are also um existent in traditional finance today for example the opening auctions at uh at most exchange markets work with such a overlapping order book and then the best way to clear those is to try to match the demand and supply um exactly so where the bid and the ask curve intersect that's basically the price that should be chosen to perfectly match demand and supply
and now the key principle of uniform clearance prices is that no matter where you are on the orange curve or on the blue curve as long as your limit price is satisfied you will actually be executed at the uniform clearing price and the difference between your limit price and the uniform clearing price is what we call trader surplus just to go back to the example if you were willing to buy eth for two thousand dollars and we ended up clearing the badge at nineteen hundred dollars we are going to give you a hundred dollar price improvement on your limit price so for every eat you buy you're getting one hundred dollar trader surplus and this is nice because it gives us an objective criterion a metric that we can use to check how much
value are we providing for traders and that we can try to maximize in order to create the fairest mechanism this maximization now becomes important because the examples so far were in two dimensions you always had like ether versus dollar and we think it would already be great if we just had uniform clearing prices on each individual token pair within uni within ethereum that would already be a great improvement but in order to make the mechanism even fairer even better it would be nice if we can expand this model not just to two-sided order books but to multi-dimensional order books and let me just kind of explain why this is nice um so one way that you might think about well we can just use our
two-dimensional order books and let's say we have i think in the example we have die ether and usdc in our in our block let's say a random block is trading these three token pairs we could create the two-dimensional order books find the the intersection and then announce this as the clearing prices for each pair however that in itself might still bear some arbitrage opportunity i just made an example there where the price of die against ether is 2400 and the price of usdc against ether is 2500 so everyone that is trading on the same pair still gets the same price however you could still enter with 2400 die and then make a nice ring trade to exit out with 2500 die so there's still arbitrage opportunity in the system
and while it's arguably more fair and less mev prone it would be nice to remove that arbitrage and say within a batch we announce prices that are coherent that are basically arbitrage free and the way to do this is by saying well our prices are not based on pairs but they're based on a price vector so basically there's a reference currency in this case it would be one dollar and then we can say the price of ethers 2 900 the price of btc something else and if we now want to check what is the exchange rate between btc and eth we can just do this by building the quotient of the of the two values in that vector and so what we now task the solver to do if you remember back to the
executed trade delegation we ask the solvers to take all the orders that are in a batch and to then find a price vector where the trader surplus is maximized over all the trades that are in the batch um basically meaning that if that price if your limit price is fulfilling the price then you would be executed if it's not fulfilling that price you're not executed if you're right on the price then there might be a partial execution but this is kind of this is a very complex np complete problem which is why we think that the solver infrastructure in itself needs to be a competition between multiple decentralized parties where people try to maximize that value that i've showed on the slide before
trader surplus and whoever solver has the solution that generates the best trader surplus is the solver that can then settle the batch and this way we can make sure that users always maximize the surplus that they get in our protocol now if i lost you if i lost you here on that multi-dimensionally that's that's totally fine i want to now come back more to cow swap and maybe the more intuitive ways of how we can fight mav already today um so the yeah the the reason why cow swap is called cow swap is because of this economic phenomenon which is called coincidence of wants and maybe the best metaphor for this would be if you're traveling from the us if you travel from the us to paris and you maybe you arrived well i guess we're
all encrypted we don't need cash or we don't go to the airport to trade cash but a lot of old people that arrive from the us and paris they go to the exchange bureau at the airport and want to trade their us dollars against euros and then there are a bunch of french people that will go and travel to the us and a charlie gold airport they go to the same bureau and they trade their euros for for usdc or usd so what they could do instead is they could just walk up to the line and ask a random person hey i have euro i want usd do you happen to be on the other side of the trade and if they found a person like that they could save this i don't know three percent four percent spread that these uh blood sucking exchange offices at the airports take
and this idea is basically what we want to bring to ethereum as well so today if you have in the same block two people trading here it's a usdc for eth and another person that is selling one ether for usdc what would happen is they would both trade against uni swap for example they would both pay a liquidity provision fee i think now it's 0.05 but it's still a fee that gets extracted from their trade amount but at the end of the block the price would have not moved at all the uni swap reserves would be exactly in the same place where they had been before and the only value that this pool was providing is to basically act as a sponge between trades that happen within one block in nosis protocol because we're batching trades into a single ethereum
transaction we don't need this intermediary pool we can just settle people peer-to-peer directly against one another and save the 0.3 spread now you might say well it barely happens that people are trading the exact same amount at the exact same time but first of all even if the amounts are not exactly the same we can still match the smaller trade with the larger one and then use that left over the excess of this larger one to just go and trade with the best on-chain liquidity so let's say in this example would be uni swap and also we don't necessarily have to look at the top-level trade intents that are happening but we need to in dissect the trades into the underlying route that is taken to
actually execute that trade so today for example if you're buying a if you're selling a project token for us dollars most of the time you're going to do a 2-hop trade where you sell the project token first for wealth and then you sell wealth for usdc and then maybe there's somebody else who's buying another project token with usdc and now even though these trades look completely different if you dissect them into its components you can actually find a coincidence of want and you can replace this coincidence of one via p to peer trading and then you only have to um swap 50 usdc against weath instead of swapping 100 200 ucc against with and for every dollar that you that you save
settling against a liquidity provider you save some fee that you're paying for that liquidity provision and this is basically how our protocol can give a structural advantage to traders and can make prices fundamentally better than well dex aggregators or other systems today so how can you try it out what is how does this protocol work in practice first let's maybe recap what happens when you're trading on cow swap today as we said you're not signing a transaction you're only signing a message saying you want to trade token a for token b at a certain price and then you're broadcasting this message of chain to our batch order book
and then we have a bunch of solver implementations at the moment we run about five but we are looking to decentralize this component have other teams provide solver implementations we are offering grants and well at the end of the day solvers will receive a payout of the fees so there should be an incentive for people to become these these kind of solvers they basically listen to our decentralized order book they just check what are the orders in the order book and they craft fair solutions optimizing this trader surplus they then communicate against amongst one one another what is your solution what is your solution and the one that maximizes trader surplus is allowed to then report that solution on chain to the gnosis protocol settlement contract again if you misbehave if you if you say you have a great solution and then you
publish a shitty one you're gonna get slashed inside the settlement contract what then happens we will first match all the overlaps we found all the cows peer-to-peer and whatever volume is left that we cannot trade with one another and frankly at the beginning this will be a lot because well it's kind of a network effect based protocol where the more traders we have the more likely those cows become but whatever is left we can execute it against the best possible on-chain liquidity um that exists like we we are not we can tap into any on-chain liquidity it can be sushi swap balancer um we actually have an integration with the the balancer vault that all things considered even if if the prices on balance or the prices are similar to the prices on uniswap it
is slightly more gas efficient for nosos protocol to trade via balancer but fundamentally we are agnostic to the underlying liquidity sources and maybe just one more word yeah the the d5 lego pieces that are chosen for the access also get computed by the solvers so the the smart contract is very light contract that basically verifies signatures verifies limit prices but the actual logic of how to match things against one another happens in the in the solver part of chain okay so um mev protection also was was kind of the the theme of the talk maybe to recap how are trades protected from from mev there's there's basically two parts of it
the first one is if your trade is part of a coincidence of wants then you're fully me protected because the the price at which you're traded is decided off chain we're just transferring tokens back and forth it's it's a little bit like a 0x rfq order and it doesn't depend on the ordering in the block at all it's also maximally gas efficient because we're just transferring token back and forth we're not updating any reserves or changing any other amm state and there's no lp fee that we need to pay and so inside this red box you really have full mev protection you have better prices for the users and you have less gas costs now of course this only works when a lot of people are using nozzles protocol or cow swap
with everything that cannot be matched inside a cow we go and basically search on ethereum all dexes we we have a solver that is integrated in the one-inch api we're acquiring the power swap api matcha so we're already effectively a meta dex aggregator that makes sure that even if there's just one trader in the batch they get the best possible price that is available on chain and the way that those people are meb protected is by the fact that our solver is a professional entity which can estimate gas prices much better it can subscribe to the mempool and watch for race conditions if the transaction would fail it can replace it or at the moment we're even working on integrating mevgeth so that we don't have failed transactions at all and are competing with
searchers or other people that are trying to extract mev but we are of course on the side of protecting users from mev but to summarize that even in the case when you're by yourself it is still a much better protection from me than you could have it compared to when you're using metamask or whatever wallet you're using by yourself today which doesn't give you any protection so cow swab dot exchange was initially designed to be a proof of concept it has gotten quite some traction and we've gotten great feedback so at this point i would no longer say it's a proof of concept it's actually a product and for us it's the first trading interface that we've built on top of gnosis protocol v2 and you might have kind of seen that
under the hood nosis protocol v2 is really agnostic to where its orders come from it's really important that it gets order flow however because the more orders it gets the more potential there is for these cows to be found and the more potential there is for users to get better prices with cow swap we started at the status quo of user experience we tried to see what are the minimum amount of changes we need to make to the uniswap user experience in order to get people to use this new trading mechanism and so if you visit cows it should be very familiar to to you if you've used uni swap in the past the only difference is when you when you actually click swap you're not signing an ethereum transaction you're not paying gas for that you're assigning an off chain message and in the future we hope
that there are many more interfaces which will send their order flow via gnosis protocol because we hope that these interfaces care about mev protection for their users care about that their users receive the best price and this is something that with nozis protocol we can guarantee um well better than than any of the existing protocols that we know of out there and so here's kind of our roadmap we have already uh announced like uh two months ago our in our collaboration with balancer as i said we have a slide like our contracts are very very closely integrated with one another so balancer trades have a slight gas advantage on our platform uh and also balancer has agreed to be the second interface for gnosis protocol
and have people send their orders that they that they send on balancer buyingosis protocol after that we're going to focus on more on chain liquidity so right now we are basically integrated with entry liquidity wired dex aggregators so you can trade on uni swap v3 and whatever other sources there are however if we want to find cows we need to employ a different strategy than what paraswap one inch and matcha offered today so we have to onboard these liquidity sources into our native cow-based solution engine and that's what's on the roadmap as well and then of course we want to decentralize the solver infrastructure because at the moment um we run most of them and so if they go down or if there's a problem then we don't want to be in charge we don't want
to be in control of this protocol it should be a decentralized competition and for that we offer grants we offer rewards as well and that is kind of the third step on the roadmap and then to close i just want to kind of um summarize our vision of trading like if you're a user today if you're a trader we think that gnosis protocol is a place where traders can come together and try to collaboratively protect themselves from mev and collaboratively get better prices because if seventy percent or eighty percent of the volume that is currently traded on taxes today was traded by a batch mechanism like gnosis protocol we could increase the amount of value that gets returned to users
dramatically and so it's a little bit of a network problem it's a little bit of a chicken and egg problem but yeah if you care about being protected and if you care about trader collaboration then consider using cowswap or consider integrating losses protocol and with that thank you very much so thank you for this you said that the solver was so the server is paying for the fee and what is what happened if the uniform transaction is failing because you said that the trader won't be paying for that yeah so this is kind of the risk that
the solver is taking um away from the user and the a professional solver would have to basically incorporate that that risk into into its into its algorithm one way to prevent failing transactions today would be to use mevgeth and to only pay the miner in case your transaction goes through this is a strategy that a solver might employ the other one that's maybe six months ago would have been the go-to strategy would be to watch the mempool and see okay is my transaction still going to be okay even if the current block candidate is getting mined and if not then it could just replace it with a transaction that is actually um succeeding again but yeah kind of we assume that a professional solver can do that much better than the average user so the the overhead
uh or the risk of failure should be much smaller for a professional entity than for you how how can you guarantee that the solver is actually optimizing for the right thing since you cannot prove that it actually that that the computation is correct yeah so the thing that the smart contract verifies is that your limit price is met but you're right that a malicious solver could potentially just match you at the limit price even though a fair execution would be way better than your limit price and for that we have this bond that solvers need to pay in order to become
part of our protocol and it's very easy to solve or to prove after the fact that um well either the solver has lied about its objective criterion so it said it had the best solution but then it published something that is crappy or uh that it's published something even though it wasn't supposed to publish anything because it wasn't the winner of the of the competition and if after the fact we can well we can prove these misbehaviors we can slash solvers retroactively and and pay out any damage that has been done any surplus that has been taken away from the user back to the user with with that penalty so it's kind of there's a dow that would run a client that would verify that everything is going fine and then if if there's a violation then there
needs to be like a court case or something like that to say you get slashed so so i understand you need to sign something and then it takes a while until the transaction actually happens is there a possibility to cancel your transaction yeah so on chain every message you sign also has a nonce just so that we can also not replay your trades so you could invalidate that nonce on chain but we also have at the moment a soft cancellation feature where you can signal to the order book hey my transaction is no longer please don't consider it anymore um and if a solver would then still use your transaction because it's
technically the signature is still valid then that could be another reason for why they could be slashed um but yeah right now if you want to go sure you can invalidate your orders on chain you can basically say this nonce is not valid like never never accept any order under this nonce or you could use the soft cancellation and signal to the solvers please don't use my order anymore so it's possible gas free with a little bit of trust and non-gas free it's it's possible for sure and i'm thinking about the dollar cost
average projector product and then is it possible to to sign now an order which is then executed like half a year later and i just get the market price yeah um so it is possible with uh an ex well it's not possible on the eoa layer like you cannot use your metamask to sign an order that is valid from a certain time in the future but that's purely a a limitation that we didn't we decided to not take this feature into our first version it's something that's definitely possible the way to do that today would be to deploy a smart contract and have that smart contract be your smart order and basically it would say i'm i would sell i i will
my order is not valid before a certain date um and then you could you could mimic arbitrary logic you can even do stop-loss orders or like arbitrarily complex orders today via smart contract proxies um but not with your metamask ua right now unfortunately hi there yeah um i saw it just now that you're available on xdi liquidity is there enough liquidity there yeah so the the cool thing about this protocol is that it's not attacking any existing liquidity that is on chain sure if we have a hundred percent of trading volume maybe we would eat a little bit of uh sushi swaps or uni swaps launch but
it would be i would say it's it's tiny compared to the value or the increased volume that we could get on ethereum trading today so this is more like a layer that is on top of existing liquidity and so to your question on exeter is there enough liquidity well there's honey swap there is maybe a few other projects unfortunately liquidity unix is not the greatest but we basically just eat in any liquidity that exists on on that chain so we are really agnostic to to to the underlying liquidity thank you thank you yo yeah thank you for the talk what are exciting exciting projects you would like to see built on top of coswap
yeah basically our vision is to have any kind of asset exchange basically be powered by a cow swap um or viagnosis protocol the underlying protocol so one thing that we would like to do in the future as well is to have more expressive orders where you can say i'm not just trading token a for token b but i'm trading a bag of tokens for some target allocation and i might even be able to say that i don't really care which which stable coin you get me i just want one of these four stable coins um i think in the shorter term we would really like to see uh smart contract integrations and kind of what we can get from smart orders like stop-loss orders these kind of more advanced trading strategies that can be integrated
and of course we would like to see some market makers integrate with the order format directly and we can source xerox orders that would work but we think that we can even be more gas efficient if we take market maker orders in our native format directly and yeah but i'm happy to talk also afterwards and maybe brainstorm a few more ideas we're definitely we have we have a large community grand fund so we're always happy to to support work on top of our products hi alex you were mentioning some of the results of your your own research the research of your team do you have any numbers in terms of what's the percentage of
volume uh that is now on exchanges and taxes that goes into one block you know on the ethereum block when you know the ones that you're trying to match within the block right yeah we did some analyzes we i don't think we did it on the on a one block batch time but we've done it definitely for 30 seconds wait time so over the course of two blocks over the course of four blocks and and we have that data we can we can well i can i'm not sure if we can but probably you can share it um we're also re-running it again because we did that analyzes in january when we kind of decided to go on with this project we're now doing it again to reevaluate how did the last six months kind of develop um and the the key takeaway there is that
we are really relying on order flow and network effect so um you really need to get something like 10 20 of uh all dex trades on ethereum to make the amount of volume that that gets captured with these cows to be to be a meaningful to be a sizable sizable to to actually give the user a better price and so yeah this is also why you know we have this we have this very strong network effects but yeah we need we need to get that overflow basically so you mentioned xdi and honeyswap do you have actual solvers working with sidechains right now we only have solvers on x die as the
that if you consider that as a side chain um yeah we are deployed on when i mean deployed i also mean that we have solvers running on these networks so we deployed on rankingb as a test net x-die as a cheap but uh incentive like real money incentive uh sidechain and then we have mainnet we're potentially open to deploying on anything that is evm compatible but it's not in our like you know immediate road map um but yeah we're monitoring the space and if there's if there's a good reason to to go on polygon or some other side chain then we're open to that as well hi hello yeah um firstly can you please tell us what incentives would you give to solvers you know how how are you
incentivizing solvers yeah there's there's um on our forum forum.gnosis.io we are currently discussing this as well there's two proposals one would be we would give a fixed amount of g and o tokens or if there was a protocol specific token the product specific token to the solver that is winning and then maybe similar to how ethereum has an uncle reward we would maybe also um give a solution to other solvers that have provided that have participated but didn't end up winning maybe the runners-up or at least they were in some some range with the winning solver but of course there's some simple attacks and other problems with this and the other option would be to the protocol will charge a fee basically a percentage of either your surplus that we generate or of the volume uh that you trade and that fee will be
split between the protocol itself and and the solvers so these are the two quickly you mentioned the grants is that something that you can work with a project in terms of like support and implementation into a smart contract for example yeah there's there's this office support from yeah yeah yeah yeah we yeah we offer support okay cool thank you very much i'm happy to talk after on outside and yeah thank you