MEV Protection Scanner
Purpose
Detect MEV (Maximal Extractable Value) attacks before they happen and provide protection recommendations.
Specification
Job: Scan pending transactions for sandwich attacks, front-running, and other MEV exploits. Return risk assessment and protection strategies.
Inputs:
token_in - Token being sold (e.g., "USDC")
token_out - Token being bought (e.g., "ETH")
amount_in - Amount to trade
dex - DEX to use (e.g., "uniswap-v2", "sushiswap")
transaction_hash (optional) - Specific pending tx to analyze
Returns:
risk_score - MEV risk level (0-100)
attack_type - Type of attack detected (sandwich, front-run, none)
estimated_loss_usd - Potential loss if exploited
protection_suggestions[] - Actionable protection strategies
competing_txs - Number of competing transactions in mempool
gas_price_percentile - Where user's gas price ranks
Acceptance Criteria
✅ Real-time mempool monitoring via Infura WebSocket or Blocknative API
✅ Detects sandwich attacks (front-run + back-run patterns)
✅ Detects front-running (high gas competing transactions)
✅ Response time < 3 seconds
✅ Detection accuracy > 80%
✅ Must be deployed on a domain and reachable via x402
Done When
Agent provides accurate MEV risk assessment with real blockchain data and actionable protection recommendations.
Basic Example
import { z } from "zod";
import { createAgentApp } from "@lucid-dreams/agent-kit";
const { app, addEntrypoint } = createAgentApp({
name: "mev-protection-scanner",
version: "1.0.0",
description: "Detect MEV attacks before they happen",
});
addEntrypoint({
key: "scan_transaction",
description: "Scan for MEV attack risks",
input: z.object({
token_in: z.string(),
token_out: z.string(),
amount_in: z.string(),
dex: z.enum(['uniswap-v2', 'uniswap-v3', 'sushiswap', 'curve'])
}),
async handler({ input }) {
// Analyze mempool for MEV patterns
const risk_score = analyzeMEVRisk(input);
return {
output: {
risk_score,
attack_type: "sandwich",
estimated_loss_usd: 45.50,
protection_suggestions: [
"Use Flashbots Protect RPC",
"Increase slippage tolerance to 2%"
]
},
usage: { total_tokens: 1 }
};
},
});
export default app;
Resources
Submission
Submission is a PR into this repo linking the issue - first in first served if the bounty has been completed.
MEV Protection Scanner
Purpose
Detect MEV (Maximal Extractable Value) attacks before they happen and provide protection recommendations.
Specification
Job: Scan pending transactions for sandwich attacks, front-running, and other MEV exploits. Return risk assessment and protection strategies.
Inputs:
token_in- Token being sold (e.g., "USDC")token_out- Token being bought (e.g., "ETH")amount_in- Amount to tradedex- DEX to use (e.g., "uniswap-v2", "sushiswap")transaction_hash(optional) - Specific pending tx to analyzeReturns:
risk_score- MEV risk level (0-100)attack_type- Type of attack detected (sandwich, front-run, none)estimated_loss_usd- Potential loss if exploitedprotection_suggestions[]- Actionable protection strategiescompeting_txs- Number of competing transactions in mempoolgas_price_percentile- Where user's gas price ranksAcceptance Criteria
✅ Real-time mempool monitoring via Infura WebSocket or Blocknative API
✅ Detects sandwich attacks (front-run + back-run patterns)
✅ Detects front-running (high gas competing transactions)
✅ Response time < 3 seconds
✅ Detection accuracy > 80%
✅ Must be deployed on a domain and reachable via x402
Done When
Agent provides accurate MEV risk assessment with real blockchain data and actionable protection recommendations.
Basic Example
Resources
Submission
Submission is a PR into this repo linking the issue - first in first served if the bounty has been completed.