Analysis of 1 year of CoWs, practical impact of batch auctions for MEV
ETHCC 5 · July 2022 · 15:44
Felix Leupold reviews one year of CoW trading and the practical effects of batch auctions. The presentation examines MEV protection and price improvements within that experience.
Speakers
Topics
From ETHCC 5, hosted by Ethereum France.
Transcript
it's been exactly one year that I stood here at ECC and uh talked about implementing batch auctions as a means to protect users from me on ethereum a lot has changed since then one year ago the protocol that we deployed just a couple of months before the conference was called nosis protocol we have since spun out of nosis and cre our own da that is now called the cow da and the protocol is called cow protocol we've had pretty amazing success over the last year settled over $3 billion in trading volume and so I wanted to take a moment today to look back at the last year and show you the Practical implications of applying batch auctions on ethereum for mitigating me and reducing the surface
of me uh for onchain trading first let's revisit what cow protocol actually does cow protocol is implementing B auctions on ethereum today but what does it mean it means that instead of users sending raw ethereum transactions when they want to trade directly to the meol they just send an offchain trade intent an offchain message if you will consider consisting of their sell amount the sell token the buy amount the buy token basically what they want to do and they're sending this intent off to a um cow protocol orderbook API and this allows the protocol to aggregate multiple trades into a single ethereum transaction as you can see in the image
there so instead of having one trade one transaction in cow protocol we can have many trades in a single native ethereum transaction and this allow us to reduce me surface first of all by reducing the amount of am amm interactions that we have in a single settlement amm interactions are the main contributor to meev surface and the reason why there are so many attacks but most importantly we can also enforce single price ing on all the trades that are in a batch this means that if you're buying usdc for eth and somebody else is buying usdc for eth you'll end up getting the exact same clearing price and this uniform price clearing uniform price clearing is very substantial to the m protection because
if you think about it most Dex M today stems from the fact that you have even in the same block the same token pair trading at different exchange rates based on the ordering of those transactions within the block and because the transaction ordering is up to the minor the minor can insert remove reorder transactions in a way that maximally benefits them and maximally screws the user do so in cow protocol in cow protocol there's just one clearing price per token per batch meaning that the ordering within a batch doesn't matter lastly one unique thing about cow protocol is the solver competition I mentioned that your trade intents go to this um orderbook API and then that API
Cuts today roughly every 30 seconds um a new batch and dispatch dispatches that batch off to a network of decentralized solvers and that those solvers try to match the order flow that they are getting in a way that is optimal for the users optimal meaning increasing the limit price that we on these orders um as much as they can so the total price Improvement that a solver can generate on that order flow what we call the trader Surplus decides which solution is considered the most optimal for the spatch and the solver that submits that solution gets the right to execute the settlement on chain and also receives a cow reward so really the solver that generates the most value for the user is
able to settle those traits whereas when you compare it with flashboards in their protocol approach it's really the party that extracts the most value from the user that gets the right to execute so but what is this mean for the user on top of just being protected from me aggregating multiple trades into a single batch allows us to get the same or structurally better prices than any other venue on chain first the solver competition ensures that people never get a worse price than on any other Dex or Dex aggregator because we have a bunch of solvers that just check for the prices on those venues and will match you um at that execution path kind of as a baseline if there's no other Advantage
available ailable but by matching users peer-to-peer because we have multiple trades in one batch um so for example if you are selling eth and I'm buying eth in the same batch that's like a peer-to-peer trade in economics it's called a coincidence of once short cow this is where the name of the protocol comes from we can actually achieve better prices than on any other venue out there because on the peer-to-peer portion of the trade we incur zero price impact we pay no fees to liquidity providers or market makers and additionally by batching people together we can also significantly save on gas costs additionally cow protocol doesn't segregate batches by token pair meaning that all trades that are happening in a
single batch end up in that one you know large entity and this allows solvers to optimize over multiple Dimension as well and match peer-to-peer trades in what we call ring trades so if I were for example to sell e for Bitcoin and somebody were to sell Bitcoin for US dollar and somebody were to sell dollar for eth even though there's no direct Coincidence of wants we could still match all of them peer toer in a rink trade so better prices for users what else we also think that cow protocol offers a significantly better user experience to the trader first users don't pay for placing orders because it's just an offchain message there's no need to pay for that they only pay when their trade actually gets settled and
then that trading fee is paid in the sell token the token that they're already trying to get rid of and because there's no real transaction that they send they don't need to give away any of their precious eth whereas on other Vues with every trade you make you're leaking a little bit of eth and also since there's no transaction from the user in the first place there's also no risk for failed transactions at least not from the user point of view uh so there's no cost for you know fail trades or trades that don't go through that failed settlement risk is uh given to the solvers and and they carry that and I didn't even have space on the slide to uh to talk about the advantages for multisig signers or Dows where it's usually very difficult to um to propose
a transaction propose a trade at point x in time and then 5 hours later when you've you know collected all the signatures or you've done your Dow vote and now it's actually time to execute that transaction piggyback on the quote and the execution pass that you got at the time when you propos it so this delegated trade execution relying on solvers to compete for your order flow at the time your trade is valid actually makes it very nice for these kind of asynchronous organizations as well but okay enough for the Shilling and Theory let's go and look at how cow protocol played out in practice in the last year some of you may still remember the ens airdrop from last November um I remember it quite vividly it was in the morning European time I woke up because a bunch
of alerts fired off gas prices were all over the place people were trading this token up and down it was very shallow and and volatile and I took a block from that morning where we can see six trades on the ens we pair all within the same block all of these pairs all of these trades got different prices as is normal in ethereum today but interestingly one of these transactions the one at the very bottom is a cow protocol trade so we can actually see how the people that weren't part of cow protocol traded compared to the people in cow protocol the first thing we see is that a user actually got sandwich in this block quite you know the the very classic um sandwich attack minor front running them moving up the price uh then inserting the users transaction back
running them the total damage here was about $1,000 for that user and since this is the ens token we can actually map that user to their ens name which was ignite fire Emoji eth if you're listening to this talk please consider trying out C protocol afterwards um but we also see the cow protocol trade in this batch and um if this is zero Mev a new kind of new explorer that shows you ordering within a in a in a block and you can have different views of what would happen if the ordering was random or time based or how it actually ended up um I added two columns to this to this view to basically showcase what were the different clearing prices within that in that block and we can see that ens range
from anywhere between 143 ens per e to 150 ens per e and the other thing I added here was showing the volume which actually highlights the the fact that the user that was buying eth for we roughly traded 7 eth but there was another trade in the same block where somebody was selling e for E almost the same quantity 6.7 eth so a really nice use case of if they had all traded on C protocol we would have gotten a gotten a very nice and very visible Coincidence of once in total we simulated this batch the user that got um sandwiched here would have gotten $2,500 more in value if they had been settled in a
batch auction compared to being uh settled in this continuous pseudo pseudo continuous uh well time priority auction let's look at the Cow protocol trade in exactly that block because even there um it's interesting that we um have three different trades two of them uh selling eness for e and one of them buying iness for eth and what we see here the total volume was $10,000 and 87% of that total volume could actually be traded directly peer-to-peer so we can see in the settlement visualization um all of the Traders putting in either their ens and their e into the protocol and then the protocol only reaching out to Sushi swap for a small fraction 13% of the total trading volume if we make
the math for how much does this actually save we come out at $250 because first of all for the roughly $8,500 that we didn't route through Sushi swap we saved the 0.3% liquidity provision fee 27 bucks we we also didn't move the the amm price up and down again which would have incurred price impact of about $70 granted this was in the early morning so the price the the pool was still fairly shallow usually for trades of that size you wouldn't have that much price impact and then most importantly this morning gas prices were super high I think 200 Gua e was at 4,800 SO gas was very very expensive and by settling three trades in one transaction and only reaching out to an amm once we actually saved 15 $50
in gas costs in total for the users so a pretty significant saving 2.5% just by batching people together I have a bunch of other kind of classic you know Hall of Fame batches to show you uh in the last year this was I think two months ago um we had the largest cow ever um on the protocol so far which was about $10 million a user wanting to swap usdc for LUSD so a stable coin stable coin swap another user taking the other side um exactly at the at the same volume so we had 100% a perfect cow given these are two stable coins the price is not very volatile so it actually makes sense to wait for somebody um that wants to take the other side before placing your order and the cost savings here was about the
0.1% um liquidity provision fee that you pay on curve so about $10,000 the thickest cow we had so the cow with the most Traders came from one of our testing sessions in in early August where we got a bunch of our community together and made them try out the protocol here we had 34 trades that were swapping eth for gno and the key cost savings here really comes uh from batching together those trades and doing a single reach out to Unis Swap all of these trades were in the same direction but because we only had uh one interaction we saved $700 on uh on gas cost and then the last batch doesn't really show the power of cow but it shows the power of me protection
basically here a user wanted to buy $20 million worth of eth and they put in a very LAX slippage tolerance they were basically happy with just receiving $19.3 Million worth of e $300,000 of surplus that uh they were would have been willing to give away uh if they had traded in the public men pool however through the solver competition the mechanism that's underlying C protocol made sure that they actually get the best price at this very moment it turns out to be a very complex settlement involving many amm and market makers but ensuring that the Surplus the difference between the limit price in the executed price of $300,000 gets routed to the user instead of to a minor so if we look at the cows since
launch just a you know few statistics um we've done over $13 billion in trading volume and almost 200 million dollars worth of cows on this protocol um we've see the graph was was increasing quite nicely with a record hitting in April with more than $50 million worth of cows since the market has cooled down unfortunately so has the the cow volume but still we have generated significant value in the past our plan for the future is to first of all grow the cow volume by making sure these cost savings that I showed you today are also visible and understandable to the users that are trading on cow protocol we also want to make sure that we allow users to express their preference of saying I'm happy to wait
for a little bit if you can get me a better price through a coincidence of once we then want to make sure that we grow the overall Dex share that cow has today by integrating market makers and giving users the access to private liquidity at the best execution or at the best settlement cost and also by having multiple UI Integrations right now the primary source of order flow is still cow swap the UI we already have an integration with balancer we're working on an integration with shapeshift and hopefully many more basically any swap UI that exists out there we hope that eventually will route their order flow through cow protocols so we can make sure Traders are actually getting the best possible prices and if we achieve that we can actually become the primary
price finding layer for digital assets on ethereum with the key premise that every token should just have a single price per block because if we can achieve that we reduce drastically the amount of M that exists on chain and we make ethereum a much more reasonable place for people to actually live the future of Finance if you're interested in helping us with this Mission we are hiring kind of all over the place in engineering Business Development product management we have a booth around where you can also talk to the rest of our team uh please consider checking out our website and job board cow. jobs and if you haven't already give our exchange a try the primary UI for cow protocol is still a cow swap. exchange where me
protection on Twitter and with that thank you very much for your attention thank you Felix once again in the interest of the time of our other speakers if you have any questions it would be great if you could take those outside with Felix thanks again