🤖🧱⛓ [bt3gl's scratch space] Stateful Blockchains, MEV, and Flashbots


"Maximal (formerly "miner" in the context of Proof of Work) extractable value (MEV) refers to the maximum value that can be extracted from block production in excess of the standard block reward and gas fees by censoring and/or changing the order of transactions in a block." - MEV Wiki




My notes





My code





Further resources





Some terminology


  • Mempool: the set of pending, unconfirmed transactions in the EVM.
  • MEV: Maximal (or miner) Extractable Value
  • Frontrunning: also known as Priority Gas Auctions (PGAs), when a miner steals a profitable opportunity (such as arbitrage) for themselves by sending the same transaction with a higher gas price. For example, a transaction A is broadcasted with a higher gas price than an already pending transaction B so that A gets mined before B (eg. to snatch a Uniswap price arbitrage trade to rebalance a pool).
  • Backrunning: a transaction A is broadcasted with a slightly lower gas price than already pending transaction B so that A gets mined right after B in the same block. (eg. to execute a DyDx liquidation after a price oracle update that triggers a DyDx loan to go under the required collateralization ratio).
  • Sandwiching: profiting off slippage in liquidity pools by buying and selling before and after large transactions posted in the mempool.
  • DEX arbitrage: If two DEXes are offering a token at two different prices, one can buy the token on the lower-priced DEX and sell it on the higher-priced DEX.
  • Liquidations: if the value of a borrowed asset exceeds the collateral, anyone can liquidate the collateral and collect the liquidation fee for themselves.



Description
👾 notes and resources on blockchain's maximal extractable value: on the hope of non-predatory free markets in the metaweb
Readme 2.3 MiB
Languages
Shell 50.1%
Python 46%
Dockerfile 3.9%