8000 GitHub - techxbase/ON1Builder: Automated MEV "Multi-Strategy-Profit-Maximization" Bot Using Flash Loans through Aave V3!
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

techxbase/ON1Builder

 
 

Repository files navigation

ON1Builder

ON1Builder Logo

Built with Python 3.12 License: MIT

Last Commit

ON1Builder is an advanced Ethereum MEV (Maximal Extractable Value) orchestrator. It continuously monitors the mempool, evaluates pending transactions, and automatically executes profitable strategies including flashloan arbitrage, front-running, back-running, and sandwich attacks. Built with modularity, resilience, and performance in mind.


Table of Contents

  1. Key Features
  2. Prerequisites
  3. Geth & Prysm Setup
  4. Installation
  5. Configuration
  6. Running ON1Builder
  7. Monitoring & Metrics
  8. Component Reference
  9. Security Best Practices
  10. Troubleshooting
  11. Extending & Custom Strategies
  12. Roadmap
  13. License

Key Features

  • Mempool Monitoring
    • Filter- or poll-based detection of pending transactions
    • Priority queuing based on gas price and custom heuristics
  • MEV Strategy Suite
    • Flashloan Arbitrage via Aave v3
    • Front-Running: basic, aggressive, predictive, volatility-based
    • Back-Running: price-dip, flashloan-enabled, high-volume
    • Sandwich Attacks: atomic sandwich orchestration
  • Reinforcement Learning
    • Softmax-based selection with exploration/exploitation
    • Continuous Q-learning weight updates from live execution metrics
  • Robust Nonce Management
    • Caching with TTL, lock-protected refresh, pending-tx tracking
    • Automatic recovery from out-of-sync nonces
  • Dynamic SafetyNet
    • Real-time gas/slippage tuning, profit verification, network congestion assessment
  • MarketMonitor ML Pipeline
    • Historical price ingestion, EMA features, linear regression model for price prediction
  • High-Availability Core
    • Async TaskGroup orchestration, memory leak detection, component health checks

  • MainCore bootstraps config, providers, components, and supervises tasks.
  • Components communicate via typed async queues and share configuration objects.
  • Graceful shutdown on SIGINT/SIGTERM; emergency exit support.

Prerequisites

  • OS: Linux (Ubuntu 20.04+) or macOS
  • Python: 3.10+ with venv support
  • Ethereum Clients: Geth (for execution) & Prysm (for consensus if running your own beacon chain)
  • API Keys: Etherscan, Infura, CoinGecko, CoinMarketCap, CryptoCompare

Geth & Prysm Setup

Geth (Execution Client)

  1. Install
    sudo apt-get update && sudo apt-get install -y software-properties-common
    sudo add-apt-repository -y ppa:ethereum/ethereum
    sudo apt-get update && sudo apt-get install -y geth
  2. Configure
    • Create data directory: mkdir -p ~/ethereum/mainnet
    • geth --http --http.addr 0.0.0.0 --http.api eth,net,web3 --datadir ~/ethereum/mainnet
  3. Sync
    geth --syncmode "snap" --http --http.corsdomain "*" --http.api engine, admin, web3,txpool --datadir ~/ethereum/mainnet --ipcpath on1builder/geth.ipc

Prysm (Consensus Client)

  1. Install
    curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh | bash -s -- --auto-install
  2. Run Beacon Node
    prysm/beacon-chain.sh --datadir ~/ethereum/beacon \
      --http-web3provider=http://127.0.0.1:8545 \
      --monitoring-host=0.0.0.0 --monitoring-port=8080
  3. Run Validator (optional)
    prysm/validator.sh --datadir ~/ethereum/validator --beacon-rpc-provider=127.0.0.1:4000

Installation

  1. Clone & Enter Directory
    git clone https://github.com/John0n1/ON1Builder.git
    cd ON1Builder
  2. Python Environment
    python3 -m venv venv
    source venv/bin/activate
  3. Dependencies
    pip install --upgrade pip
    pip install -r requirements.txt

Configuration

  1. Copy Template

    cp template.env .env
  2. Edit .env

    • RPC endpoints (HTTP_ENDPOINT, WEBSOCKET_ENDPOINT, IPC_ENDPOINT)
    • Wallet (WALLET_ADDRESS, WALLET_KEY)
    • API keys (ETHERSCAN_API_KEY, INFURA_API_KEY, etc.)
    • Paths to ABIs and JSON utils
  3. Verify JSON Resources

    • utils/token_addresses.json
    • utils/token_symbols.json
    • abi/*.json

Running ON1Builder

  • Start
    python3 main.py
  • Stop
    • Ctrl+C or kill the process
  • Flask UI & Metrics (optional)
    python3 app.py
    # Visit: http://localhost:5000
    • /metrics JSON endpoint
    • WebSocket logs on UI

Monitoring & Metrics

  • Built-in HTTP server via FlaskUI
    • GET /status – bot & component health
    • GET /metrics – real-time performance:
      • transaction success rate
      • avg execution time
      • profitability
      • gas usage & slippage
      • mempool congestion
  • Console Logs: colored, leveled via logger_on1.py
  • Memory Watchdog: tracemalloc diffs every MEMORY_CHECK_INTERVAL

Component Reference

Component Responsibility
Configuration Load env vars, resolve paths, validate keys & addresses
APIConfig Multi-API price/volume fetch with rate-limiting & caching
SafetyNet Profit/gas/slippage checks, network congestion monitoring
MarketMonitor Historical data ingestion, ML model training & prediction
NonceCore Nonce caching, locked refresh, pending tx tracking
TxpoolMonitor Pending tx capture, priority queuing, basic profitability
StrategyNet Reinforcement learning strategy selection & weight updates
TransactionCore Build, sign, simulate, send transactions with retries
MainCore Orchestrates init, run loop, health & memory monitoring
FlaskUI Optional HTTP & WebSocket interface for logs & metrics

Security Best Practices

  • Never commit .env or private keys to VCS
  • Use secure key management (vault, HSM) in production
  • Run as non-root user with minimal permissions
  • Monitor gas price spikes and adjust MAX_GAS_PRICE_GWEI
  • Rate-limit flashloan usage to avoid attacking yourself
  • Audit smart contracts and ABI versions carefully

Troubleshooting

  • Connection errors
    • Check RPC URLs, firewall rules, peer sync status
  • Nonce mismatches
    • Inspect logs from NonceCore; manually reset with --reset-nonce flag
  • Strategy starvation
    • Tune exploration_rate, weight decay, threshold values
  • Model training failures
    • Ensure training_data.csv has ≥ MIN_TRAINING_SAMPLES; check CSV format

Extending & Custom Strategies

  1. Add new methods in transaction_core.py following existing signatures
  2. Register them in StrategyNet._strategy_registry
  3. Tune hyperparameters in StrategyConfiguration
  4. Rebuild & redeploy

Roadmap

  • Cross-chain MEV: support BSC, Polygon, Arbitrum
  • Advanced ML: switch to neural-network price predictors
  • Dashboard Integration: Grafana + Prometheus metrics
  • Automated Liquidity Provision & limit-order MEV

License

This project is released under the MIT License.
See LICENSE for full text.

About

Automated MEV "Multi-Strategy-Profit-Maximization" Bot Using Flash Loans through Aave V3!

Resources

License

4446

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 88.2%
  • Solidity 6.1%
  • HTML 5.7%
0