Solving MEV via App Specific Sequencing - Daniel Contreras Salinas

EthereumZuri.ch 2025 · 31 Jan 2025 · 21:41

Daniel Contreras Salinas presents app-specific sequencing as an approach to solving MEV, where an individual application controls its own transaction ordering rather than relying on a shared, general-purpose sequencer. The talk covers how dedicating a sequencer to a single application can close off some of the MEV extraction opportunities that arise from shared ordering.

Speakers

Topics

From EthereumZuri.ch 2025, hosted by EthereumZuri.ch.

Transcript

[Applause] thanks it's working yeah thanks everyone for being here the last Talk of the day and the conference so yeah I'd like to talk today about this um how to solve MV via this app specific sequencing so I work as a researcher and developer at Aris we we are doing onchain Market making and liquidity management for crypto projects and uh but let's start uh with a simple story so uh when we talk about maximally structed value this is like the idea we all have so we have our very night friend who is trying to interact with blockchains and he was even approached by a BAL guy in the street trying to give him money to to

actually use blockchains so he received maybe 4,000 usdc and he he wants to trade so he goes to the first website he he sees he starts interacting with this uh uis and he says okay I will try to swap my 4,000 usdc by by E so he doesn't even say how much e he just say I want whatever it takes to to get the E and this is like the reality of most minc Traders they just want to trade and they don't care about the output so he does that via his metamask wallet which is connected to a public RPC so his transaction ends up on this public man pool so little he knows that on the other side there is a this bad actor maybe bad actor is like hatless bot

which would call a solver or a Searcher who trying to extract value from these transactions so what he does is just okay he said I will do I will make a bundle this transaction will include you but before that I will insert a transaction which is moving the price of this asset a lot to One Direction so the end transaction of the user uh he's receiving 0.1 e only so he and uh to to finalize his uh his threat here he just inputs another transaction in direction to put the price back to the real price and he cashes the difference uh up so at the end uh what we observe is what we call a sandwich attack which is composed

by this front running transaction and a back running transaction uh to to put the price back at the bull and so we know it Cates out the difference so our little friend here is very sad now he he lost all his money almost all his money so but he he didn't give up so he started now starting a little bit so he knows H I I have to set this slipage amount I cannot say just uh trade my token I have to take the minimum amount I want to to be able to trade but he's struggling like uh markets are very volatile and what he realizes it's like okay I just I just put at least one if because it's not going it's not going through so uh the solver is still there listening to the transactions he says I

I have multiple pools I can I can trade against so I just include the transaction but I just give give you the minimum you asked me so he include the transaction and then everything goes on the server still ears money um so it's kind of a Bittersweet situation because he obtained what he wanted but he was kind of forced to do it so our friend now watched the samel stock and he knows that there is a way to actually go through this man pool and he uses a a MV me blocker RPC so he sends his transaction to a private men poool and he knows that he is protected against any kind of sandwiching in this scenario so he can even set this same transaction and he probably will get more than one

if in this case so the problem with this is that we are introducing extra trust assumptions on on on the model uh so we know that this private mle and RPC have to be trusted so you know centralization is a problem and Trust assumptions are also very important and in the case in this case of M blocker m is not fully eliminated so we know that uh if there is any possible way of back running uh the transactions that are going through this men poool they will do it and they will give you back 90% of the revenue and they will keep 10% for for themselves so it's kind of we we kind of solve it but it's not fully yet there so one solution that is uh kind of new I mean two years old maybe is uh

comes from traditional finance and it's called batch auctions so in this case we have kind of a different mol in this case we have a meol intents which are basically sign transactions that are floating around and that the the person who is permitted to use them can use them so for example in this uh case we have some swaps that are signed and they they determine the amounts you want in and out so uh these sentence are just not normal transactions they are just signatures that are uh floating around so solvers are still there they are still greedy still hardless but the thing is that now with custom sequencing rout what we can do is to use their computer power their their advantage and

their knowledge to actually help us set this transactions so what they do in general is to compete against each other putting uh solutions to this uh intense mol so they batch transactions together uh how do they do that so they Tak a subset of the transactions in the in this mol and they can even insert their own swap uh this swap can be on on any Dex they can use their own liquidity and by doing that uh so they compete against each other doing that and uh there is some this case a offchain auction saying okay this solver got the best solution for this because it's providing the most benefit for the for the users so the

auction runs there is a winner this solver now has the right to actually settle all this intents uh on chain so the transaction at the end is a transaction with all transfers and swaps uh but what is very important is that this happens with a uniform clearing price so what that means is that um all the users at this uh at this uh transaction are getting like the same price vectors meaning that there's no sandish attacks anymore you cannot front run and back R because everyone has the same price so this is how is uh cow protocol is implemented and uh you can interact with it by using cow swop so you should use it it's super nice but uh I'm not advocating for c for C protocol

in general so let's see uh if we solve IM yet so if you were lioas talk yesterday and even Samuel talked about it so what we know is that uh the Meb landscape is quite varied so we don't have all these sandwich attacks uh we have a lot of different uh kind of attacks like sex deck Atomic Arbitrage just in time liquidity tax so what we know from from this is that uh the origin of of M is not only uh a consequence of pre-ordering of transactions but it's also a consequence of how latent your your uh blockchain is so we know

ethereum blocks are 12 seconds and in in traditional Finance that's a lot so uh let's study one of this example which is seex arbitrage scenario so sexex Arbitrage Works in this way so in the graphic you have this blue line which is representing the sex price so centralized exchange like binance coinbase and this is moving very very fast very often so and in red you have U your amm price which is stale so it changes every block every 12 seconds and what happens in general is that when there is a huge price difference between the amm price and this sex price like in time T1 for example what you see is that uh an arbitrager will come will say okay

I'll buy from this amm I'll move the price all the way up until I uh I have profits profits by selling this amount on on a sex so this is basically what sexx Arbitrage means and this is well studied so we know that there is a metric to actually measure this difference which is called loss ver rebalancing or lvr which you can resume as the opportunity cost for liquidity providers to that that pay by quoting at stale prices so uh we know that Arbiters or servers are competing against each other to extract this lvr value this difference in price and this they do by tipping block Builders and block Builders are

then putting some of this money to to actually the proposers so uh as you see this problem is quite different from sandwiching because sandwiching comes from so the M comes from the actual Trader and here the the value comes from liquidity providers that are actually putting money in there so how can we do how can we solve this problem I mean b auctions is not a a solution for this so you can say for example just don't trade I mean that's a basic solution or you can just say don't trade if prence is too is too high so you can do that by inputting an option element in your in your architecture but you can also say uh auction of the right to Arbitrage the pool so uh directly in

the so it's like basically that saying okay you can extract the M but you have to pay for it first so if in a competitive setting what you this is this is working because uh searches are competing against each other if uh if they know they can extract a little bit more they will pay a little bit more until they basically pay all the Meb back to to the to the protocol so the question is how can we build this because it seems like complicated seems like uh we have to build a whole new thing from scratch so what we know is that uh and we have experimented with that already is that there are modular Frameworks appearing so valantis is a modular Dex and the unisoft before is live today so it was

announced a few hours ago and what you can do in this modular uh Frameworks is to modify the actual uh logic that is happening in some of the actions of the pool so this is composed by modules or H or hooks which are basically working in the following way so you have a normal swap happening this you know you have swapped in your life but you can do is to uh keep the core swapping for example uh logic that unisoft before provides you and you can input some logic before and some logic after for example in the logic before you can say I will only trade against this uh solvers I know or I will charge you Fe depending who you

are or even you can say I don't know I just trade in this direction on whatever logic you can Implement in this in this case and after swap can be for example I collected this amount of money in this Swap and then I will distribute it back to my users so what is nice about this is that you can reuse uh a lot of the code so maybe 90% of the code is already there and you just need to implement some extra logic in in this in these cases uh so you can do faster iterations experiment and of course with less risk because you have less code to audit um and of course you have NE door effects so deploying with these guys unisa valantis has its own advantages because they they already partner with a

lot of projects so you have this kind of uh advantages so let's talk about some of these uh rules that we can construct on this mod deess to actually solve M so we saw bu options but let's let's see what we can do on the lp side now so we last year we deployed uh this protocol hot amm with together with valantis and you can see it's like very modular so you have several elements that are core to the system and we introduce this new module so what happens in this case that um this amm is a hybrid amm so you have one permission side where anyone can trade and we have an RFQ system where

all the solvers can trade against the liquid so the liquid is the same but it has two inputs from from users so what solvers do is to and bring up to date uh so bring up to date sex prices so they they quote uh our system so in the top right you have our quoting Series so solvers ask is this price okay and we say yeah and then we give them a aign quotes so they can actually uh take this ticket and uh use the the liquidity in the pool to trade so what you can do what you can do with this is actually eliminate all the sex Dex Arbitrage because if the the if they tell you this is X price and I will trade at this price then they are

trading at the actual price that other Sol other arbit yours would exploit as a difference so you can also we also implemented some Dynamic fees to protect the Priss side mm because uh there is some some advantages of putting higher fees when you don't have any kind of quoting activity so that's a production and the advantage is that we can just uh reuse the all the capital effici of concentrated liquidity that this Dex provides so yeah we just need to implement this extra logic and we don't need to think about how swaps are actually working so that's one example uh another example is that we are building with un un of before is quite

similar to the previous one so we will just focus on private order flow uh so in this case solvers compete for the rights to be the first ones to actually transact against our liquidity so they open the pool and uh of course in equilibrium when they compete against each other they tend to pay back the me they would extract back to the pool back to the LPS so uh of course again we recovered the capital efficiency of uh of concentrated liquidity provided by unisa before so we we can give uh give give very very concentrated quotes very efficient quotes to to solvers uh just by changing these ranges according to maybe

volatility so there are some other hooks in the way so very interesting ones about anstrom by SS which is basically mixing this kind of Builder hook with the cow swap so doing uh an auction to to put this uh first transaction and then batching the transactions out so there are other implementations uh like this uh otim managed amm by by B which is um a project done by the unisa foundation and implemented by by the project and the Project G which is basically doing Dynamic fees uh in asymmetric Dynamic fees so I mean there are many many hooks to come so of course this started today

in unisoft you will see them appearing uh more and more often so let's talk about um what are the trade-offs because all seems like okay we can solve this problem but what are the the things we are not solving actually so this this Protocols are not very composable because you know that uh for example wining that the transaction is included in a in a auction in a protocol doesn't mean that uh this will be included in another b b auction in another protocol so if you so we know already intent are not very composable so even if you could stretch them out you don't know you you're not sure that this will settle in both sides uh of the

of the equation so this is not very good but the truth is that the majority of the other flow is just uh one swap token a to token B even cross change swaps don't have a problem with this kind of setting but the reality is that yeah it's not really necessary but yeah there are some some IP proposals to actually try to solve this one another caveat is the centralization so if you realize now if you look back it's like you you you know that these auctions cannot be easily run onchain like you are trying to run logic which is expensive so do it in onchain is kind of difficult so um what we know is that uh you might have some sort of solver Network that

are trying to to to run this uh transactions like s La is doing um but you need to introduce like Economic Security to this network like how how can you slash these guys because it's a network so of course there's some restak networks that you could Implement by to to reuse some of these liquid sty tokens to actually back your network and um there are some other Solutions like trying to not necessarily decentralize but at least reduce the TR assumptions so put all this logic of the auction in a te and just let it run and you trust it and for most people this is okay right now but you can also use like networks of Tes like sve to to actually uh help to decentralize this protocols so the last um concerning issue is as

sensorship resistance so uh we know and this is very important that if you want an uh and you can think about this Bo batch auction in in cwop if you want that it doesn't mean that the the Builder will like you and will include this in the in the block so you have to go through these two options like the op the application option and this m boost option that you you saw in s stock so uh this is still an incognita it's not clear how it will be solved so there are some um maybe protocols uh implementation that will be added to it eum like inclusion list or multiple concurrent proposers um but yeah it's still an incognito and U there are some

scenarios and this is very very interesting where you can actually um yes have deterministic rules on your sequencer on the base chain that help uh actually processing the the transactions in a fair way so like first come first serve or priority ordering uh so just the last uh the last uh minute I like to talk about this uh priority F which is uh how to actually solve all these problems we talked about like in a very elegant way without in with two lines of code so this is like a it's kind of a breakthrough but I think the value has not been given yet so it's a research done by paradig resers which is called

priority SOL unit so you consider a blockchain with priority fing like the op stock so uni chain base all this the stack chains um so what you what you know is that in general these uh solvers are trying to compete against each other to to get the M uh so in order to do that they they they send big big fee priority orderings uh big fees uh to the to the actual uh layer Layer Two and uh they get an ordering which is now you can take this ordering translate into your application and and uh charge this uh this uh solvers an amount corresponding

to maybe 99% their priority so the ordering they had in in the in the layer two so if if they just put this fee to the layer two the it's the layer two who is getting the M back but uh if this fee is now put in the application so you actually like scale this amount to your to the application and you get uh in competition 99% of the top of the Block M so the thing is that um yeah this logic can be implemented in two lines of solid go so you can think about implementing a hook in this uh in this uh modular Frameworks and uh basically you solve M with two L of code and uh yeah I gave you a$1 million protocol yeah yeah so thank you thanks

so much Danielle for this presentation very insightful um I think we have time for one or maximum two question because then we have the closing talk yes priority in protocol Solutions are sorry yeah yeah in in protocol Solutions like priority fees stuff like that will be they're going to stop they're going to make this stuff redundant right so why have an auction at the app level instead of the Block Level because you you need to convince ethereum to have this kind of priority Fe so in layer to you have it it's like use it but in ethereum and other protocols other chains even if you don't have this kind of systems then you

you don't you need to do all find find some workarounds so yeah but this is very elegant so I would say and for your quote server who's paying the cost of the quotes because I mean you get some spreads always when you trade against uh solver so we are paying for it any more question I think uh yeah we are done thanks a lot uh Danielle thank you and um now yes I invite you to go to The Beam for the closing talk with Professor clao T thanks so much [Music]