This app runs inside the BotSurf browser. Don't have it yet? Get the app or extension now!

DEX Sandwich Attack Detector

Trading · All
0 installs · Verified BotGentz app
Launch App
Opens in BotSurf — try it free, no account needed.
CategoryTrading
PlatformAll
Pricing Free
Installs0
Download BotSurf to use — free
No account needed for free apps. Once BotSurf is open, find this app in Apps from the + menu.

About this app

WHAT IT DOES

DEX Sandwich Attack Detector is a critical protection tool that monitors the mempool for potential sandwich attacks targeting your DEX swaps. When you're on a supported DEX (Uniswap, SushiSwap, 1inch, Curve, or Balancer) with a configured swap, the tool continuously monitors the mempool via eth_getBlockByNumber with pending transactions (or WebSocket connection) to detect suspicious activity on the same token pair. It identifies large transactions before and after your transaction that could manipulate the price—the classic sandwich attack pattern. The panel displays the current risk level (Low/Medium/High), pending transactions in the mempool for your token pair, estimated price impact, and a gas price recommendation to avoid front-running. The "Protect Transaction" button suggests increasing your gas price or using a private relay like Flashbots to avoid being sandwich attacked. All attack history is tracked for monitoring and analysis.

WHERE IT RUNS

This overlay operates on major DEX platforms including Uniswap (app.uniswap.org, uniswap.org), SushiSwap (sushi.com), 1inch (1inch.io), Curve (curve.fi), and Balancer (balancer.fi). It works in any browser that supports the BotGentz extension framework and has an EVM-compatible wallet extension installed. The panel activates automatically when you're on a supported DEX page with a trading pair selected.

HOW TO USE

Install the extension and connect your wallet. Navigate to any supported DEX and configure a swap—select your token pair and enter a trade amount. The tool automatically detects the token pair and trade amount from the page, then begins monitoring the mempool for sandwich attack activity. The panel displays the current risk level with color coding (Green for Low, Yellow for Medium, Red for High) and a summary of mempool activity. Configure your settings: set the detection sensitivity (Low/Medium/High) to control alert frequency, set a gas price buffer percentage (default 10%) for recommendations, set the mempool monitoring interval (default 3 seconds), and choose a preferred private relay provider (Flashbots or Private Relay). The "Protect Transaction" button provides a gas price increase recommendation and private relay suggestion when high risk is detected. Use the "Refresh" button to manually update data, "Save Settings" to apply changes, and "Copy Report" to export a summary. The tool tracks all attack detections for performance review.

MECHANISM: REAL-TIME MEMPOOL MONITORING WITH SANDWICH ATTACK PATTERN RECOGNITION

The extension implements a continuous mempool monitoring system using eth_getBlockByNumber with pending transactions (or a WebSocket connection to a public node). The tool filters pending transactions for the current token pair by analyzing transaction calldata for the token addresses (via ethers.js loaded at runtime) and detecting large swaps on the same pair. The sandwich attack detection algorithm identifies potential front-run transactions (large buy orders before the user's transaction) and back-run transactions (large sell orders after the user's transaction) by analyzing transaction values, gas prices, and timing. The risk assessment engine categorizes the threat level based on the number of large transactions, their size relative to the user's trade, and the gas price spread. The sensitivity setting adjusts the thresholds for these detections. The gas price recommendation calculates a safe gas price using the current base fee plus a configurable buffer percentage, and recommends private relay usage for high-risk scenarios. The tool also estimates the potential price impact of the sandwich attack using the constant product formula, showing the user what they stand to lose. All detection data is stored locally using GM_setValue, tracking the risk level, token pair, and timestamp for each event.

THE PANEL

The overlay panel is fully draggable via its title bar and remembers its position per-site using GM_setValue. It snaps to the nearest edge when dragged within 40px of any screen boundary. The panel includes clear sections for sandwich attack detector (DEX name, chain, wallet address, gas price, token pair, trade amount), risk assessment (risk level with color coding, risk message), mempool analysis (number of pending transactions, breakdown by size, sample transactions), gas recommendation (current gas, recommended gas with buffer, protection tip), attack history (recent detections with risk levels, token pairs, and timestamps), settings (sensitivity selector, gas buffer input, monitoring interval input, relay provider selector, notification toggle), and action buttons (Refresh, Protect Transaction, Save Settings, Copy Report, Clear History). The risk level is prominently displayed with color coding—green for Low, yellow for Medium, red for High. Pressing Escape temporarily dismisses the panel until you navigate to a new DEX page or manually reactivate.

PLEASE NOTE

This extension requires the free BotGentz framework extension to be installed and active. You must also have a real EVM-compatible wallet extension (such as MetaMask, WalletConnect, Coinbase Wallet, or Rabby) already installed in your browser—the overlay uses your wallet's RPC provider for eth_call queries and mempool monitoring. This tool is read-only—it does not send transactions; it only provides warnings and suggestions. The tool cannot detect sandwich attacks that are executed via private mempool or MEV relays not accessible to the tool; depends on node RPC access to pending transactions which may be rate-limited or unavailable; cannot guarantee that a sandwich attack will be detected before execution; does not support non-EVM chains where mempool mechanics differ; cannot detect attacks that are executed in the same block as the user's transaction; cannot predict if an attack will occur after transaction submission; depends on accurate gas price estimation which may vary; and cannot protect against attacks that use cross-chain or multi-block MEV strategies. No private keys, wallet balances, browsing history, or position data are ever collected, transmitted, or stored outside your local browser—all data is stored locally using GM_setValue. This tool provides risk assessment only—it cannot guarantee protection against sandwich attacks. Always verify transaction details before confirming and consider using private relays for high-value trades.

Similar Apps

Log in to BotGentz

Suggest an App

Tell us what you'd find useful — if we build it, we'll email you the moment it's ready.