Skip to content

L2-MEV Shield: full-stack Solana MEV protection platform - #1

Merged
mesayanroy merged 3 commits into
mainfrom
copilot/create-l2-mev-bot
Mar 10, 2026
Merged

L2-MEV Shield: full-stack Solana MEV protection platform#1
mesayanroy merged 3 commits into
mainfrom
copilot/create-l2-mev-bot

Conversation

Copilot AI commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Bootstraps the repo from empty into a production-ready MEV protection platform — detects and blocks sandwich attacks, frontrunning, and backrunning on Solana DEXes (Jupiter, Raydium, Orca) rather than performing them.

Architecture

CLI (l2mev) ──► Backend API ──► MEV Detector + Transaction Shield
                                       │                │
                                 Solana RPC       Jito Block Engine
                                       │
                               On-chain mev-shield
                               Anchor Program (slippage guard)

Components

backend/ — Express + TypeScript API

  • MevDetector — rolling-window sandwich pattern detection ([buy→victim→sell] same signer, same pool, within 3s); scores incoming swaps 0–100 for MEV risk
  • TransactionShield — routes trades through Jupiter v6 + Jito bundles when riskScore ≥ 40; falls back to direct with tight slippage bounds
  • PoolMonitor — polls Jupiter/Raydium/Orca every 5s; emits MevAlert on >1% price moves; pushes to WebSocket subscribers at /ws/monitor
  • CORS restricted to configured origins, JWT auth on protected routes, Helmet + rate-limit (100 req/min)

cli/npm install -g l2mev

  • l2mev init — interactive wizard; stores config in ~/.config/l2mev/config.json; keys never leave the machine
  • l2mev shield --dex jupiter --pair SOL/USDC --amount 10 — reads keypair from disk, scores risk, builds Jito-protected tx
  • l2mev monitor — WebSocket alert feed with severity threshold filtering
  • l2mev analyze --tx <sig> — post-hoc forensic check (was this tx sandwiched?)

programs/mev-shield/ — Anchor/Rust

Atomic price-commitment guard: commit_price records expected output in a PDA; validate_execution reverts the entire transaction (including DEX CPI) if actual output deviates beyond slippage_bps. Sandwich succeeds at frontrunning but the victim tx still reverts.

// min_out = expected_out × (10_000 − slippage_bps) / 10_000
require!(actual_out_amount >= min_out, MevShieldError::SlippageExceeded);

frontend/ — Next.js 14 + Tailwind

Landing page, docs site (CLI reference, API reference), live dashboard polling /api/analytics/summary + /api/monitor/alerts every 10s.

devops/

  • Multi-stage Dockerfiles for backend + frontend
  • nginx: TLS, HSTS, X-Frame-Options, rate zones, HTTP→HTTPS redirect
  • docker-compose.yml: backend + frontend + nginx + Redis

.github/workflows/

  • ci.yml — lint/typecheck/test/docker-build on every PR
  • deploy.yml — semver-tagged releases publish CLI to npm, push images, SSH-deploy via docker compose pull && up
Original prompt

Pls built a Solana chain L2 MEV bot to initialize sandwich attacks and do frontrunning and backrunning and extract crypto ot pump crypto through the trades in different exchanges dex like jupiter , raydium , binance and other popular trade.
remember the usecase used be user comes to our website go throughout the process and the docs site where all the info about the website how to use the cli how to develop over it as it is a infrastructure and then copy the CLI and paste on their system terminal then it will set or ask few operations based on the operations or commands it like set the tasks and attack the pools .
make this very professional and clean with proper code directory frontend , backend ,web 3 customized programs contracts ,devops , security checks and CI/CD pipelines with CORS and deploy ready .


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add L2 MEV bot for sandwich attacks and frontrunning Decline request to build MEV sandwich attack bot Mar 10, 2026
Copilot AI and others added 2 commits March 10, 2026 17:15
Co-authored-by: mesayanroy <169074736+mesayanroy@users.noreply.github.com>
…, docs typo, dead code, keypair resolution, Rust comments

Co-authored-by: mesayanroy <169074736+mesayanroy@users.noreply.github.com>
Copilot AI changed the title Decline request to build MEV sandwich attack bot L2-MEV Shield: full-stack Solana MEV protection platform Mar 10, 2026
@mesayanroy
mesayanroy marked this pull request as ready for review March 10, 2026 17:30
@mesayanroy
mesayanroy merged commit b4ae93a into main Mar 10, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants