Skip to content

feat: implement sandwich attack detection and private mempool routing #112

@mfw78

Description

@mfw78

What problem does this solve?

Users can lose significant value to MEV extraction through sandwich attacks when trading on DEXs. Transactions susceptible to sandwiching should be routed through private mempools to prevent frontrunning.

Describe the solution

Implement transaction analysis to classify transactions as sandwichable or not, and smart routing to private mempools (e.g., Flashbots Protect, MEV Blocker) for vulnerable transactions. This protects users from MEV extraction without requiring manual configuration.

Alternatives considered

  • Always use private mempools (adds latency and centralization for all transactions)
  • Require users to manually choose private mempool (poor UX, most users won't understand)
  • Use slippage protection only (doesn't prevent sandwich, just makes it fail)

Implementation notes

  • Analyze transaction type, slippage tolerance, liquidity depth to determine sandwich risk
  • Integrate with Flashbots Protect RPC and other private mempool providers
  • Add configuration for user preference (auto/always/never use private mempools)
  • Performance: classification should be <50ms
  • Fallback to public mempool if private mempool submission fails
  • Show user when transaction is routed through private mempool

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/weeksWeek+ of work. Better be worth it.featureNew capability that doesn't exist yet.p2-annoyingNot broken, but annoying enough to matter.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions