https://hackmd.io/@flashbots/quantifying-REV
Alejo Salles – Flashbots
Maximal (formerly Miner) Extractable Value (MEV) is the value that can be extracted from a blockchain by any agent without special permissions. Considering this permissionless nature, any agent with transaction ordering rights will be in a privileged position to perform the extraction. In Proof of Work blockchains, it is miners who determine transaction ordering within a block, hence the former “miner” term. In practice, bot operators seek to extract MEV by either paying high fees to increase the likelihood that their transactions are mined, or by fine-tuning their gas price choices in order to “time” their transactions right, as is the case when backrunning an oracle update to perform a liquidation.
Despite much recent discussion about the topic and, in particular, its associated risks for the Ethereum protocol, we still lack a cohesive formal model for quantifying MEV extraction. At Flashbots, we have released an MEV explorer where we shed light on various aspects of this phenomenon. While we do elaborate on our metrics in the site, they still lack a formal definition. Here, we attempt to provide a unifying operational framework that consolidates MEV extraction metrics, focusing on the Ethereum network[1].
The first important point to make is that MEV is a theoretical quantity that we can only approach asymptotically. Unforseen extraction methods can and will be devised (every new DeFi hack is an MEV extraction event). Hence, we will here focus instead on the Realized Extractable Value, notated REV, where REV≤MEV. In other words, REV is the actual value extracted from the blockchain from MEV opportunities[2].
We note that there’s two classes of actors in the system, searchers and miners. We use the generic label miner for actors that bear the privileged role of transaction inclusion and ordering. Searchers are any non-privileged actors aiming to profit from these opportunities. Crucially, miners can also act as searchers.
Extracting MEV incurs externalities, like increasing gas costs for all users of the network, or bloating the chain. We won’t dwell into the implications of these externalities here, but we will make them manifest in the model. For more on this and the “MEV Crisis”, be sure to check our Flashbots introductory post.
We are now ready to begin building our framework, starting with a simple model that ignores direct miner payments and searcher competition and other externalities like opportunity checks. We will revisit the model to account for these at a later stage.
We begin with a model where a single searcher performs an MEV extraction, sharing proceeds with the block miner via gas fees only. We further assume that miners order transactions by descending gas price, which approximates well their optimal strategy and is the default in Ethereum node software.
where REVS is the value that goes to the searcher, and REVM is the value that goes to the miner. Note that, as we expand on below, REV already encompasses the opportunity’s extraction costs (i.e. the actual REV of an opportunity depends on the gas price of the network at extraction time[3]).
where Vout is the value that flows from the searcher to the blockchain in the transactions performing the extraction (excluding gas); Vin is the value flowing from the blockchain to the searcher; gMEV is the gas price of the transactions; and sMEV is their size, i.e. the total amount of gas they consumed. Vout, Vin, and gMEV are denominated in the base network currency (ETH), while sMEV is in units of gas. Separating the gas term from Vout will be helpful in quantifying the extraction costs, and it is also how we compute REVS in practice.
We use “the blockchain” loosely here to refer to any other addresses (corresponding to smart contracts or EOAs) that are not the EOA of the extracting transactions, or smart contracts controlled by the searcher. Note that identifying these is a heuristic-guided process based on known searcher patterns, and by all means fallible. Also, we stress that any ancillary transactions related to the MEV extraction (like the “meat” in a sandwich attack) are not part of the set of transactions that contribute to the above variables.
Turning to the miner side, we have:
where geff is the effective gas price of the transactions that would have been included in the block had the opportunity not been taken. REVM is thus defined to include the opportunity cost the miner incurs by including the MEV-extracting transactions.
As transactions in the mempool are ephemeral, it is impossible to measure geff a posteriori from only blockchain data and logs. We resort to an approximation that also serves as a lower bound for the value realized by the miner:
Plugging equations (2) and (4) we get for the total realized value:
In this rendition the miner and searcher roles are blurred, but we can clearly identify the extraction costs of the opportunity, given by the subtrahend sMEV.gtail.
Finally, note that the value split between searcher and miner at this stage is entirely decided by the choice of gMEV, which is in turn affected by the nature of the opportunity and the presence of other searchers trying to exploit it.