MevWallet: mempools suck, don't use them with James Prestwich
Ethereum Denver·Mon, Oct 9, 2023, 12:00 AM
Speaker
Negative MEV allows users to recapture value extracted from them, by adding Explicit MEV-awareness into applications and wallets.
Transcript
on on the side right now. You can find these slides at the tiny URL at the bottom if you're interested in them. Uh so MEV wallet, what MEV wallet? So in an idolized transaction flow, you sign your transaction, you broadcast it to a me pool, it goes to your externally owned account and then it goes to unis swap. Uh but in reality what happens is that it takes a little detour through the searchers and they put it in a sandwich and then it goes to your account and then it goes to unis swap and you end up a lot more sad than you would have otherwise been.
So me wallet kind of shortcuts this process and says if I'm just paying searchers in order to sandwich me anyway, I might as well just pay the searchers to sandwich me and skip this whole meool thing. Uh and MEW wallet adds in some new stuff to help you be a little less sad about the process. So the other question is why me wallet? Uh notionally blocks are composed of transactions and they go in the order of tipping. Higher tip higher in the block.
Lower tip lower in the block. But ever since we got this whole flashbots thing, there's actually been two different blockbased markets. HighMe transactions go at the top of the block and then low me transactions and then high tips and then low tips. So there's actually two different ways to get your transaction confirmed. One is by paying a tip to the block proposer and the other is just by making a little bit of me.
Just sprinkle a little me on it. So your unis swap transaction of your bad trade for that terrible shitcoin is going very high in the block because you're making a ton of me and the searcher is going to go sandwich it. They're going to make sure your transaction confirms very fast because they're going to make a bunch of money by taking it from you. So you could have not made me and ended up in the bottom half of the block and that would have been fine. You could have made some me and not paid a tip, ended up in the top half of the block.
That would have been fine but less fine. Uh but if you use me wallet, you can have the best of both worlds. So how do we do this? We're going to directly shortcut the mempool, send the transaction right to searchers. They're going to sandwich us and we're going to put a little bit of extra me in our transaction.
and then send it to unis swap. So when you're sending your transaction to the searchers, you're creating implicit me. What you're doing is creating a little bit of me. And using me wallet, you're going to create explicit me. You're going to say, I want to create one e of me.
And you're thinking, why would I want to create extra me on top of the me I'm already making? And the answer is you you really don't want to. But you don't have to make positive explicit me. You can do negative explicit me. So you can say I want to add negative one ETH of me to this transaction and you can force the searcher to refund you one ETH before they even process your transaction and put it in the sandwich.
So a normal ETH transaction looks kind of like this. There's a two data value. So like two unis swap with my bad trade and 100 ETH. Uh, and an ME transaction is exactly the same thing, but instead of a tip that goes to the block proposer, we add some MEV. We sprinkle a little extra MEV on it.
Uh, every transaction implicitly creates MEV somehow and that's attached to the transaction whether you like it or not. So, when you're making your bad trade on Uniswap like I do every day, you're creating about five ETH extra MEV and you're just giving that away to the searchers. So in a normal transaction, you're going to pay that five ETH and you're going to pay an extra 0.1 ETH in transaction fees. With ME wallet, you're going to pay that five ETH and you're going to get four and a half back from the searcher.
You're going to demand that they pay you 4 and a half ETH before your unis swap transaction can go on chain at all. And so net the person not using me wallet's going to pay 5.1 ETH and the person using it is going to pay half an ETH. uh you're going to end up saving a ton of money by reclaiming the ME that you're creating anyway with your very bad trading strategy. So, how do we do this?
Every ME transaction is going through a smart contract wallet and the phases here have a few steps. First, the searcher is going to fund. So, if you're doing negative me, they're going to pay you upfront. Then, the transaction gets validated and then the transaction gets executed. And then there's the fee settlement after the fact.
So searcher funding is really easy. We're going to force them to provide an exact amount of value. Even if I have zero ETH, I can force the searcher to provide five ETH that I'll then use to pay them later because I'm creating ME. And if I'm creating enough ME, they're going to pay me any amount of ETH to get access to it up to the amount of ME I'm creating. Uh so transaction validation me wallet lets you do things that normal wallets don't.
You can check the timing and uh with an MEV wallet you can make transactions that are only good after a certain date or only good before a certain date. You can't do that with normal transactions either. You're going to execute the transaction. Uh this is pretty simple solidity. It just calls a contract and then returns what it returns.
But the trick here is that uh you know this seems a little crazy. You don't usually want a contract call to just revert on failure. Uh in a normal wallet, you would pay for that failure. You pay for reverts. If your unis swap trade fails, you pay for it.
But when you're going with me, searchers do not include reverted transactions. So if your transaction reverts, you pay nothing. With a normal wallet, you pay the fee. With me wallet, you pay nothing. And so after the transaction executes, after you've made your bad unis swap trade, uh, MEV wallet handles reimbursing the searcher whatever value they put up plus the transaction fee, but the absolute minimal transaction fee.
And it does this by creating me that the searcher can then claim. If the net fee is negative, uh, it claims ME for the user. So if you've, you know, created 500 USDC of ME, you might end up with a little more ETH than you started with because you've created a bunch of ME and USDC and you've gotten paid for it in ETH. So, MEW wallet is also good for block building, but uh I'm gonna gloss over that part of the presentation and go straight to the end because uh I want to talk about questions. If anyone has questions, I don't like giving 20-minute talks.
I like giving 10-minute talks. Does anyone have questions about the things I just said very quickly? Yes. So, how do you determine the profit the MEV searcher gets? So, the answer is that you as the user probably don't determine their profit.
You're making your trade. It's going to create some amount of MEV and you're probably not sure exactly how much. Uh, you're going to let the searchers decide whether they will accept your tip or not. You're going to say, "I'm willing to pay up to 0.1 ETH for this."
and the searchers can then choose whether or not to accept it. Uh if you know that you're going to create a lot of me, you make that negative. If you think you're not going to, you make it positive. Uh I'm also working on a real-time bidding system that works similar to advertising auctions and page loads. So you can go out and ask 20 searchers what their tip would be and then you can accept some of those.
Uh so that helps you figure out as a user what the appropriate uh amount of me to create is. Other questions? Oh, I don't mind getting off stage. All right. Thanks so much.
I'll just be around here for a few minutes and then I'm going to go eat dinner and probably start drinking. [Applause] [Music]
Automatic transcript — names and jargon may be misspelled.