ON1Builder is a cross-chain arbitrage bot for Ethereum and EVM-compatible networks, designed to automate profitable trading opportunities.
Project description
ON1Builder
pip install -e .
Async, multi-chain MEV/arbitrage engine with safety rails, flashloan support, and live telemetry. Highly customizable via config.
Overview
ON1Builder is a modular MEV searcher framework designed for building and deploying arbitrage, front-running, and back-running strategies across multiple EVM-compatible blockchains. It emphasizes safety, configurability, and observability, making it suitable for both development and production environments.
Key Features
- Multi-Chain Support: Easily connect to any EVM-compatible chain with configurable RPC and WebSocket endpoints (prefers Nethermind, Geth nodes).
- MEV Strategies: Built-in support for common MEV strategies including arbitrage, front-running, back-running, and flashloan-based trades.
- Safety Mechanisms: Configurable slippage caps, gas price ceilings, and balance tiers to minimize risk.
- Flashloan Integration: Seamless integration with popular flashloan providers for capital-efficient trading.
- Simulation Backends: Supports multiple simulation backends (eth_call, Anvil, Tenderly) for pre-execution validation.
- Telemetry & Monitoring: Heartbeats, performance summaries, structured logging, and notification channels (Slack, Telegram, Discord, Email) for real-time monitoring.
- Extensible Architecture: Modular design allows for easy addition of new strategies, chains, and features.
Quick Snapshot
| Track | Summary |
|---|---|
| Core Focus | MEV searcher: arbitrage, back/front-run, flashloans |
| Chains | Ethereum ready (public RPC OK); multi-chain capable |
| Safety | Slippage caps, gas ceilings, balance tiers, emergency stop |
| Telemetry | Heartbeats, perf summaries, structured logs, notifications |
Feature Highlights
Quick Start
1. Clone & env
git clone https://github.com/John0n1/ON1Builder.git
cd ON1Builder
- Windows
python -m venv .venv
. .venv/Scripts/activate
pip install -r requirements.txt
pip install -e .
- Linux/MacOS
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
2. Configure (minimum)
copy .env.example .env
# edit:
# WALLET_KEY, WALLET_ADDRESS
# RPC_URL_1="https://ethereum-rpc.publicnode.com"
# WEBSOCKET_URL_1="wss://ethereum-rpc.publicnode.com" # public WS is auto-skipped for txpool
# ETHERSCAN_API_KEY=...
3. Run
python -m on1builder status check
python -m on1builder run start
With public RPC/WS, txpool scanning is disabled on purpose (unreliable pending tx support). Provide a private WS endpoint if you want pending tx monitoring.
Architecture
Module Dependency Graph
cli/ → config/, core/
core/ → config/, engines/, integrations/, monitoring/, persistence/, utils/
engines/ → config/, integrations/, utils/
integrations/ → config/, utils/
monitoring/ → config/, integrations/, utils/
persistence/ → config/, utils/
utils/ → (standalone, no internal deps except config.loaders)
Key Design Patterns
| Pattern | Where | Purpose |
|---|---|---|
| Singleton | ExternalAPIManager, NonceManager, DatabaseInterface, NotificationService |
Shared state, connection pooling |
| Circuit Breaker | error_recovery.py |
Protect against cascading failures |
| Async Context Manager | DatabaseInterface, NotificationService |
Guaranteed resource cleanup |
| Strategy | StrategyExecutor |
Pluggable MEV strategies |
| Observer | TxPoolScanner → StrategyExecutor |
Decouple mempool monitoring from execution |
Configuration Cheat Sheet
| Setting | Description |
|---|---|
WALLET_KEY, WALLET_ADDRESS |
Required for signing/monitoring |
RPC_URL_1 |
HTTP RPC endpoint (public OK) |
WEBSOCKET_URL_1 |
WS endpoint; use private if you want txpool scanning |
ETHERSCAN_API_KEY |
Optional but recommended for ABI/tx metadata |
MIN_PROFIT_ETH |
Profit floor per trade (ETH) |
MAX_GAS_PRICE_GWEI |
Hard gas ceiling |
SUBMISSION_MODE |
public, private, or bundle (relay submission) |
PRIVATE_RPC_URL |
Private RPC endpoint (Flashbots Protect, etc.) |
BUNDLE_RELAY_URL |
Bundle relay endpoint (MEV-Boost/Flashbots) |
SIMULATION_BACKEND |
eth_call, anvil, or tenderly |
SIMULATION_CONCURRENCY |
Max concurrent simulations |
NOTIFICATION_CHANNELS |
slack,telegram,discord,email (blank = off) |
ORACLE_FEEDS |
JSON map of chain_id → symbol → Chainlink feed address |
ORACLE_STALE_SECONDS |
Max age (seconds) before oracle price is treated as stale |
MARKET_PRICE_PERSIST_INTERVAL |
Persist price snapshots to DB every N seconds (0 disables) |
STARTUP_TEST_TRANSACTION |
Run a diagnostic self-tx on startup (requires ALLOW_INSUFFICIENT_FUNDS_TESTS) |
ALLOW_INSUFFICIENT_FUNDS_TESTS |
Bypass local balance checks for test sends (debug only) |
Full list lives in .env.example.
PublicNode endpoints can be used for EVM chains listed in .env.example. Non-EVM endpoints
(Sui, Aptos, Osmosis, Avalanche P/X, Polygon Heimdall) are not supported by ON1Builder.
Running & Monitoring
# Validate config
python -m on1builder status check
# Start bot
python -m on1builder run start
# View logs
tail -f logs/on1builder.log # *nix
Get-Content logs\\on1builder.log -Wait # Windows
Heartbeats report balance tier, pending tx count (0 if txpool scanner is disabled), and memory usage.
Testing
# Run all tests (fast, no external deps)
python -m pytest tests/ -q
# Run with verbose output
python -m pytest tests/ -v --tb=short
# Run with coverage report
python -m pytest tests/ --cov=on1builder --cov-report=html
# Run a specific test file
python -m pytest tests/test_edge_cases.py -v
# Run live API tests (requires network access)
RUN_LIVE_API_TESTS=1 python -m pytest tests/test_external_api_integration.py
Test Categories
| Category | Files | Focus |
|---|---|---|
| Smoke | test_smoke.py |
Package imports, version consistency, resource files |
| Core Logic | test_balance_manager.py, test_nonce_manager_logic.py, test_transaction_manager_logic.py |
Balance tiers, nonce management, TX building |
| Engines | test_safety_and_gas_guardrails.py, test_logic_behaviors.py |
Safety guards, strategy execution |
| Monitoring | test_txpool_end_to_end.py, test_market_data_feed_logic.py, test_websocket_*.py |
Mempool scanning, market data, WS resilience |
| API | test_external_api_logic.py, test_external_api_integration.py |
Price feeds, oracle integration |
| Config | test_config_manager.py, test_validation.py, test_cli_commands.py |
Settings loading, validation, CLI |
| Utils | test_utils.py, test_error_handling.py, test_path_helpers.py, test_logging_config.py |
Utilities, error handling, DI container |
| Edge Cases | test_edge_cases.py |
Boundary values, error paths, constants sanity |
Development
# Lint and format
black --target-version py312 src tests
python -m compileall -q src tests
# Run full test suite
python -m pytest tests/ -q
Pre-commit hooks are configured in .pre-commit-config.yaml.
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
parsimonious version conflict |
eth-abi requires <0.11.0 |
Use parsimonious>=0.10.0,<0.11.0 (already pinned) |
| txpool scanning silent | Public WS endpoint | Use a private node (Alchemy, Infura, self-hosted) |
ConfigurationError on start |
Missing .env values |
Run python -m on1builder status check to diagnose |
| Gas estimation fails | Network congestion / bad RPC | Falls back to default_gas_limit; check RPC health |
| Notifications not sending | Channels not configured | Set NOTIFICATION_CHANNELS in .env |
| Tests fail with singleton state | Stale singleton between tests | Each test file resets singletons via fixtures |
Optional Utilities
ON1Builder ships a few utilities that are not required for core execution but can be integrated in advanced deployments:
src/on1builder/utils/error_recovery.py: Retry/circuit-breaker helpers and a recovery manager. The TransactionManager now reports failures to this manager for tracking and optional recovery strategies, but most strategies are placeholders by default.src/on1builder/utils/container.py: A lightweight DI container for advanced lifecycle management. The core runtime does not use it yet; opt in if you want centralized wiring.src/on1builder/utils/memory_optimizer.py: Memory monitoring and GC management for long-running deployments. Tracks process memory and triggers cleanup when thresholds are exceeded.
Flashloan setup
You need to deploy your own flashloan provider contract or use an existing one. Make sure to configure the flashloan provider address in your strategy settings.
To learn about deploying a flashloan contract, refer to the documentation of the flashloan provider you intend to use (e.g., Aave, dYdX) we recommend Aave
Here's a basic outline of the steps involved:
- Choose a Flashloan Provider: Decide which flashloan provider you want to use (e.g., Aave, dYdX).
- We recommend using Remix IDE for deploying smart contracts. Open Remix IDE in your web browser.
- Create a New File: In Remix, create a new Solidity file (e.g., FlashloanProvider.sol) and write or paste the flashloan contract code.
- Compile the Contract: Use the Solidity compiler in Remix to compile your flashloan contract.
- Deploy the Contract:
- Select the appropriate environment (e.g., Injected Web3 for MetaMask).
- Choose the contract you want to deploy.
- Click the "Deploy" button and confirm the transaction in your wallet.
- Note the Contract Address: After deployment, copy the contract address. You'll need to configure this address in .env
API Keys
The bot is able to function without API keys, but some features are limited. It's recommended to set up the following free API keys for best experience:
- Etherscan API Key: For fetching contract ABIs and transaction metadata. Sign up at Etherscan.
- Tenderly Account: For advanced simulation backend. Sign up at Tenderly.
- CoinGecko API Key: Optional, for additional price data. Sign up at CoinGecko.
Safety Notes
- Public WS endpoints are auto-skipped for txpool scanning to avoid noisy failures.
- Price lookups are limited to a small, well-known token set; repeated failures are silenced after blacklisting.
- Emergency balance tiers keep the bot idle when funds are low.
- Gas estimation includes a 20% buffer with a hard cap at 30M (Ethereum block gas limit).
License
MIT - see LICENSE.
Disclaimer
Use at your own risk. No warranty. MEV strategies can be volatile and may incur losses. Keep keys safe; never use production keys on public demos.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_on1builder-2.3.0.tar.gz.
File metadata
- Download URL: py_on1builder-2.3.0.tar.gz
- Upload date:
- Size: 233.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a39b22c2e01e8d3385a58e14ec5bcc669a30c2fdcf1832d90cd5ba3d5eedbc1
|
|
| MD5 |
2583ad97504fb96c909b89a86b4e9417
|
|
| BLAKE2b-256 |
58e73cb47007d534c7f0f7ed7efc1b12b186b16460801eee8f942e84e2e39ebf
|
Provenance
The following attestation bundles were made for py_on1builder-2.3.0.tar.gz:
Publisher:
python-publish.yml on John0n1/ON1Builder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_on1builder-2.3.0.tar.gz -
Subject digest:
9a39b22c2e01e8d3385a58e14ec5bcc669a30c2fdcf1832d90cd5ba3d5eedbc1 - Sigstore transparency entry: 1281867321
- Sigstore integration time:
-
Permalink:
John0n1/ON1Builder@cbb9a8f385b094a039e25a09010046d68aa5c497 -
Branch / Tag:
refs/tags/2.4.1-1 - Owner: https://github.com/John0n1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@cbb9a8f385b094a039e25a09010046d68aa5c497 -
Trigger Event:
release
-
Statement type:
File details
Details for the file py_on1builder-2.3.0-py3-none-any.whl.
File metadata
- Download URL: py_on1builder-2.3.0-py3-none-any.whl
- Upload date:
- Size: 211.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c96edea5ddb1cdee94a733c5638e51cd3cd9a0a571a0322d0da32209f57fe83
|
|
| MD5 |
f9edad74bcb563eb54a1515d2e555daa
|
|
| BLAKE2b-256 |
9f69f47931b549defec8ab56bf9d970193fe4428e8c40516eaa5176585538e86
|
Provenance
The following attestation bundles were made for py_on1builder-2.3.0-py3-none-any.whl:
Publisher:
python-publish.yml on John0n1/ON1Builder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_on1builder-2.3.0-py3-none-any.whl -
Subject digest:
2c96edea5ddb1cdee94a733c5638e51cd3cd9a0a571a0322d0da32209f57fe83 - Sigstore transparency entry: 1281867375
- Sigstore integration time:
-
Permalink:
John0n1/ON1Builder@cbb9a8f385b094a039e25a09010046d68aa5c497 -
Branch / Tag:
refs/tags/2.4.1-1 - Owner: https://github.com/John0n1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@cbb9a8f385b094a039e25a09010046d68aa5c497 -
Trigger Event:
release
-
Statement type: