mirror of
https://github.com/autistic-symposium/mev-toolkit.git
synced 2025-04-27 11:19:13 -04:00
⚡🧱⛓ [scratch notes] Stateful Blockchains, MEV, Solidity ...
In this scratch space I dump some of my random and highly unorganized notes. Use at your own risk.
☠ My notes
- Chapter I:
geth
and running an Ethereum node - Chapter II: The Mempool and MEV
- Chapter III: Flashbots
- Chapter IV: Flashbots bundle
☠️ My code
☠️ Some terminology
Merkle tree: a type of binary tree, composed of a set of notes with a large number of leaf nodes at the bottom of the tre containing the underlying data, a set of intermediate nodes where each node is the hash of its two children, and finally a single root node, also formed from the hash of its two children, representing the top of the tree.
𝕄𝕒𝕩𝕚𝕞𝕒𝕝 𝕖𝕩𝕥𝕣𝕒𝕔𝕥𝕒𝕓𝕝𝕖 𝕧𝕒𝕝𝕦𝕖 (MEV, formerly "miner" in the context of Proof of Work) 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.
The 𝕞𝕖𝕞𝕡𝕠𝕠𝕝 is the set of pending, unconfirmed transactions in the EVM... when someone sends a transaction in the blockchain, there is a delay between the time when the transaction is broadcasted to the network and when it is actually mined into a block. During this period, transactions sit in a pending transaction pool, the mempool, where contents are visible to everyone.
𝔽𝕣𝕠𝕟𝕥𝕣𝕦𝕟𝕟𝕚𝕟𝕘, also known as Priority Gas Auctions (PGAs), happens 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 (e.g., to snatch a Uniswap price arbitrage trade to rebalance a pool).
𝔹𝕒𝕔𝕜𝕣𝕦𝕟𝕟𝕚𝕟𝕘 happens when 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).
𝕊𝕒𝕟𝕕𝕨𝕚𝕔𝕙𝕚𝕟𝕘 is the profiting off slippage in liquidity pools by buying and selling before and after large transactions posted in the mempool.
𝔻𝔼𝕏 𝕒𝕣𝕓𝕚𝕥𝕣𝕒𝕘𝕖 happens when two DEXes are offering a token at two different prices and one can buy the token on the lower-priced DEX and sell it on the higher-priced DEX.
𝕃𝕚𝕢𝕦𝕚𝕕𝕒𝕥𝕚𝕠𝕟𝕤 happens when the value of a borrowed asset exceeds the collateral and anyone can liquidate the collateral and collect the liquidation fee for themselves.
Long Tail MEV encompasses all other forms of MEV not described here. Long Tail MEV describes niche, arcane, undiscovered MEV often realized through interacting with lesser known protocols, event based strategies, or unorthodox economic mechanisms.
☠️ Further resources and good readings
- Flashbots
- MEV wiki
- Etherscan data on flashbots
- MEV Dashboard by Flashbots.
- KeeperDAO plan for MEV protection
- A list of open problems in DeFi by Emperor
- Sandwiched?
- How to use Flashbots
- Flashbots bundle explore
- Flash Boys 2.0, the original article
- Ethereum is a Dark Forest by Paradigm
- Escaping the Dark Forest by samczsun
- How to Build an Ethereum Mining Pool by Dragonfly research
- MEV and Me by Paradign
- "if block rewards are small enough compared to MEV, it can be rational for miners to destabilize consensus."
- "The rate at which MEV accumulates on a given blockchain is generally proportional to the complexity of its application-layer behavior."
- Return to the Dark Forest by rekt
- Modern MEV sandwich attacks on Ethereum routers by totlsota
- Dr. Reorg or: How I Learned to Stop Worrying and Love MEV by Saneel Sreeni
- Hiding in Plain Sight by samczsun
- We Live In A Mempool: Backrunning the MEV Crisis by Tom Schmidt
- How To Light Up The Dark Forest by Robert Miller
- KeeperDAO's whitepaper
- Blockchains are Cities by Haseeb Qureshi
- "Ethereum is NYC, Solana is LA"
- Endgame by Vitalik
- "a chain where block production is still centralized, but block validation is trustless and highly decentralized"
- Soulbound by Vitalik
- "Making more items in the crypto space soulbound can be one path toward where NFTs can represent much more of who you are and not just what you can afford."
📙 𝕋𝕙𝕖 𝕞𝕒𝕜𝕖 𝕠𝕗 𝕒 𝕔𝕪𝕡𝕙𝕖𝕣𝕡𝕦𝕟𝕜
- A Graduate Course in Applied Cryptography
- The Cypherpunk Manifest by Eric Hughes
- The Hacker Manifest by The Mentor
- How to be a Pirate by CGP Grey
- Bitcoin Whitepaper by Satoshi Nakamoto
- "an electronic payment system based on cryptographic proof instead of trust..."
Description
👾 notes and resources on blockchain's maximal extractable value: on the hope of non-predatory free markets in the metaweb
arbitrage-botautismavalanchebackrunningblockchainbotscypherpunkdefiethereumflashbotsfrontrunningliquidationliquidatormempoolmevoraclesrelaysrustsandwich-attackssolidity
Readme
2.3 MiB
Languages
Shell
50.1%
Python
46%
Dockerfile
3.9%