Skip to content

Panda404NotFound/eth_backrun_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


ETH FLARB MEV Bot Banner
Typing SVG
MEV Badge Flashloan Badge Stack Badge

ETH FLARB .OPEN

Ethereum Back-run Flashloan Arbitrage Bot
Zero Capital. Pure Math. Maximum Efficiency.

What It Is

Ethereum back-run flashloan arbitrage bot built for MEV extraction with zero starting capital. Unlike sandwich bots, it needs no upfront deposit: profit comes from correctly constructing chains and precisely computing the real price curve. Niche and less competitive — the bot earns only on unique pending transactions that appear during elevated volatility.

System Architecture

graph TD
    subgraph Data Ingestion
    A[Mempool Stream] -->|Kafka/WS| B(Pending Coordinator)
    W[WebSocket Services] -->|Quotes/Gas| B
    end

    subgraph Core Engine
    B -->|Filter & Norm| C{Graph Engine}
    C -->|DFS & Chain Build| D[Split Router]
    D -->|V2/V3/V4 Unification| D
    end

    subgraph Execution
    D -->|Optimize Profit| E[Profit Engine]
    E -->|Validation| F[Flashbots Signer]
    F -->|Bundle Send| G((Ethereum Network))
    end

    style A fill:#0D1117,stroke:#00f0ff,stroke-width:2px,color:#fff
    style B fill:#161b22,stroke:#00f0ff,stroke-width:1px,color:#fff
    style C fill:#161b22,stroke:#7000ff,stroke-width:2px,color:#fff
    style D fill:#0D1117,stroke:#7000ff,stroke-width:2px,color:#fff
    style E fill:#161b22,stroke:#00ff00,stroke-width:1px,color:#fff
    style G fill:#0D1117,stroke:#00ff00,stroke-width:2px,color:#fff
    linkStyle default stroke:#00f0ff,stroke-width:2px
Loading

💎 Key Differentiators

🔮 Split Router

Mathematically merges v2/v3/v4 curves into a single economic equivalent, searching for the true profit across chains.

🕷️ Graph Engine

DFS with limits on chain length/count, prioritizes starting tokens for extremely fast graph processing.

📡 Pending Pipeline

Bitquery Kafka or WebSocket/Bloxroute. Feeds pending transactions into the graph and optimization before block inclusion.

💸 Minimal Capital

Flash sources + split_router = execution without deposits. Protection against fund loss if a transaction is dropped.

⚔️ TECH ARSENAL

CORE WEAPONS

INFRASTRUCTURE

📂 Architecture (where to look)

Click to expand code navigation
Component Path Description
Entry Point src/main.rs Dependency wiring, worker startup, event channels.
Graph src/graph/* Build logical nodes/chains, DFS limits.
Split Router src/engine/split_router/* Normalize v2/v3/v4, optimize continuous plan.
Profit Engine src/engine/profit_engine.rs Profit calculation, execution prep.
Pending src/pending_websocket/* Bitquery Kafka, event normalization, overlay caches.
WebSockets src/*_websocket/* Quotes, events, gas, tick snapshots.
Flashbots src/flashbots/* Go FFI signer for transaction signing.
Contracts smart_contract/* EthFlarb.sol, Bribe.sol and deploy scripts.

Hardware requirements

  • ~72k chains and ≤600 starting pools: 8 cores / 32 GB RAM.
  • More chains or >600 pools: 16 cores / 64 GB RAM (otherwise memory bound).

🛠️ Setup and Run

Dependencies: Rust (Stable)GoNode.js (for contracts)

1️⃣ Build Go Signer (must be first)

Library required to sign Flashbots transactions. Without it cargo will fail.

cd src/flashbots/flashbots_go_signer
go build -buildmode=c-shared -o libflashbots_signer.so
# Export the variable for runtime
export LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH

2️⃣ Rust: Build

# In project root
cargo build --release 
# or 'cargo run' for debug mode

3️⃣ Contracts (if needed)

cd smart_contract
npm install && npm run compile
# Deploy
npm run deploy:mainnet 
# or npx hardhat run scripts/deploy.ts --network mainnet

⚙️ Environment Variables

Copy .env.example to .env. Key parameters:

  • RPC/WS: QUICK_NODE_RPC_API, QUICK_NODE_WS_API_*.
  • Mempool: BITQUERY_KAFKA_USERNAME/PASSWORD, MEMPOOL_PROVIDER (bitquery|bloxrouter).
  • Flashbots: FLASHBOTS_RPC_API, private key and contract address.
  • Graph: GRAPH_API_KEY.
  • Logging: LOG_STATUS.

🚀 Runtime Lifecycle

  1. Start: Load config and RPC/WS endpoints.
  2. Snapshot: Fetch head block, prep tick snapshot.
  3. Initialize: Fetch pools, validate ticks, fix initial state.
  4. Graph: Build (logical nodes → edges → chains), cache.
  5. Services: Start WebSocket (quotes, events, gas).
  6. Pending: Start pending coordinator, ingest transactions, overlay snapshots.
  7. Math Loop: Profit engines + split_router (compute equivalent v2/v3/v4 curves, optimize).
  8. Execution: Flashbots signing (Go FFI) and send.

Tip

Tuning Constants:

  • Starting addresses: get_all_addresses() → ETH/WETH.
  • Chain length: MAX_CHAIN_LENGTH = 6, MIN_CHAIN_LENGTH = 3.
  • Filters: MIN_PROFIT_FOR_CHAIN = 14.
  • Gas: Default fixed 1 gwei. In pending pipeline gas_limit = 7_700_000.

Warning

Risks:

  • Low competition → revenue only on unique pending transactions during volatility.
  • Proper RPC/WS subscriptions and Kafka are required, otherwise the pipeline will not start.
  • deploy.ts script can fail on parsing, but deployment still completes.

💸 Operating Costs

  • RPC + WS subscription (recommended Alchemy).
  • Bitquery Kafka access.
  • Keep ≥ $50 on the wallet to cover fees and tests.

🤝 Support and Contact

Telegram Donate

Developer: @brahman_mev