mev-strategies
Skill16 starsChanged 8 months agoMITView on GitHub
Definition: MEV is the maximum value that can be extracted from block production beyond the standard block reward and gas fees, by including, excluding, or reordering transactions within a block. Primary MEV Types: Flashbots Ecosystem: - Flashbots Protect — private transaction submission, bypasses public mempool - Flashbots Auction (MEV-Auction) — searchers bid for bundle inclusion - MEV-boost — out-of-protocol PBS implementation for Ethereum - MEV-Share — redistributes MEV back to users who originated the transactions MEV-Boost Architecture: Proposer-Builder Separation (PBS):…
In this repository83 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- live-trading-monitoringSkill
- monte-carlo-simulationSkill
- overfitting-preventionSkill
- research-notebooksSkill
- strategy-evaluationSkill
- walk-forward-optimizationSkill
- cross-chain-arbitrageSkill
- crypto-derivativesSkill
- defi-protocolsSkill
- on-chain-analyticsSkill
- stablecoin-analysisSkill
- tokenomicsSkill
- yield-farmingSkill
- alternative-dataSkill
- data-qualitySkill
- data-vendorsSkill
- feature-engineeringSkill
- sentiment-analysisSkill
- web-scraping-financeSkill
- binomial-treesSkill
- black-scholesSkill
- credit-derivativesSkill
- exotic-optionsSkill
- hedging-strategiesSkill
- interest-rate-derivativesSkill
- monte-carlo-pricingSkill
- structured-productsSkill
- vol-surfacesSkill
- vol-tradingSkill
- execution-algosSkill
- latency-optimizationSkill
- market-microstructure-theorySkill
- order-flow-analysisSkill
- performance-metricsSkill
- smart-order-routingSkill
- tick-data-processingSkill
- transaction-cost-analysisSkill
- central-bank-analysisSkill
- commodities-fundamentalsSkill
- economic-indicatorsSkill
- fx-fundamentalsSkill
- geopolitical-riskSkill
- yield-curve-analysisSkill
- alternative-allocationsSkill
- benchmark-trackingSkill
- black-littermanSkill
- factor-investingSkill
- markowitz-optimizationSkill
- portfolio-attributionSkill
- rebalancing-strategiesSkill
- risk-paritySkill
- alpha-researchSkill
- bayesian-methodsSkill
- deep-learning-tradingSkill
- factor-modelsSkill
- kalman-filtersSkill
- ml-for-financeSkill
- regime-detectionSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 96
Use Flashbots Protect or MEV-blocker for private transaction submission
- Distinctive: line 98
Use limit orders instead of market swaps where possible
- Distinctive: line 100
Use DEX aggregators that route through private pools (CoW Swap, 1inch Fusion)
- Distinctive: line 211
Before engaging with MEV strategies or assessing MEV risk, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MEV Strategies
When to Activate
- Analyzing Maximal Extractable Value (MEV) opportunities or risks in DeFi transactions
- Understanding frontrunning, sandwich attacks, and DEX arbitrage mechanics
- Evaluating MEV mitigation strategies (Flashbots, MEV-boost, private mempools)
- Designing transactions to minimize MEV extraction or to participate in MEV capture
- Assessing proposer-builder separation (PBS) and its implications for protocol design
Core Concepts
MEV Taxonomy
Definition: MEV is the maximum value that can be extracted from block production beyond the standard block reward and gas fees, by including, excluding, or reordering transactions within a block.
Primary MEV Types:
- DEX Arbitrage — exploiting price differences between DEXs or between DEX pools
- Atomic: execute in a single transaction using flash loans
- Cross-DEX: Uniswap pool price differs from SushiSwap
- Cross-pool: triangular arbitrage across 3+ pools (ETH->USDC->DAI->ETH)
- Estimated 60-70% of all MEV by volume
- Sandwich Attacks — frontrunning and backrunning a victim's swap
- Attacker sees pending swap in mempool
- Frontrun: buy the token before victim, pushing price up
- Victim's swap executes at worse price
- Backrun: sell the token after victim at higher price
- Profit = price impact created minus gas costs
- Victim loses: their effective slippage exceeds expected slippage
- Liquidation MEV — racing to liquidate undercollateralized positions
- Monitor health factors on Aave, Compound, MakerDAO
- First to call liquidate() captures the liquidation bonus (5-10%)
- Gas priority auctions among competing liquidation bots
- Flash loans enable liquidation without upfront capital
- NFT MEV — sniping underpriced listings, frontrunning mints
- Less systematic, more event-driven
- Mint sniping during popular launches
- Long-tail MEV — protocol-specific extraction (governance, oracle manipulation)
Sandwich Attack Mechanics (Detailed)
Mempool state: Victim wants to swap 10 ETH -> USDC on Uniswap
Pool state: 1000 ETH / 2,000,000 USDC (price = 2000 USDC/ETH)
Victim slippage tolerance: 1%
Attacker frontrun:
- Buy with 50 ETH -> receives ~95,238 USDC
- New pool: 1050 ETH / 1,904,762 USDC (price = 1814 USDC/ETH)
Victim swap executes:
- 10 ETH -> receives ~17,878 USDC (vs ~19,802 without sandwich)
- Victim loses ~$1,924
Attacker backrun:
- Sell 95,238 USDC -> receives ~51.8 ETH
- Profit: ~1.8 ETH minus gas costs (~0.1 ETH)
- Net MEV extracted: ~1.7 ETH ($3,400)Flashbots and MEV Infrastructure
Flashbots Ecosystem:
- Flashbots Protect — private transaction submission, bypasses public mempool
- Flashbots Auction (MEV-Auction) — searchers bid for bundle inclusion
- MEV-boost — out-of-protocol PBS implementation for Ethereum
- MEV-Share — redistributes MEV back to users who originated the transactions
MEV-Boost Architecture:
Transaction flow:
User -> Mempool -> Searchers (find MEV) -> Builders (construct blocks)
-> Relays (validate blocks) -> Proposers (select highest-bid block)
Key actors:
- Searchers: find MEV opportunities, create bundles
- Builders: aggregate bundles into full blocks, bid for inclusion
- Relays: trusted intermediaries that validate builder blocks
- Proposers: validators who select the winning blockProposer-Builder Separation (PBS):
- Separates block building (selecting/ordering transactions) from block proposing (validating)
- Prevents validators from directly extracting MEV
- Enables competitive block building market
- Enshrined PBS: protocol-level implementation (in Ethereum roadmap)
- Current MEV-boost is out-of-protocol, trusted relay model
MEV Mitigation Strategies
For Users:
- Use Flashbots Protect or MEV-blocker for private transaction submission
- Set tight slippage tolerance (but not so tight trades fail)
- Use limit orders instead of market swaps where possible
- Break large trades into smaller chunks via TWAP
- Use DEX aggregators that route through private pools (CoW Swap, 1inch Fusion)
For Protocols:
- Batch auctions — CoW Protocol: all trades in a batch settle at uniform clearing price
- Encrypted mempools — threshold encryption, commit-reveal schemes
- Fair ordering — Chainlink FSS (Fair Sequencing Services)
- MEV redistribution — MEV-Share, protocol-owned MEV capture
- Time-weighted average pricing — reduce single-block manipulation
- Backrunning-only auctions — allow beneficial arbitrage, block harmful frontrunning
Methodology
MEV Opportunity Assessment
- Identify the MEV type — arbitrage, liquidation, sandwich, or protocol-specific
- Estimate gross revenue — price discrepancy * trade size, liquidation bonus * position size
- Calculate costs — gas cost, priority fee/bid, flash loan fee, capital cost
- Assess competition — how many other searchers target this opportunity? Profit margins compress with competition
- Evaluate risk — failed transactions cost gas, smart contract risk, inventory risk for non-atomic strategies
- Determine infrastructure — latency requirements, builder relationships, private mempool access
Searcher Profitability Analysis
Expected profit per opportunity:
E[profit] = P(win_auction) * (gross_MEV - gas - bid) - P(lose_auction) * wasted_gas
Where:
- P(win_auction) decreases as more searchers compete
- Bid converges toward gross_MEV in competitive markets
- Wasted gas = cost of failed/reverted transactions
- Mature MEV types (DEX arb) have thin margins; novel types have wide marginsMEV Risk Assessment for DeFi Users
1. Estimate trade size relative to pool liquidity
2. Calculate expected price impact without MEV
3. Add MEV extraction estimate (typically 20-80% of available sandwich profit)
4. Compare total execution cost vs. using private transaction channels
5. For large trades: evaluate TWAP, RFQ, or batch auction alternativesExamples
Example 1: Atomic DEX Arbitrage
Opportunity:
- Uniswap ETH/USDC pool: ETH price = $2,010
- SushiSwap ETH/USDC pool: ETH price = $2,000
- Price discrepancy: $10 per ETH
Execution:
1. Flash loan 100 ETH from Aave
2. Sell 100 ETH on Uniswap at $2,010 = $201,000
3. Buy ~100.5 ETH on SushiSwap for $201,000
4. Repay 100 ETH flash loan + 0.05 ETH fee
5. Profit: 0.45 ETH (~$900) minus gas and builder tip
Bundle submission:
- Submit via Flashbots to avoid mempool exposure
- Bid 60% of profit to builder ($540) to ensure inclusion
- Net profit: ~$360 per opportunityExample 2: Liquidation Bot Strategy
Monitoring:
- Track 10,000+ Aave positions continuously
- Pre-compute liquidation prices for each position
- Subscribe to pending block headers for price updates
Execution when position becomes liquidatable:
- Health factor drops below 1.0
- Flash loan the debt asset
- Call liquidate() repaying debt, receiving collateral + bonus
- Swap collateral back to debt asset
- Repay flash loan
Economics:
- Average liquidation bonus: 5%
- Average liquidation size: $50,000
- Gross profit: $2,500
- Gas + builder tip: $500-1,000
- Net profit: $1,500-2,000 per liquidation
- Competition: high, latency-sensitive (sub-block timing)Example 3: MEV Protection Comparison
Trade: Swap 50 ETH -> USDC
Route 1 — Public mempool (Uniswap directly):
- Expected output: 99,500 USDC
- Sandwich extraction: -$800 (estimated)
- Actual output: ~98,700 USDC
Route 2 — Flashbots Protect:
- Expected output: 99,500 USDC
- No sandwich possible (private submission)
- Actual output: ~99,400 USDC (normal slippage only)
Route 3 — CoW Swap (batch auction):
- Expected output: 99,600 USDC (surplus from batch matching)
- No MEV extraction + potential price improvement
- Actual output: ~99,550 USDC
Recommendation: For trades >$10K, always use MEV protection.
CoW Swap provides best execution for large stablecoin swaps.Quality Gate
Before engaging with MEV strategies or assessing MEV risk, verify:
- MEV type is correctly identified — arbitrage is constructive (improves pricing), sandwich is extractive
- All costs are accounted for — gas, priority fees, builder bids, flash loan fees, failed transaction costs
- Competition level is assessed — mature MEV types have razor-thin margins, often negative EV for new entrants
- Smart contract interactions are audited — flash loan callbacks and complex multi-hop swaps carry exploit risk
- Regulatory considerations noted — some MEV activities may face legal scrutiny (particularly sandwich attacks)
- Infrastructure requirements are realistic — sub-second latency, dedicated builder relationships, custom node setup
- MEV protection recommendations for users match their trade size and frequency
- PBS architecture understanding is current — the MEV supply chain evolves rapidly
- Cross-chain MEV is considered — bridges and L2 sequencers introduce new MEV dynamics
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

