# The Fight for MEV by Alex Vinyas | Devcon Bogotá

- Channel: [Devcon](https://streameth.org/devcon)
- Date: 2023-10-07
- Duration: 26:43
- Watch: https://streameth.org/watch/yt-w8H6z9Z4ZZg
- YouTube: https://www.youtube.com/watch?v=w8H6z9Z4ZZg

## Description

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on Swarm, IPFS and more.
https://archive.devcon.org/archive/watch/6/the-fight-for-mev/

The Fight for MEV is a talk that focuses on the two most "famous" MEV solutions designs, CowSwap and Flashbots. It will go over the differences in how each model is designed, and why each solution has made those choices (users, objectives). We will end on how we see the future at CowSwap in relation to the merge, MEV, and the overall Ethereum DeFi ecosystem.

Speaker(s): Alex Vinyas
Skill level: Intermediate
Track: Cryptoeconomics
Keywords: MEV,Auction,DeFi

Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum
Learn more about devcon: https://www.devcon.org/
Learn more about ethereum: https://ethereum.org/ 

Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. 
Devcon 6 was held in Bogotá, Colombia on Oct 11 - 14, 2022.
Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/

## Transcript

foreign [Music] [Applause] so hello everyone excited to be here talking today on the patreon of Zaragoza which is Pila and I'm Alex vinas I'm a marketing manager and cow protocol and today I'm going to talk to you about how does cloud protocol reduce Meb by optimizing transactions through patch auctions I've broken down the talk into four topics which is the first one Meb The Good the balance the ugly then what is called protocol then the difference in the mindsets of maximization versus minimization and lastly where are we heading so maybe The Good the Bad and the Ugly will ethereum remain under this utopian dream of building decentralized Finance for fairness for all the users or will the dystopian site take over and as always will the bigger fish eat the smaller fish so first let's try to Define what is Meb and maybe it was first coined as minor extractable value but now has been recoined as maximum extractable value and maximally extractable value is this hidden power that the block producers have and what this hidden power allows them to do is the ability to arbitrarily include exclude or reorder any transaction in the block of course this is a bit of a problem because right now with the introduction of Mev boost we're incentivizing the block producers to only care about the maximization of the profits and not care about like the overall healthiness of the network before love producers no miners only had the source of Revenue which was gas fees but with the introduction of Meb gas and also the boom of D5 summer then suddenly maximum extractable value became a thing and ethereum kind of like turned in the wrong direction and starting hurting what makes ethereum great which was their users but in reality where does Mev come from now Mev comes from two ways from either the execution layer and the application layer in the actual education layer it comes from the fact that as we just saw that the block producers have this sort of hidden power towards the transactions in the wrong wheel and basically like as we all know and we've seen data shows that they're constantly doing this but not only that it also comes in the application layer because it is important to realize that the different trading mechanisms that you use when interacting in ethereum will expose you to less or more Mev so be careful right there choosing your trading mechanism when you're executing your trades on ethereum not only that but it also comes from the fact that we're always going to live in a world that there's going to be difference in prices between the reality that's happening of chain and the reality that's happening on chain in other words there's always going to be latency Arbitrage kind of like this competition to get the opportunity to buy cheap in either a uni shop or whatever and kind of sell at a higher price in a centralized Exchange and lastly what is truly like a little bit the nonsense in here is that even though the transactions are truly atomically atomically happening in ethereum the prices are not we often see that we have blocks that have multiple transactions and they're happening atomically at the same time but if you kind of look carefully at the data you can see that there's a price disparity with the same token Pairs and even in the same token and even in the same trading venue this is a video of a big issue in finance because it's very nonsense that the transactions are happening at the same time but the prices are completely different and now that we know the definition and we know where Mev comes from let's see what you can do with the power of inserting transactions at your own will so there are three main forms of attack in mov they're well known the first one is front running and basically from running consists of any transaction that has any sort of value such as like a Liquidation on our Arbitrage we'll go from I get it to basically the block producer get it and they do that because they have the power to insert the transaction wherever they want but not only that the irony is that if I send the transaction to kind of get the liquidation through the mempool what the block producer will do will replicate the transaction put their transaction in front of mine and even like the ironic thing is that my transaction will also be included after so that they can earn the the gas fees that I've paid and and in the end my transaction gets reverted then we have back running that even though it's kind of notorious that people argue that back running is less harmful in the ecosystem one can argue that it's still back running is harmful because it's still taking away the opportunity from someone else and basically this is if you're like a large headphone and a whale or like you know a big Trader and you're you're doing like a let's say a million dollar trade against a single amm you're gonna like leave The the Reserve pool the reserve prices of that amm on balance in comparison to the other amms of course you know you're gonna do that because you know what you're doing and that means that your first trade is going to create kind of like an Arbitrage opportunity to rebalance the other pools and you can try to sequence the trades in a way that you are the ones that that's that opportunity but because you don't have the power to kind of sequin the trades in the order that you want mainly as soon as your transactions hit the main pool someone else is going to take that opportunity from you and lastly the most famous One the sandwich attack and the one that is more helpful to the users and the sandwich attacks happen because in reality you think that you're placing a market order when you're trading on an amm or or an aggregator but essentially what you're doing is the setting a limit order that is controlled by your sleep is tolerance and this is how the mind how the block produces no take advantage from you because what they'll do is basically insert a transaction in front of yours that pushes the price up to your maximum slippery spot sleep is taller as paintball then insert your transaction so you push the price even even higher to later on execute another transaction in the opposite direction and what this finalizes is that the miner has made has been able to make profit at your cost by basically buying low and selling high at the expense of you getting a very bad price but how damaging is Mev well according to Eagan 5 website which is a website that specializes D5 and Meb analytics throughout the last month of September in the last 30 days 90 of the top 10 exploratory contracts are either amm or aggregators not only that but 10 out of the 13 billions that Mev volume has moved in September have been have been used to perform sandwich attacks and as we just saw this is the most helpful attack for the users because it gives them the the worst price and and lastly a change sign analytics using the data from the flashbots theme has estimated that since 2020 there's been a total of 1.3 billion dollars of Meb extraction from the users now why are why are these numbers of programs these numbers are a problem because if ethereum truly wants to become the world com the world computer due to its ability to settle transactions in a decentralized open in an atomic manner we need to try to fix Mev and we need to try to fix Mev because I think we all want to and believe that ethereum will indeed become the world computer and absorb the all the transaction value of the world and then if that happens the logical thing to say is that at the current stage of things also mov is going to increase and if maybe increase this is going to poke The Regulators and basically The Regulators are gonna come in and kind of try to try to dictate how we should operate the market we've already seen that in several reports from the bank of international settlements how they try to establish like whether a front running or sandwiching is illegal activity or even more particularly in in Europe where I'm from and we can already see this in the Mika regulation that current like the current forms of from running or sandwich attacks will be deemed illegal under the asthma Market structures this of course is a problem because I think we all believe we we also want to have The Regulators to come in and dictate how the market should run but rather we want to just build Technical Solutions that like address this problem so that the regulator doesn't have to step in and kind of like ruin the party so what is come protocol Cloud protocol is the trading mechanism that underpins hopefully now the famous UI culture of Exchange and it's similar to an amm or a aggregator but with the fundamental response difference that we add a theme matching layer on top of them that allows us to execute um sorry that allows us to aggregate multiple traits together and execute them execute them in a single ethereum transaction not only patching allow us to do this sort of aggregation for transactions but it also allows us to give a structurally better prices via house which stands for Coincidence of ones and these give better prices because if the same they counter opposite orders are in the same batch we can match the user peer-to-peer and therefore they don't need to go to the liquidity pool and thus safe on transaction and transaction costs or liquidity provider fees and on price impacts batching also allows us to be the sort of metadex aggregator similar to scanner to Skyscanner we can query all the amms or all the liquidity on chain as well the all the other aggregators so that in a sense your kind of baseline's price is always going to be the price that the amm or the aggregator gives you but because patching offers certain benefits we on like we almost always improve it then it also offers Med protection because the one of the key reasons for batching is that the batch executors have to guarantee the price that you get so either you get your price or your your trade is not going to go through and those you're not going to be faced with failed transactions and lastly for all the if Maxes that we're all here it also allows us to do gustless swaps which basically allows you to pay the gas fees in your cell token and you don't need to if actually for trading on on cow shop so how do we actually reduce the Mev on chain through batch actions well the goal is that through batch auctions we want to reduce the overall interactions with me amms and if we have to go to amms then at least we're going to try to diminish the level of exposures that and that the trades are going to have against Mev by applying certain rules to the batch auctions the main way to actually reduce mevs as we just saw is executing Coincidence of ones and because you don't need to trade against a liquidity pool and the trades are much completely peer-to-peer therefore there is no matter in the order of those transactions because it's a pure simple transfer between two parties and and there is nothing like no one can get in the middle then second the if we have to go to the amms then we try to break order dependency by having a single price per asset per batch and basically this is achieved because every single batch settlement it happens in car protocol has uniform clearing prices and uniform prices that means that like the people that are trading the same token pairs in the same parts are always gonna get the same price unlike what is happening right now that we see a lot of price disparity and this is guaranteed because the executors of the Vats of the batch commit to a price Vector that regardless of the order of the trades are always going to give the same outcome in other words no the order of the factor does not does not alter the product and lastly batch auctions allows us to like re-aggregate a fragmented liquidity via ring trades this is something very interesting because it allows us to actually kind of match different users without the need to go through many like that they need to go through many liquidity pools and for example here we have a badge where we have four different users and where we have kind of like a coincidence of one and a ring trick where the four different users are trade are trading four different tokens and they're all they're all trading in the same batch and without having to touch an amm because each user is kind of providing the liquidity needed for the other user kind of like in the in the circle so in the first one it would be like in the in the oh sorry in the in the top now we have die against Aura and they actually the liquidity for the first one that's selling die goes to the other one that's trying to buy usdt and so on and like we make a circle now use the C USD and USBC against aura now how do we actually compete for Mev Mev minimization how protocol outsources the settlement of dispatch options to a competition of third-party algorithms whoever gives whoever whatever algorithm gives the best price Improvement for them for the user and thus that minimizes Mev the most is the one that actually wins the right to settle the to settle the watch action not only they win the right to settle the batch auction but it also gets rewarded for doing so currently right now there are 12 different solvers competing against each other for kind of like minimizing the amount of Mev or in other words maximizing the value for the users and they can be grouped into four different types of solvers we will have single order servers that basically specialize on just settling one order in a box then we will have patch countdex aggregator solvers that specialize on finding this Coincidence of ones amongst users then we will have a mixed integer programming solvers which kind of are able to settle multiple trades against uh like uni swap B2 or unusual P3 style kind of pool and lastly we will have the quasi-linear solver or quasi model that specialize in settling trades of the batch auctions in more fancy pools like balancer so what are the difference between the maximization and minimization mindsets is really mov protection that is all there may be protection out there the same thing well of course not although one can argue that in my opinion no flash was technology and corporate protocol technology are kind of two sides of the same coin there's two sides of the same coin because both Technologies Outsource the settling of the transaction to a competition of third parties and in that competition the kind of the winner is the one that optimizes the bundle of transactions in the possible way for the users the difference here is like who is the monarch in Bosch systems in the case of flashbots no they're trying to maximize the value for the validators and those kind of like maximizing the extraction for the users but in the case of cow protocol we're trying to maximize the value for the users and thus minimize the value for the validators so whether flashback goes and and Mission well flashbacks is a collective group of individuals that have done a lot of work in kind of like highlighting the issues of Mev in the space and kind of educate a lot of people and and make us realize what are the consequences of building systems that are prone to Mev but from their website you can take that their goals is divided into three steps the first one is to illuminate the Dark Forest and they've done so via Mev aspect or Mev Explorer and basically this helps educate a lot of people within the ethereum community by putting a number and seeing how hurtful MAV is the second one is democratized instruction before mebkf or Mev boost the extraction was only available to a very few amount set of players but now with the democratization of their tool a lot more people can do it and while it's good there are a lot more people can actually like you know do extraction we need to try to realize that we're kind of democratizing a weapon that is harming the overall like ethereum users so it's kind of like a tricky situation here and then lastly Distributing the benefits this is still a not very clear part or very clear how they're gonna achieve it but right now one can say that like the redistributing the benefits to the wrong people because the benefits right now that are coming from Mev extraction are going to the validators which are not the ones that are creating the opportunities because in the end the opportunities are created by the Traders are created by the Traders yeah so what are Cloud protocols goals and missions well how protocol goal is to actually achieve one single price per token per vast and we want to try to achieve that by basically executing one batch settlement per every block but if we are to compare as well into three main points we will have that the first one is protection from the Dark Forest and basically we do this by executing The Coincidence of ones where the user doesn't have to go against the liquidity pool and also through a delegating trading model execution where the user doesn't set in the transaction directly to the mempool but rather sends it to an offset an off-chain set of relayers that will be the ones that kind of like handle how they they transactions hits the man pool then the second one is if we have to go to the amms and if we have to go to the mempool we try to avoid extraction by enforcing certain rules to dispatch actions and the most important the most important rule is the uniform cleaning prices which in the end breaks the order dependency and thus makes those trades much more or less uneviable and lastly distribute the benefits if you're trading on Costa parade today you already know this if not I recommend you doing so but already today kind of like the price improvements that this so-called solvers or Searchers are able to find are given to the users instead of being kept for them and for example in this case we can see the kind of like the patch in the middle that there was like 18 different trades and on average there was a surplus of 2.5 percent for each order but to sum it up how are they different no in the case of cow protocol technology if we look at the key metric that evaluates the success of the technology is the overall reduction or overall reduction of the exposure of Mev versus in the case of flashback technology the key metric is how much Mev is being extracted looking at the world Democratic section no one can argue that how protocol technology is democratizing the tools for protecting users versus flashback technology that they're democratizing the tools for extracting value from the users or from attacking the users or hurting the users and if we had to look at how these two different Technologies interact with uh on chain the goal of cow protocol Technologies kind of reduce the amount of amm interactions that the users have because in the end like amms are the reason that the Mev exists but in the case of car in the case of flashbots they want to maximize the amount of MMA interactions because these ways they can maximize the slippage tolerance from your trades and kind of extract the most value from you and lastly if we look at how both systems kind of like play by the rules in the case of cup protocol we see that the the more money to the users the less mov and the higher the chances you have for winning and the right to settle the batch and in the case of of flashbots the more money that goes to the validators the less money that goes to the user and therefore the more Mev the higher the chances you have of winning so where are we heading as I said before not All Is Lost like we believe in building Technical Solutions that can kind of address this type of problems and we think we're on the right path to kind of like reduce all the big chunk of mov that is happening right now on on ethereum so what is the future of of the access we believe that the future of Texas is one that focuses on fairness and cost Improvement for him for the users rather than just let them trade in kind of like some optimal ways it is one also that offers Mev protections because as we said before if the transaction value in ethereum is going to increase me protection is going to become more and more important it does it's also one that puts the users at the center of it now in the end in our system the users are the monarchs because they are the ones that are creating the opportunities for different price improvements so they they are the ones that should actually be rewarded for it and not other parties in the system and lastly it's one that abstracts users from complicated technology it is unrealistic to expect that everyone is going to know what is an RPC or how to add an RPC or even stay up to date on all the different liquidity pools to trade your token or what is the like hottest new D5 like trading venue and how are we going to get there no what does the future of Finance look like well the future of Finance looks like the one that we have a cow patch Builder where this Builder commits to have the first transaction of the block to be a cow protocol settlement and this is important because if the first transaction of the block is account protocol settlement then we're gonna have uniform trading prices in all the trades that are happening within there and therefore there is no Mev that can happen with the trades then if that's the case and we have the first transaction then the transactions that are going to come after are gonna actually be like true intents of Arbitrage from the market and we're gonna be able to like have the overall ethereum ecosystem in a sense focus on the real market efficiency because right now a lot of the Arbitrage that's happening is toxic Arbitrage and it's not Arbitrage from the market but rather The Leftovers that the Mev attackers are kind of living living in there and lastly it would be like the combination of the utopian side of the flashbus technology with cow protocol so how does this look like well currently we have this this scenario right now in ethereum where we have the mempool and we have the different searches or private order flow that submit their bundles to the Builder and then it goes to the relay and end the validator but for us the key is to kind of break the the order and kind of transform Searchers into Cloud Builder and put cow protocol and cow shop in the middle of it in a way that if we make if we convince Builders to focus on the utopian side and kind of shift the revenue mindset from hurting users to actually protecting non-maximizing to the value of the users then we're gonna have a much overall better outcome Within ethereum and Will the Market fix Mev well the question is that if Meb maximization takes over we will have not built the future of Finance but rather have just built the new all system but just with new rails so help us build the future of Finance because we're hiring for a lot of positions and thank you very much questions hello uh Alex oh ah sorry no problem um question so the batch auction process you're describing uh is one in which you have a bunch of orders from from Individual Traders and then a collection of solvers each submit a price Vector that can satisfy all of those orders how do you get the individual traders to commit to an order without them knowing the final price well basically it's like they see in that like in a way worse is that when you go to Cloud shop you sign a message with your intent to trade and basically your your Baseline price is the quarter price that we give you so from there the solvers start working on trying to improve the price so you're always at least at base you're gonna get what we have showed you in the UI and from there if there are if there are price improvements that the solvers can find be a coincidence of one or some sort of batching then it's gonna be rewarded in the form of surplus from you so you're gonna get more how's the color spray calculated by basically looking at their own Chain by the at the on-chain prices and from there like we we discount the gas okay here sorry thank you for the joke um uh the question is do you have any guarantee that the individual user is going to have its trade executed in a batch like the way it works is that you sign a message no and then if if your prices get out of market then the the the trade is not going to execute but you're not going to get it uh you're not going to get charged for a failed transaction or anything because simply the trade doesn't execute so in a sense like the guarantee is that if you're if you're if your order is more or less within the market pricing then within a matter of 30 seconds to one one minute is of course gonna be included hi um I'm here sorry hi thank you so I was just wondering you can pair flashable so in Cal swap but isn't Cal swap solving for like the subsets of the Mev that Flash versus trying to software and also how do you feel about Mev maximization with Mev rebates being equal to Mev minimization can you repeat the question sorry I think yeah um so you compare flashables on Cal swap but um how do you feel about uh to many teams like telescope is solving for subsets of the Mev that flashbulse is trying to solve for as in you for example you've done so for illiquid Pairs and you only sold for Mev that goes through amms but flash boss is not trying to solve for MAV flash is just making a tool that is making mbb extraction more excessively common for the for whatever user but in the end the goal of their action is that the higher the more Mev the more I'm gonna pay and the more likely I'm gonna be included like my bundle is more likely going to be included on the on the next transaction and they do that because they're in the execution layer and the problem is that they are able to do that because the trading mechanism that people use like amms expose their users to Mev but what we try to do is kind of like fix the Mev at the application layer so that then flashbacks wouldn't have like a way to extract Meb so if like you know in the end if if the servers kind of like find the optimal prices and uniform clearing prices the Mev that will go to the Vlog producers is non-existent because there's no like it doesn't matter the order of the transactions [Music] thank you
