How a below average programmer found his way into searching

ETHCC 5 · July 2022 · 16:37

Libevm shares a route into MEV searching and examines the rules and hazards of operating in Ethereum's mempool.

Speakers

Topics

From ETHCC 5, hosted by Ethereum France.

Transcript

Hello. Uh yeah, so how's everyone going? Yeah sick. Uh yeah, welcome to Tales from MEV land or how a below average programmer found his way into searching. Want to clarify, by searching I mean MEV searching or searching for opportunities or value extraction opportunities on Ethereum or any other L2s. Uh so a little bit background, I'm just an average curious guy who happened to code who happens to code. Um I'm currently suffering from jet lag, so I apologize if I mess up some words and uh English is my second language as well, so you can check out my Twitter, my GitHub, and my website uh evm.com.

Uh yeah, I kind of like to think myself as, you know, the left curve if you have to graph like IQ distributions, I would kind kind of be on like the left side. I've met a lot of my friends, you know, they're really smart people, probably on the mid to high curve, but they don't execute. They think too much. They don't execute. So that's like my little pet peeve with them. But overall, uh that is probably where I stand. I know I know where I stand in this uh hierarchy, if you will. [snorts] Uh the point of showing you that thing is that if I can do it, you can do it, too. If I can If I can extract value uh from Ethereum, you can extract value from Ethereum, too. This is not a very technical game. It's just a a mind game, if you will.

Woo. All right, story time. Let's uh head back to D 5 2020 uh the D 5 Summit 2020 where things was a little bit more optimistic. We had, you know, YAM. We had the uh the the food farming seasons, you know. Uh D 5 Summit 2020, the YAM emoji was on full force. You would see it on Twitter everywhere. We would have like four-digit APY yields APR yields, you know, not APY APR, very clear distinction. Um Eternal Lands, the new pool too, just launched. Everyone was very optimistic about Yams future.

Everyone was delegating Yams to safe Yams, Dfy 2020. Um, yeah, food farming was in high gear. You would see Yam, Bao, Sushi, Pickle, Hotdog, Kimchi, all the various food tokens. You know, if you could name a food, you had a dot finance. You would probably get into probably get into like a website which has like a connect button. And, you know, being the curious farmers we are, we would hit connect. And uh, you know, uh, sign random transactions, maybe even approve random tokens. Uh, those were the good days. Uh, something I would like to emphasize as well was that back in the day Dai was a the preferred stable coin over USDC.

Like the full decentralized finance meme was in the it was in its highest gear. People didn't like USDC. People didn't really like USDT. Dai from Maker Dao was the preferred stable coin to to yield farming. In In fact, it was like preferred for naked staking. Meaning that you would just stake Dai in this particular pool and you'd get like food tokens, or governance tokens, if you will, um, by simply doing nothing. In fact, the demand for Dai was so high that um, it would often exceed uh, the market price for Dai would exceed a dollar. I'm talking relative you to USDC, by the way.

Um, so it would in fact go to as high as like a dollar and three cents, a dollar and two cents on the open market. Um, um, even though it was supposed to be a stable coin. Uh, this is like a very key distinction that I would like to emphasize because a stable coin going above a dollar is not does not make it stable at all. Oh, yeah, it's a decentralized stable coin. Dai is a decentralized stable coin as opposed to USDC. So, a little bit brief, like a for people who don't know what Dai is, it's basically a stable coin that is uh, issued by Maker Dao. So, how how it works is that it's an over collateralized stable coin. So, you would would you would put in uh, some collateral, uh commonly ETH, and you get

to mint DAI. DAI, and you get to if you would like to retrieve back your collateral, you have to refund DAI. So, that was like the key distinction. Um let's assume that and I'll give you one example right now. Let's assume ETH is like $100. If you would like to mint 100 DAI, which is supposed to be $100, you would put in a one ETH, sorry, you would put in 1.5 ETH to mint 100 DAI, assuming we're at 150% collateralization ratio. Now, this was back in the CDP days, all like the collateralized debt position.

So, it only allowed for sing- single asset collateralization in Maker DAO. Eventually, it moved on to something called the MCD, which is the multi-collateral DAO, where you could stake multiple assets, uh USDC being one of them, into Maker. Uh this was a very controversial decision because Maker was supposed to be this decentralized alternative to USDC. Uh sorry, to USDC, but including USDC as an collateral class for DAI seemed a bit uh counterintuitive. Uh but nevertheless, it happened, and you could mint 100 DAI with 110 USDC. I know people are like having little question marks. Why am I telling this story about stable coins when it's a talk about MEV, but I promise it'll be

relevant later on. Um yes, so 110 USDC to 100 DAI. Okay, let's rewind a little bit. One DAI uh trades for approximately 1.02 to 1.03 USDC. I know a lot of you guys probably won't care, but you know, these are juicy juicy arbitrage opportunities if you're able to find the opportunity. So, Maker went from 110% collateralization ratio to 101% collateralization ratio. Um and this was done through the government's proposal. In fact, it took like I think a week or two before everyone settled on a 101% uh collateralization ratio. Uh in fact, it was like 110, 105, 104, 3, 2, 1, but 101

was the preferred um everyone voted for 101. Now, does anyone see the opportunity here? This is only through a governance proposal and knowing that die trades were above market price. Yes. Yes, so you can do it exactly. So, uh this uh my brother in Christ mentioned that you can now arbit because die is trading above 101, meaning you can mint uh you can mint one die for 101 USDC. Uh I'll go into further detail how you would arbitrage this on on on curve, which was the primary market for selling and buying die back then.

But essentially, you went from 100 you couldn't you went from being able to mint 100 die using 110 USDC. Now, you can mint it with a 101 USDC. So, like a whole 9% was cut off. Uh again, this is on uh curve.finance. It was the money printer of my days uh 2020. Uh so, you could trade one die would give you 102 USDC. Wow. It's uh you know, it does not does not sound like much, but when you extrapolate this with many more zeros, that 1 cent suddenly becomes 10,000, 100,000 dollars.

So, uh I call this a bespoken path, if you will. Uh it's basically an alternative route other than the mainstream uh mainstream way of obtaining die. So, this is how you would print money. Let's say on die if die was trading on the market for more than 101 USDC. Um and let's let's just say die was trading uh at for 102 USDC. What you would do is flash loan 100 die, swap it to 102 USDC on curve, re-collateralize 101 USDC, and mint 100 die on maker. Now, you repay that loan, and you would profit 1 USDC.

That's a lot of work. Add more zeros, maybe it's worth it, maybe it's not. You tell me. Um but yes, keep in mind this was done in DeFi summer 2020 when I was hand arbing this in the public mempool for a And I remember my transaction being pending for a few blocks. Market was super inefficient back then. Uh but you know, uh profit's profit and sometimes uh it wasn't done algorithmically. We're like calculating by hand. Ooh, okay, it's trading above one 101 now. Okay, let's put in $10,000 and see if it works. And sometimes we lost money. Uh sometimes we didn't. But you know, it worked. Uh that's all I really wanted to emphasize on.

Um so yeah, what's the point of telling you all these stories? Uh the point is that you know, there's always more opportunities. Market is super inefficient for the long-tail stuff. Short-tail stuff these days it's extremely competitive simply because uh of the existence of flashbots and various like MEV groups. But uh back then long-tail is uh extremely inefficient. Does anyone remember the ApeCoin fiasco? People would flash loan uh bought apes and mint out ape tokens. I think the guy made like half a mill for like a one block. And and in fact, he was late by a couple minutes doing that. So all these long-tail stuff, if you if you can dig deep into like the governance proposals or if you if you know what's happening in the future, these long-tail opportunities are

extremely profitable still profitable simply because the market is inefficient. Oh yeah, so how do I get started? Yeah, pick your poison. Long-tail? Short-tail? What are you uh what are you good at? Uh you good at Do you want to level up in your technical skill or do you want to make money, I guess? Uh yes, two options. And to clarify, uh long-tail strategies are opportuni- uh long-tail opportunities are opportunities that are high in margin, but they come very rarely. Uh short-tail opportunities are very frequent opportunities, for example, arbitrage, but the margins are extremely low. So think like back running or sandwiching, not that I do any sandwiching. Um but yeah, uh it's very frequent, but the it's extremely

competitive. Long-tail is less competitive uh but uh as the frequency isn't there, but the margins are there. So pick your poison. So yeah, how do I get started? I guess uh what's your strength? Uh are you good at infrastructure? Are Are at code efficiency? Are you good at recon? By recon, I mean staring at Etherscan or staring at Flashbots Explorer for hours on end trying to trying to see is are there any competitors to this strategy or is there can I can I somehow be better than this particular MEV searcher.

And also find a team. You can't really it's two to three people is the optimal size. You know, too many cooks kind of spoil the broth sort of sort of analogy. And so you kind of have to share profits not ideal but it's better to cover more ground in my opinion with a team. You can cover more ground and gain more profits. You know, good artists borrow great artists steal Justin Sun 2020. Yeah, so if you see the cool thing about MEV and blockchain if you will is that everything is public. Every transaction, every opportunity that is extracted is public unless they're doing some kind of funky sex to the decks up but you can still extrapolate that if you decide to stare at the order books for long enough. But most on-chain

opportunities will be public. They are public. In fact, they don't go through Flashbots because people will know someone's extracting value from there. But if you decide to stare long enough on Etherscan um the opportunities are there and you can extract them. Um yes, good artists borrow great artists steal Justin Sun. Um yes, so my favorite tool for this is Etherscan. Um and how I find opportunities this is done more programmatically by the way. But one example if you would like deep into this is through Etherscan. If you like to just quickly get your hands wet get your feet wet is to use Etherscan.

Um notice that this transaction has a function signature which is not identified because if you look at all the other transactions I don't know if you guys can read it probably not but it's probably it has like it's identifiable function names like multi-call claim fill us atomic match. But occasionally you might find a function signature that is completely unrecognizable. That is usually someone doing some funky stuff. Usually usually. So click into that. Kind of see the transfer events, check out what's happening, you know, are there any funny funny token transfers?

Is he putting in $40 and getting out $42? Is he Is he putting nothing and getting out something? Because that does happen extreme more often than you think. Or the alternative, if you want to do long tail strategy, is to, you know, join some obscure protocol on Twitter or Discord, you know, comb through all the discussions and find out, "Oh, this governance proposal is going to change this parameter on this curve that suddenly creates a huge up opportunity." I remember when Synthetics was deploying the ETH wrapper. I don't know if anyone remembers that, but back then ETH to ST to Synthetics ETH S ETH, not ST ETH, a clarification that I need need to make. Um so S ETH is

ETH that was trading on Synthetics and then they launched a pool on Curve where you could trade between ETH and S ETH. S ETH was very S ETH that there wasn't much volume on S ETH, so there was a over supply on ETH on the Curve. Essentially, what that mean meant was that S ETH was trading for a premium on Curve. So, one ETH could net you 1.01 S ETH. And keep in mind, this is when ETH was 3 to 4K, not like the bad days right now. But Synthetics created a governance proposal to launch this thing called the ETH wrapper where you could immediately mint you could mint a ETH to S ETH at a one to one ratio.

And now you could swap that Now you could mint ETH to S ETH and trade it for a premium later on. I'm sorry I'm sorry, one S ETH gave you 1.01 ETH, not the other way around. Something I want to clarify. Yes. Uh but yeah, if you dig deep enough to these governance proposals and you stay long enough on the Discord, you know, you'll be active on the chats, you know, these you do find some golden nuggets. And in fact, you only need one opportunity like so because this was a six to seven figure opportunity. It was about being two to 300 ETH when ETH was three to 4K. So, you do the math.

I not like I got anything from it, but yes. Uh yeah, so I realized I spoke really fast, probably because you guys are extremely attractive, which made me extremely nervous. But please realize that the market is super inefficient. So, avoid having imposter syndrome. Pick your poison, you know, long versus short tail. What do you want to do? You want high margin, high margin low frequency, high frequency low margin. You know, playing your strengths. Yes, playing teams. So, if you're good at infrastructure, layer two is probably your game cuz you need to figure out, "Okay, well, how do I get this transaction propagate faster than other people?" Or if you're you know, like setting up the infrastructure, like doing information surfacing.

It's a lot of work. It's a lot of work that feels like busy work. It's a lot of Yeah, you're just running in circles, but if you want to do MEV, I guess you got to do what you got to do. If you enjoy gas golfing, you know, do it on Ethereum L1 is very fun. The infrastructure's built for you. Thank you, Flashbots. I was going to be a Flashbots community manager, but they denied my application. So, if anyone's hiring for community managers, please let me know. Yeah, find a team. Yeah, play your strengths. And yeah, that's the end of my talk. Any questions? [applause] I I see you're all speechless apart from my brother in Christ.

Uh so, the question was, "What's the favorite long tail strategy?" My favorite long tail strategy is this function called gift birth on CryptoKitties, where if you call gift birth, you're rewarded some ETH for some reason. Sometimes I mean, it's extremely It's not very profitable, but it's quite interesting. There's like this one account doing like 100,000 transactions just calling gift birth for CryptoKitties, which is still profitable today. But yeah, now that now that I mentioned it, it's probably no longer profitable. Yeah. Yep, no more questions? Well, speechless. Great. Uh have a good night.

You know, save the best talk for last. Uh thank you. [applause]