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.
- Key Features
- Prerequisites
- Geth & Prysm Setup
- Installation
- Configuration
- Running ON1Builder
- Monitoring & Metrics
- Component Reference
- Security Best Practices
- Troubleshooting
- Extending & Custom Strategies
- Roadmap
- License
- 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.
- 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
- 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
- Configure
- Create data directory:
mkdir -p ~/ethereum/mainnet
geth --http --http.addr 0.0.0.0 --http.api eth,net,web3 --datadir ~/ethereum/mainnet
- Create data directory:
- Sync
geth --syncmode "snap" --http --http.corsdomain "*" --http.api engine, admin, web3,txpool --datadir ~/ethereum/mainnet --ipcpath on1builder/geth.ipc
- Install
curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh | bash -s -- --auto-install
- 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
- Run Validator (optional)
prysm/validator.sh --datadir ~/ethereum/validator --beacon-rpc-provider=127.0.0.1:4000
- Clone & Enter Directory
git clone https://github.com/John0n1/ON1Builder.git cd ON1Builder
- Python Environment
python3 -m venv venv source venv/bin/activate
- Dependencies
pip install --upgrade pip pip install -r requirements.txt
-
Copy Template
cp template.env .env
-
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
- RPC endpoints (
-
Verify JSON Resources
utils/token_addresses.json
utils/token_symbols.json
abi/*.json
- 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
- 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
- GET
- Console Logs: colored, leveled via
logger_on1.py
- Memory Watchdog: tracemalloc diffs every
MEMORY_CHECK_INTERVAL
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 |
- 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
- Connection errors
- Check RPC URLs, firewall rules, peer sync status
- Nonce mismatches
- Inspect logs from NonceCore; manually reset with
--reset-nonce
flag
- Inspect logs from NonceCore; manually reset with
- Strategy starvation
- Tune
exploration_rate
, weight decay, threshold values
- Tune
- Model training failures
- Ensure
training_data.csv
has ≥MIN_TRAINING_SAMPLES
; check CSV format
- Ensure
- Add new methods in
transaction_core.py
following existing signatures - Register them in
StrategyNet._strategy_registry
- Tune hyperparameters in
StrategyConfiguration
- Rebuild & redeploy
- 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
This project is released under the MIT License.
See LICENSE for full text.