← Back to all products

MEV Monitoring Agent

$13

Real-time dashboard for monitoring mempool activity, profitable opportunities, and bot status.

📁 18 files
TOMLPythonMarkdown

📁 File Structure 18 files

mev-monitoring-agent/ ├── LICENSE ├── README.md ├── pyproject.toml ├── security-notes.md ├── src/ │ └── mev_monitoring_agent/ │ ├── __init__.py │ ├── agent.py │ ├── alerts/ │ │ ├── __init__.py │ │ ├── channels.py │ │ └── manager.py │ ├── config.py │ ├── detectors/ │ │ ├── __init__.py │ │ ├── backrun.py │ │ ├── base.py │ │ ├── frontrun.py │ │ └── sandwich.py │ └── types.py └── tests/ ├── __init__.py └── test_agent.py

📖 Documentation Preview README excerpt

MEV Monitoring Agent

Background service alerting when your contracts are being MEV'd.

Price: $12.99 | License: MIT | Python: 3.10+


What It Does

The MEV Monitoring Agent watches on-chain transactions interacting with your smart contracts and detects common MEV extraction patterns in real time:

  • Sandwich attacks — Front-run + victim + back-run swap patterns
  • Frontrunning — Priority gas auctions and transaction displacement
  • Backrunning — Arbitrage or liquidation immediately after your transactions

When MEV is detected, alerts are dispatched to your configured channels: Slack, Telegram, webhooks, email, or a log file.

Quick Start


# Install
pip install -e .

# Set environment variables
export RPC_URL="https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY"
export MONITOR_CONTRACTS="0xYourVault,0xYourDEX"
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK"

# Run
mev-monitor

Features

FeatureDescription
Sandwich detectorIdentifies A-B-A patterns in consecutive transactions
Frontrun detectorFlags high-gas transactions preceding your users' txs
Backrun detectorDetects immediate follow-up arbitrage after monitored txs
Multi-channel alertsSlack, Telegram, webhook, email, log file
Configurable thresholdsMin profit, gas multiplier, time window
Graceful shutdownSIGINT/SIGTERM handling with summary stats
ExtensibleAdd custom detectors via BaseDetector

Configuration

Environment Variables

VariableDefaultDescription
RPC_URLhttp://localhost:8545HTTP RPC endpoint
WS_RPC_URLws://localhost:8546WebSocket RPC endpoint
POLL_INTERVAL2Seconds between block polls
MONITOR_CONTRACTSComma-separated contract addresses
MIN_PROFIT_ALERT_WEI10^15 (0.001 ETH)Minimum profit to trigger alert
LOG_LEVELinfoLogging level

Alert Channels

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/mev_monitoring_agent/agent.py # ═══════════════════════════════════════════════════════════════════════ # MEV Monitoring Agent — Core Agent # Background service that monitors contracts for MEV extraction # ═══════════════════════════════════════════════════════════════════════ from __future__ import annotations import asyncio import logging import signal import time from typing import Optional from web3 import Web3 from .config import MonitorConfig from .types import MEVEvent, MEVType, AlertSeverity from .detectors.base import BaseDetector from .detectors.sandwich import SandwichDetector from .detectors.frontrun import FrontrunDetector from .detectors.backrun import BackrunDetector from .alerts.manager import AlertManager logger = logging.getLogger(__name__) class MEVMonitoringAgent: """ Background MEV monitoring service. Watches on-chain transactions interacting with monitored contracts and runs detection heuristics for various MEV types. When MEV is detected, alerts are dispatched via the configured channels. Usage: config = MonitorConfig.from_env() agent = MEVMonitoringAgent(config) agent.run() """ def __init__(self, config: MonitorConfig) -> None: self.config = config self.w3 = Web3(Web3.HTTPProvider(config.rpc_url)) self.alert_manager = AlertManager(config) self.detectors: list[BaseDetector] = [] self._running = False self._events: list[MEVEvent] = [] self._blocks_processed = 0 self._start_time: Optional[float] = None # ... 159 more lines ...
Buy Now — $13 Back to Products