Playing MEV games - $17,000 prize with very little competition
After building a bunch of liquidation and arbitrage bots on the Ethereum mainnet, I finally participated in my first ever MEV game on a layer 2. With real money. Here are my findings after burning through about 0.8ETH(fetching...) on the First.LOL experimental MEV game on Zora blockchain π°π₯ π₯΅
What is the game?
The game is very simple. You accure points by claiming blocks. Each block you claim is exactly one point. Who ever has the most points at the end of the game wins the prize money. A smart contract was deployed and seeded with 10ETH(fetching...) - this is the prize money. Here are some of the rules of the game:
- You can claim a block by calling the
claimBlock
function on the smart contract - Each block can only be claimed once
- Each block can only be claimed by one address
- You can only claim blocks before the game ends
- The game runs for exactly 60 days from the time of deployment
You can see the current leaderboard on the official game website. At the time of this writing, we are only half way through the game. The game ends on 21st October 2023 at around 20:00 GMT.
Cost of playing the game
Zora is a layer 2 blockchain that uses the OpStack from Optimism. The blocktime is 2 seconds. This means that there are 43,200 blocks to claim per day. The game runs for 60 days. This means that there are a total of 2,592,000 blocks in the game.
The cost of claiming a block is simply the transaction fee to call the
claimBlock
function
On a layer 2 blockchain, there are 2 components to the transaction fee: Gas fee and Security fee. Both of these are denoted and paid in ETH. Let's look at each of these in detail.
- The gas fee: This is the fee paid to the layer 2 for processing the transaction. Unlike the Ethereum mainnet, the gas fees on Zora tend to very very low - the current base fee is
0.00000005 Gwei
- so, this component is negligible. We will see later why priority fee is also unimportant on Zora. - The security fee: This is the fee paid by each transaction on Zora for the data it uses on Ethereum mainnet for security. This is roughly equal to
0.684 * 1968 * L1_GAS_FEE
. TheL1_GAS_FEE
is the gas fee on Ethereum mainnet which is currently fetching... - varies depending on demand. For more details on how this is calculated, see this Optimism Doc.
When
L1_GAS_FEE
is11 Gwei
, the cost of claiming a block is 0.0000148072ETH(fetching...).
If you want get an estimate of how many blocks you can claim for a given L1_GAS_FEE
threshold, you can use the First LOL - Blocks estimator.
Game strategy
If you adopt a naive strategy of claiming every block. You may attempt to claim as many blocks as possible without concern for the cost. This is a bad strategy because you will end up paying more in transaction fees than the prize money.
A better strategy would be to monitor the cost of claims and claim blocks when it is cheaper to do so. Since majority of the cost is the security fee, you can monitor the L1_GAS_FEE
and claim blocks when it is below a certain threshold. Now the question is, what should that threshold be? You can use the First LOL - Blocks estimator to get an estimate of how many blocks you can claim for a given L1_GAS_FEE
threshold.
Competing with other players
It's not hard to imagine that other players will also be monitoring the L1_GAS_FEE
and will be trying to claim blocks when it is below a certain threshold. This means that you will be competing with other players to claim the same block. This is where the game gets interesting. The real winner is decided by who can claim the block first when people are competing for the same block.
β½οΈ Gas wars - using a higher priority fee
If you look at some of the type of the transactions used by the current top player - see here and here, you will notice that they are always type 0. The priority fee in these transactions is always set to 0 Gwei
. I figured maybe I will have an edge by using type 2 transactions and setting a non-zero priority fee. It made no difference what so ever! I was paying more in transaction fees with my type 2 txs and still losing the block to the other player using a type 0 txs. To understand this better, I dug into ethereum-optimism/op-geth. The source code implies the priority fee should be respected for ordering but that doesn't seem to be the case in practice. I am not sure why this is the case. If you know, please let me know.
β½οΈβ½οΈ Gas wars again - using higher gas limit
The tx to claim a block typically consumes about 48K gas. I noticed that another player was using a gas limit of 80K and winning over me. So, I tried using a gas limit of over 100K and for some inexplicable reason, I was winning over the other player. I am not sure why this is the case. Soon, this strategy stopped working and I was losing again. Despite, trying different gas limits, all the way upto 2.1M, I was unable to win over the other player. To be honest, I'm not sure why this strategy seemingly worked for a short period of while anyway.
π Smart Contract for claims
I reached out to the CTO of Zora network who suggested it may be because the gas consumed by my claims is lower than someone using a smart contract and that's likley playing a role in the ordering. He linked me to ethereum-optimism/op-geth - worker.py. This didn't make sense to me after reading the code but I tried this anyway and sadly that made no difference either. So, moving on...
β³ Latency wars - using a proximate node
I suspected that the other player was using a node that is closer to the Zora network sequencer to win 100% of the time! - Serioulsy? So, I deployed a node in New York and ran my bot there. I was really hopeful about this strategy but it made no difference either. I was still losing to the other player, again 100% of the time! At this point, I'm completely lost. It's possible that I'm wrong about the location of the sequencer so, the other played was still closer than me? I tried some techniques by delaying the claim requests, that didn't seem to work either.
π€¨ What is going on?
I'm not entirely sure, yet. I can't think of any strategy that gives someone this level of advantage in block positing. I suspect it must be either the other player has a side channel deal with the sequencer for block position bidding (like flashbots on Ethereum mainnet) or a different strategy to win in the latency wars. I'm really suprised that gas priority didn't make a difference at all!
What next?
For now, I paused the game until I work out what's going on! If you have ideas, let me know. I have a very competant bot and tooling that can monitor network conditions and claim blocks at a very low cost. If you have a better strategy, or want to jump in the game, and need a head start, I can share my bot source code for a small fee of 0.25ETH(fetching...). If you are interested, reach out to me on Twitter. There is really only one active player and the prize is 10ETH(fetching...). So, it's a pretty good deal.