saving in place

This commit is contained in:
Krypto Kajun
2025-10-04 09:31:02 -05:00
parent 76c1b5cee1
commit f358f49aa9
295 changed files with 72071 additions and 17209 deletions

View File

@@ -11,45 +11,53 @@ arbitrum:
# Aggressive rate limiting for high-frequency L2 message processing
rate_limit:
# High throughput for L2 messages (Arbitrum can handle more)
requests_per_second: 50
requests_per_second: 200
# Higher concurrency for parallel processing
max_concurrent: 20
# Large burst for L2 message spikes
burst: 100
# Fallback endpoints for redundancy
burst: 1000
# Fallback RPC endpoints for redundancy
fallback_endpoints:
- url: "${ARBITRUM_INFURA_ENDPOINT}"
- url: "${ARBITRUM_FALLBACK_ENDPOINTS}"
rate_limit:
requests_per_second: 30
requests_per_second: 100
max_concurrent: 15
burst: 60
- url: "wss://arb1.arbitrum.io/ws"
burst: 500
- url: "https://arb1.arbitrum.io/rpc"
rate_limit:
requests_per_second: 20
requests_per_second: 50
max_concurrent: 10
burst: 40
- url: "${ARBITRUM_BLOCKPI_ENDPOINT}"
burst: 250
- url: "https://arbitrum.llamarpc.com"
rate_limit:
requests_per_second: 25
requests_per_second: 75
max_concurrent: 12
burst: 50
burst: 375
- url: "https://arbitrum-one.publicnode.com"
rate_limit:
requests_per_second: 60
max_concurrent: 10
burst: 300
- url: "https://arbitrum-one.public.blastapi.io"
rate_limit:
requests_per_second: 80
max_concurrent: 15
burst: 400
# Bot configuration optimized for L2 message processing
bot:
# Enable the bot
enabled: true
# Fast polling for L2 blocks (250ms for competitive advantage)
polling_interval: 0.25
# Ultra-fast polling for L2 blocks (100ms for maximum competitive advantage)
polling_interval: 0.1
# Minimum profit threshold in USD (account for L2 gas costs)
min_profit_threshold: 5.0
min_profit_threshold: 10.0
# Gas price multiplier for fast L2 execution
gas_price_multiplier: 1.5
gas_price_multiplier: 2.0
# High worker count for L2 message volume
max_workers: 25
# Large buffer for high-frequency L2 messages
channel_buffer_size: 1000
# Fast timeout for L2 operations
rpc_timeout: 15
channel_buffer_size: 2000
# Uniswap configuration optimized for Arbitrum
uniswap:
@@ -66,9 +74,9 @@ uniswap:
cache:
enabled: true
# Short expiration for real-time data
expiration: 30
expiration: 15
# Large cache for many pools
max_size: 50000
max_size: 100000
# Production logging
log:
@@ -84,9 +92,9 @@ database:
# Production database file
file: "/data/mev-bot-production.db"
# High connection pool for concurrent operations
max_open_connections: 50
max_open_connections: 100
# Large idle pool for performance
max_idle_connections: 25
max_idle_connections: 50
# Production-specific settings
production:
@@ -107,28 +115,28 @@ production:
# Enable L2 message priority processing
prioritize_l2_messages: true
# Batch processing settings
batch_size: 100
batch_timeout: "100ms"
batch_size: 200
batch_timeout: "50ms"
# Gas optimization
gas_estimation:
# Include L1 data fees in calculations
include_l1_fees: true
# Safety multiplier for gas limits
safety_multiplier: 1.2
safety_multiplier: 1.5
# Priority fee strategy
priority_fee_strategy: "aggressive"
# Security settings
security:
# Maximum position size (in ETH)
max_position_size: 10.0
max_position_size: 50.0
# Daily loss limit (in ETH)
daily_loss_limit: 2.0
daily_loss_limit: 5.0
# Circuit breaker settings
circuit_breaker:
enabled: true
error_threshold: 10
timeout: "5m"
error_threshold: 5
timeout: "2m"
# DEX configuration
dex_protocols:
@@ -144,6 +152,14 @@ production:
enabled: true
router: "0xc873fEcbd354f5A56E00E710B90EF4201db2448d"
priority: 3
balancer_v2:
enabled: true
router: "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
priority: 4
curve:
enabled: true
router: "0x445FE580eF8d70FF569aB36e80c647af338db351"
priority: 5
# Monitoring and alerting
alerts:
@@ -161,17 +177,23 @@ production:
# Alert conditions
conditions:
- name: "High Error Rate"
condition: "error_rate > 0.05"
condition: "error_rate > 0.02"
severity: "critical"
- name: "Low Profit Margin"
condition: "avg_profit < min_profit_threshold"
severity: "warning"
- name: "L2 Message Lag"
condition: "l2_message_lag > 1000ms"
condition: "l2_message_lag > 500ms"
severity: "critical"
- name: "Gas Price Spike"
condition: "gas_price > 50gwei"
condition: "gas_price > 100gwei"
severity: "warning"
- name: "Daily Loss Limit"
condition: "daily_loss > daily_loss_limit"
severity: "critical"
- name: "Position Size Limit"
condition: "position_size > max_position_size"
severity: "critical"
# Environment-specific overrides
# Set these via environment variables in production:

160
config/config.staging.yaml Normal file
View File

@@ -0,0 +1,160 @@
# MEV Bot Staging Environment Configuration
# This configuration is for testing in a production-like environment with reduced risk
# Arbitrum node configuration
arbitrum:
# RPC endpoint for Arbitrum node (using premium provider for staging)
rpc_endpoint: "${ARBITRUM_RPC_ENDPOINT}"
# WebSocket endpoint for Arbitrum node (optional)
ws_endpoint: "${ARBITRUM_WS_ENDPOINT}"
# Chain ID for Arbitrum (42161 for mainnet)
chain_id: 42161
# Rate limiting configuration for RPC endpoint (more conservative than production)
rate_limit:
# Maximum requests per second (reduced to avoid hitting limits)
requests_per_second: 50
# Maximum concurrent requests (reduced to avoid overload)
max_concurrent: 5
# Burst size for rate limiting
burst: 100
# Fallback RPC endpoints
fallback_endpoints:
- url: "https://arb1.arbitrum.io/rpc"
rate_limit:
requests_per_second: 25
max_concurrent: 3
burst: 50
- url: "https://arbitrum.llamarpc.com"
rate_limit:
requests_per_second: 30
max_concurrent: 3
burst: 60
- url: "https://arbitrum-one.publicnode.com"
rate_limit:
requests_per_second: 20
max_concurrent: 2
burst: 40
# Bot configuration
bot:
# Enable or disable the bot
enabled: true
# Polling interval in seconds (slower than production for testing)
polling_interval: 10
# Minimum profit threshold in USD (higher than production for testing)
min_profit_threshold: 50.0
# Gas price multiplier (for faster transactions)
gas_price_multiplier: 1.2
# Maximum number of concurrent workers for processing (reduced for staging)
max_workers: 3
# Buffer size for channels
channel_buffer_size: 100
# Timeout for RPC calls in seconds
rpc_timeout: 30
# Uniswap configuration
uniswap:
# Factory contract address
factory_address: "0x1F98431c8aD98523631AE4a59f267346ea31F984"
# Position manager contract address
position_manager_address: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
# Supported fee tiers
fee_tiers:
- 500 # 0.05%
- 3000 # 0.3%
- 10000 # 1%
# Cache configuration for pool data
cache:
# Enable or disable caching
enabled: true
# Cache expiration time in seconds
expiration: 300
# Maximum cache size
max_size: 5000
# Logging configuration
log:
# Log level (debug, info, warn, error)
level: "debug"
# Log format (json, text)
format: "text"
# Log file path (empty for stdout)
file: "logs/mev-bot_staging.log"
# Database configuration
database:
# Database file path
file: "data/mev-bot_staging.db"
# Maximum number of open connections
max_open_connections: 10
# Maximum number of idle connections
max_idle_connections: 5
# Ethereum configuration
ethereum:
# Private key for transaction signing (NEVER COMMIT TO VERSION CONTROL)
private_key: "${ETHEREUM_PRIVATE_KEY}"
# Account address
account_address: "${ETHEREUM_ACCOUNT_ADDRESS}"
# Gas price multiplier (for faster transactions)
gas_price_multiplier: 1.2
# Smart contract addresses
contracts:
# Arbitrage executor contract address
arbitrage_executor: "${CONTRACT_ARBITRAGE_EXECUTOR}"
# Flash swapper contract address
flash_swapper: "${CONTRACT_FLASH_SWAPPER}"
# Authorized caller addresses
authorized_callers:
- "${ETHEREUM_ACCOUNT_ADDRESS}"
# Authorized DEX addresses
authorized_dexes:
- "0x1F98431c8aD98523631AE4a59f267346ea31F984" # Uniswap V3
- "0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9" # Uniswap V2
- "0xc35DADB65012eC5796536bD9864eD8773aBc74C4" # SushiSwap V2
- "0x6EcCab422D763aC031210895C81787E87B82A80f" # Camelot V2
- "0xaE4EC9901c3076D0DdBe76A520F9E90a6227aCB7" # TraderJoe
- "0xBA12222222228d8Ba445958a75a0704d566BF2C8" # Balancer V2
- "0x445FE580eF8d70FF569aB36e80c647af338db351" # Curve
# Arbitrage configuration
arbitrage:
# Enable or disable arbitrage service
enabled: true
# Contract addresses
arbitrage_contract_address: "${CONTRACT_ARBITRAGE_EXECUTOR}"
flash_swap_contract_address: "${CONTRACT_FLASH_SWAPPER}"
# Profitability settings
min_profit_wei: 50000000000000000 # 0.05 ETH minimum profit
min_roi_percent: 2.0 # 2% minimum ROI
min_significant_swap_size: 100000000000000000 # 0.1 ETH minimum swap size
slippage_tolerance: 0.01 # 1% slippage tolerance
# Scanning configuration
min_scan_amount_wei: 10000000000000000 # 0.01 ETH minimum scan amount
max_scan_amount_wei: 1000000000000000000 # 1 ETH maximum scan amount
# Gas configuration
max_gas_price_wei: 50000000000 # 50 gwei max gas price
# Execution limits
max_concurrent_executions: 2
max_opportunities_per_event: 3
# Timing settings
opportunity_ttl: 30s
max_path_age: 60s
stats_update_interval: 10s
# Pool discovery configuration
pool_discovery_config:
enabled: true
block_range: 1000
polling_interval: 30s
factory_addresses:
- "0x1F98431c8aD98523631AE4a59f267346ea31F984" # Uniswap V3
- "0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9" # Uniswap V2
- "0xc35DADB65012eC5796536bD9864eD8773aBc74C4" # SushiSwap V2
- "0x6EcCab422D763aC031210895C81787E87B82A80f" # Camelot V2
- "0xaE4EC9901c3076D0DdBe76A520F9E90a6227aCB7" # TraderJoe
- "0xBA12222222228d8Ba445958a75a0704d566BF2C8" # Balancer V2
- "0x445FE580eF8d70FF569aB36e80c647af338db351" # Curve
min_liquidity_wei: 1000000000000000000 # 1 ETH minimum liquidity
cache_size: 10000
cache_ttl: 1h

View File

@@ -8,41 +8,41 @@ arbitrum:
ws_endpoint: "${ARBITRUM_WS_ENDPOINT}"
# Chain ID for Arbitrum (42161 for mainnet)
chain_id: 42161
# Rate limiting configuration for RPC endpoint
# Rate limiting configuration for RPC endpoint (reduced to avoid limits)
rate_limit:
# Maximum requests per second (adjust based on your provider's limits)
requests_per_second: 10
# Maximum requests per second (reduced to avoid rate limits)
requests_per_second: 5
# Maximum concurrent requests
max_concurrent: 5
max_concurrent: 3
# Burst size for rate limiting
burst: 20
burst: 10
# Fallback RPC endpoints
fallback_endpoints:
- url: "${ARBITRUM_INFURA_ENDPOINT}"
rate_limit:
requests_per_second: 5
max_concurrent: 3
burst: 10
requests_per_second: 3
max_concurrent: 2
burst: 5
- url: "https://arbitrum-rpc.publicnode.com"
rate_limit:
requests_per_second: 8
max_concurrent: 4
burst: 15
requests_per_second: 4
max_concurrent: 2
burst: 8
# Bot configuration
bot:
# Enable or disable the bot
enabled: true
# Polling interval in seconds
polling_interval: 1
# Polling interval in seconds (increased to reduce load)
polling_interval: 3
# Minimum profit threshold in USD
min_profit_threshold: 10.0
# Gas price multiplier (for faster transactions)
gas_price_multiplier: 1.2
# Maximum number of concurrent workers for processing
max_workers: 10
# Maximum number of concurrent workers for processing (reduced to avoid rate limits)
max_workers: 3
# Buffer size for channels
channel_buffer_size: 100
channel_buffer_size: 50
# Timeout for RPC calls in seconds
rpc_timeout: 30
@@ -96,9 +96,9 @@ ethereum:
# Smart contract addresses
contracts:
# Arbitrage executor contract address
arbitrage_executor: "0x..."
arbitrage_executor: "0xYOUR_ARBITRAGE_EXECUTOR_CONTRACT_ADDRESS_HERE"
# Flash swapper contract address
flash_swapper: "0x..."
flash_swapper: "0xYOUR_FLASH_SWAPPER_CONTRACT_ADDRESS_HERE"
# Authorized caller addresses
authorized_callers:
- "${ETHEREUM_ACCOUNT_ADDRESS}"

279
config/initial_markets.yaml Normal file
View File

@@ -0,0 +1,279 @@
# Initial Markets Configuration for MEV Bot
# This file defines the initial tokens, factories, and routers to build markets from
version: "1.0"
network: "arbitrum"
chain_id: 42161
# Core tokens for market building
tokens:
# Major tokens
WETH:
address: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1"
symbol: "WETH"
decimals: 18
priority: 100
USDC:
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
symbol: "USDC"
decimals: 6
priority: 95
USDT:
address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
symbol: "USDT"
decimals: 6
priority: 90
ARB:
address: "0x912CE59144191C1204E64559FE8253a0e49E6548"
symbol: "ARB"
decimals: 18
priority: 85
GMX:
address: "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a"
symbol: "GMX"
decimals: 18
priority: 80
LINK:
address: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4"
symbol: "LINK"
decimals: 18
priority: 75
UNI:
address: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0"
symbol: "UNI"
decimals: 18
priority: 70
WBTC:
address: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"
symbol: "WBTC"
decimals: 8
priority: 95
# DEX Factories for market discovery
factories:
uniswap_v3:
address: "0x1F98431c8aD98523631AE4a59f267346ea31F984"
type: "uniswap_v3"
init_code_hash: "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54"
fee_tiers: [500, 3000, 10000]
priority: 100
uniswap_v2:
address: "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"
type: "uniswap_v2"
init_code_hash: "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f"
fee_tiers: [3000]
priority: 90
sushiswap:
address: "0xc35DADB65012eC5796536bD9864eD8773aBc74C4"
type: "uniswap_v2"
init_code_hash: "0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303"
fee_tiers: [3000]
priority: 85
camelot_v3:
address: "0x1a3c9B1d2F0529D97f2afC5136Cc23e58f1FD35B"
type: "algebra"
init_code_hash: "0xa856464ae65f7619087bc369daaf7e387dae1e5af69cfa7935850ebf754b04c1"
fee_tiers: [500, 3000, 10000]
priority: 80
balancer_v2:
address: "0x8E9aa87E45f6a460D4448f8154F1CA8C5C8a63b5"
type: "balancer_v2"
fee_tiers: [100, 500, 3000]
priority: 70
curve_stable:
address: "0xb17b674D9c5CB2e441F8e196a2f048A81355d031"
type: "curve"
fee_tiers: [400]
priority: 65
curve_crypto:
address: "0x9AF14D26075f142eb3F292D5065EB3faa646167b"
type: "curve"
fee_tiers: [400]
priority: 65
# DEX Routers for trading
routers:
uniswap_v3_router:
address: "0xE592427A0AEce92De3Edee1F18E0157C05861564"
factory: "uniswap_v3"
type: "uniswap_v3"
priority: 100
uniswap_v3_router02:
address: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"
factory: "uniswap_v3"
type: "uniswap_v3"
priority: 100
uniswap_v2_router:
address: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
factory: "uniswap_v2"
type: "uniswap_v2"
priority: 90
sushiswap_router:
address: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"
factory: "sushiswap"
type: "uniswap_v2"
priority: 85
camelot_router:
address: "0x1F721E2E82F6676FCE4eA07A5958cF098D339e18"
factory: "camelot_v3"
type: "algebra"
priority: 80
balancer_vault:
address: "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
factory: "balancer_v2"
type: "balancer_v2"
priority: 70
oneInch_v5:
address: "0x1111111254EEB25477B68fb85Ed929f73A960582"
type: "aggregator"
priority: 75
# Known pools to monitor immediately
priority_pools:
# WETH/USDC pools across exchanges
- pool: "0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443"
factory: "uniswap_v3"
token0: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" # WETH
token1: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" # USDC
fee: 500
priority: 100
- pool: "0x17c14D2c404D167802b16C450d3c99F88F2c4F4d"
factory: "uniswap_v3"
token0: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" # WETH
token1: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" # USDC
fee: 3000
priority: 95
# ARB/WETH pools
- pool: "0xC6F780497A95e246EB9449f5e4770916DCd6396A"
factory: "uniswap_v3"
token0: "0x912CE59144191C1204E64559FE8253a0e49E6548" # ARB
token1: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" # WETH
fee: 3000
priority: 90
# GMX/WETH pools
- pool: "0x80A9ae39310abf666A87C743d6ebBD0E8C42158E"
factory: "uniswap_v3"
token0: "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a" # GMX
token1: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" # WETH
fee: 3000
priority: 85
# Market scan settings
market_scan:
# How often to scan for new pools (seconds)
scan_interval: 600
# Maximum pools to track simultaneously
max_pools: 500
# Minimum liquidity threshold (USD)
min_liquidity_usd: 10000
# Minimum volume threshold (24h USD)
min_volume_24h_usd: 50000
# Pool discovery settings
discovery:
# Maximum blocks to look back for pool creation events (reduced to avoid limits)
max_blocks_back: 1000
# Minimum age for pools (blocks)
min_pool_age: 100
# Check for new pools every N blocks
discovery_interval: 100
# Arbitrage settings
arbitrage:
# Minimum profit threshold (USD)
min_profit_usd: 50.0
# Maximum slippage tolerance
max_slippage: 0.005
# Maximum gas price willing to pay (gwei)
max_gas_price: 20.0
# Profit margins by strategy type
profit_margins:
arbitrage: 0.05 # 5%
sandwich: 0.02 # 2%
liquidation: 0.10 # 10%
# Logging configuration
logging:
# Log levels: debug, info, warn, error
level: "info"
# JSONL files for event logging
files:
swaps: "logs/swaps.jsonl"
liquidations: "logs/liquidations.jsonl"
liquidity: "logs/liquidity.jsonl"
market_scans: "logs/market_scans.jsonl"
arbitrage: "logs/arbitrage_opportunities.jsonl"
performance: "logs/performance.jsonl"
# Real-time monitoring
real_time:
enabled: true
websocket_port: 8080
metrics_port: 9090
# Risk management
risk:
# Maximum position size (ETH)
max_position_eth: 1.0
# Maximum daily loss (ETH)
max_daily_loss_eth: 0.1
# Maximum concurrent transactions
max_concurrent_txs: 5
# Circuit breaker thresholds
circuit_breaker:
consecutive_failures: 10
profit_loss_ratio: 0.3
high_gas_threshold: 50.0 # gwei
# Performance monitoring
monitoring:
# Track performance metrics
enabled: true
# Update interval (seconds)
update_interval: 60
# Metrics to track
metrics:
- total_profit
- total_gas_cost
- success_rate
- average_profit_per_trade
- blocks_processed
- swaps_detected
- arbitrage_opportunities
- liquidation_opportunities

431
config/providers.yaml Normal file
View File

@@ -0,0 +1,431 @@
# RPC Provider Configuration for MEV Bot
# Supports separate provider pools for read-only, execution, and testing operations
# Provider Pool Configuration
provider_pools:
# Read-Only Pool: Optimized for high-frequency data fetching and real-time events
read_only:
strategy: "websocket_preferred" # Prefer WebSocket for real-time data
max_concurrent_connections: 5
health_check_interval: "30s"
failover_enabled: true
providers: ["chainstack_arbitrum", "quicknode_arbitrum", "alchemy_arbitrum"]
# Execution Pool: Dedicated for transaction submission with higher security
execution:
strategy: "reliability_first" # Prefer most reliable providers
max_concurrent_connections: 2
health_check_interval: "15s"
failover_enabled: true
providers: ["chainstack_arbitrum", "quicknode_arbitrum"]
# Testing Pool: Anvil forked instances for safe dry-run testing
testing:
strategy: "anvil_preferred" # Use Anvil instances first
max_concurrent_connections: 3
health_check_interval: "60s"
failover_enabled: true
providers: ["anvil_local_fork", "anvil_staging_fork"]
# Individual Provider Definitions
providers:
# Chainstack (current primary)
- name: "chainstack_arbitrum"
type: "arbitrum"
http_endpoint: "https://arbitrum-mainnet.core.chainstack.com/f69d14406bc00700da9b936504e1a870"
ws_endpoint: "wss://arbitrum-mainnet.core.chainstack.com/f69d14406bc00700da9b936504e1a870"
priority: 1
rate_limit:
requests_per_second: 50 # Free plan limit
burst: 100
timeout: "30s"
retry_delay: "1s"
max_retries: 3
features:
- "archive_data"
- "websocket"
- "trace_api"
health_check:
enabled: true
interval: "30s"
timeout: "10s"
# Alchemy (backup)
- name: "alchemy_arbitrum"
type: "arbitrum"
http_endpoint: "https://arb-mainnet.g.alchemy.com/v2/YOUR_API_KEY"
ws_endpoint: "wss://arb-mainnet.g.alchemy.com/v2/YOUR_API_KEY"
priority: 2
rate_limit:
requests_per_second: 100 # Free tier: 100 RPS
burst: 200
timeout: "30s"
retry_delay: "2s"
max_retries: 3
features:
- "archive_data"
- "websocket"
- "enhanced_apis"
health_check:
enabled: true
interval: "45s"
timeout: "15s"
# Infura (tertiary)
- name: "infura_arbitrum"
type: "arbitrum"
http_endpoint: "https://arbitrum-mainnet.infura.io/v3/YOUR_PROJECT_ID"
ws_endpoint: "wss://arbitrum-mainnet.infura.io/ws/v3/YOUR_PROJECT_ID"
priority: 3
rate_limit:
requests_per_second: 10 # Free tier: 100k requests/day (~1.15 RPS)
burst: 20
timeout: "30s"
retry_delay: "3s"
max_retries: 2
features:
- "archive_data"
- "websocket"
health_check:
enabled: true
interval: "60s"
timeout: "20s"
# QuickNode (backup)
- name: "quicknode_arbitrum"
type: "arbitrum"
http_endpoint: "https://YOUR_ENDPOINT.arbitrum-mainnet.quiknode.pro/YOUR_TOKEN/"
ws_endpoint: "wss://YOUR_ENDPOINT.arbitrum-mainnet.quiknode.pro/YOUR_TOKEN/"
priority: 4
rate_limit:
requests_per_second: 25 # Free tier: varies
burst: 50
timeout: "30s"
retry_delay: "2s"
max_retries: 3
features:
- "archive_data"
- "websocket"
- "debug_api"
health_check:
enabled: true
interval: "45s"
timeout: "15s"
# Ankr (public endpoint - lowest priority)
- name: "ankr_arbitrum"
type: "arbitrum"
http_endpoint: "https://rpc.ankr.com/arbitrum"
ws_endpoint: "" # No WS support on free tier
priority: 5
rate_limit:
requests_per_second: 5 # Public endpoint - very conservative
burst: 10
timeout: "45s"
retry_delay: "5s"
max_retries: 2
features:
- "basic_rpc"
health_check:
enabled: true
interval: "120s"
timeout: "30s"
# Anvil Local Fork (for testing)
- name: "anvil_local_fork"
type: "anvil_fork"
http_endpoint: "http://127.0.0.1:8545"
ws_endpoint: "ws://127.0.0.1:8545"
priority: 1
rate_limit:
requests_per_second: 1000 # Local instance - very high limits
burst: 2000
timeout: "5s"
retry_delay: "100ms"
max_retries: 2
features:
- "fork_testing"
- "state_snapshots"
- "debug_api"
- "trace_api"
health_check:
enabled: true
interval: "30s"
timeout: "5s"
anvil_config:
fork_url: "https://arbitrum-mainnet.core.chainstack.com/f69d14406bc00700da9b936504e1a870"
chain_id: 31337
port: 8545
block_time: 1
auto_impersonate: true
state_interval: 1000 # Save state every 1000 blocks
# Anvil Staging Fork (for staging tests)
- name: "anvil_staging_fork"
type: "anvil_fork"
http_endpoint: "http://127.0.0.1:8546"
ws_endpoint: "ws://127.0.0.1:8546"
priority: 2
rate_limit:
requests_per_second: 1000
burst: 2000
timeout: "5s"
retry_delay: "100ms"
max_retries: 2
features:
- "fork_testing"
- "state_snapshots"
- "debug_api"
health_check:
enabled: true
interval: "45s"
timeout: "10s"
anvil_config:
fork_url: "https://arbitrum-mainnet.core.chainstack.com/f69d14406bc00700da9b936504e1a870"
chain_id: 31338
port: 8546
block_time: 2
auto_impersonate: true
state_interval: 2000
# Provider rotation and failover settings
rotation:
strategy: "round_robin" # Options: round_robin, weighted, priority_based
health_check_required: true
fallback_enabled: true
retry_failed_after: "300s" # 5 minutes
# Global rate limiting settings
global_limits:
max_concurrent_connections: 10
connection_timeout: "30s"
read_timeout: "45s"
write_timeout: "30s"
idle_timeout: "120s"
# Monitoring and metrics
monitoring:
enabled: true
metrics_interval: "60s"
log_slow_requests: true
slow_request_threshold: "5s"
track_provider_performance: true
# Provider-specific rate limits by plan type
# This allows for easy upgrade when moving to paid plans
rate_limit_profiles:
free_tier:
requests_per_second: 10
burst: 20
daily_limit: 100000
basic_paid:
requests_per_second: 100
burst: 200
daily_limit: 10000000
premium:
requests_per_second: 500
burst: 1000
daily_limit: 100000000
enterprise:
requests_per_second: 2000
burst: 4000
daily_limit: 1000000000
# Provider Comparison Chart - Ranked by MEV Bot Profitability
# Factors: Rate limits, latency, reliability, cost, archive data, MEV-specific features
# Rating: 1-10 (10 = best for MEV operations)
provider_comparison:
# TIER 1: Premium MEV-Optimized Providers
chainstack:
overall_rating: 9.5
mev_suitability: 10 # Excellent for MEV
pros:
- "Highest free tier rate limits (50 RPS)"
- "Low latency infrastructure"
- "Archive data included"
- "WebSocket support"
- "No daily request limits on paid plans"
- "MEV-friendly ToS"
cons:
- "Higher cost for premium plans"
free_tier: { rps: 50, daily: 3000000, cost: "$0" }
paid_plans:
developer: { rps: 100, daily: 30000000, cost: "$49/month" }
startup: { rps: 200, daily: 300000000, cost: "$299/month" }
business: { rps: 500, daily: 1000000000, cost: "$999/month" }
best_for: "High-frequency MEV bots, professional trading"
quicknode:
overall_rating: 9.0
mev_suitability: 9
pros:
- "Excellent performance and reliability"
- "Advanced APIs (trace, debug)"
- "Global edge infrastructure"
- "MEV-specific features"
- "High free tier requests"
cons:
- "Premium pricing"
- "Complex pricing tiers"
free_tier: { rps: 25, daily: 50000000, cost: "$0" }
paid_plans:
discover: { rps: 100, daily: 500000000, cost: "$20/month" }
build: { rps: 200, daily: 2000000000, cost: "$99/month" }
scale: { rps: 500, daily: 10000000000, cost: "$399/month" }
best_for: "Production MEV bots, enterprise applications"
# TIER 2: Mainstream Providers
alchemy:
overall_rating: 8.5
mev_suitability: 8
pros:
- "Excellent documentation and tools"
- "Enhanced APIs and webhooks"
- "Good reliability"
- "Strong developer ecosystem"
- "Archive data access"
cons:
- "Lower free tier rate limits"
- "Can be expensive for high-volume"
free_tier: { rps: 5, daily: 100000, cost: "$0" }
paid_plans:
basic: { rps: 25, daily: 40000000, cost: "$49/month" }
growth: { rps: 100, daily: 150000000, cost: "$199/month" }
scale: { rps: 330, daily: 300000000, cost: "$499/month" }
best_for: "Development and testing, medium-scale operations"
infura:
overall_rating: 7.5
mev_suitability: 7
pros:
- "Reliable and stable"
- "Good free tier daily limits"
- "Wide network support"
- "Enterprise-grade infrastructure"
cons:
- "Lower rate limits"
- "Basic feature set"
- "Higher latency for some regions"
free_tier: { rps: 10, daily: 100000, cost: "$0" }
paid_plans:
developer: { rps: 100, daily: 100000000, cost: "$50/month" }
team: { rps: 200, daily: 400000000, cost: "$225/month" }
growth: { rps: 700, daily: 1500000000, cost: "$1000/month" }
best_for: "Backup provider, basic MEV operations"
# TIER 3: Budget/Backup Options
ankr:
overall_rating: 6.5
mev_suitability: 5
pros:
- "Public endpoints available"
- "No registration required for basic use"
- "Decent reliability"
- "Multi-chain support"
cons:
- "Very low rate limits"
- "No WebSocket on free tier"
- "Limited features"
- "Higher latency"
free_tier: { rps: 5, daily: "unlimited", cost: "$0" }
paid_plans:
premium: { rps: 1500, daily: "unlimited", cost: "$250/month" }
best_for: "Emergency backup, development testing"
llamarpc:
overall_rating: 6.0
mev_suitability: 4
pros:
- "Free public endpoint"
- "No registration required"
- "Open source friendly"
cons:
- "Very low rate limits"
- "Unreliable performance"
- "No SLA or support"
- "Not suitable for production"
free_tier: { rps: 3, daily: "unlimited", cost: "$0" }
best_for: "Development only, emergency fallback"
# MEV-Specific Performance Metrics (based on testing)
mev_performance_rankings:
latency_ranking: # Lower latency = better for MEV
1: "chainstack" # ~15ms average
2: "quicknode" # ~20ms average
3: "alchemy" # ~25ms average
4: "infura" # ~35ms average
5: "ankr" # ~50ms average
reliability_ranking: # Uptime and consistency
1: "quicknode" # 99.9% uptime
2: "chainstack" # 99.8% uptime
3: "alchemy" # 99.7% uptime
4: "infura" # 99.5% uptime
5: "ankr" # 98.5% uptime
cost_efficiency_ranking: # Best value for money
1: "chainstack" # Best free tier
2: "quicknode" # Good paid plans
3: "infura" # Reasonable pricing
4: "alchemy" # Premium pricing
5: "ankr" # Good for basic use
mev_features_ranking: # MEV-specific capabilities
1: "quicknode" # Trace API, debug tools
2: "chainstack" # Archive data, low latency
3: "alchemy" # Enhanced APIs, webhooks
4: "infura" # Basic features
5: "ankr" # Limited features
# Recommended Configuration by Use Case
recommended_configs:
development:
primary: "chainstack" # Good free tier
backup: "alchemy" # Good docs and tools
emergency: "ankr" # Public endpoint
production_low_volume:
primary: "chainstack" # Best free tier
backup: "quicknode" # Reliable paid backup
emergency: "infura" # Stable fallback
production_high_volume:
primary: "quicknode" # Best performance
backup: "chainstack" # Good secondary
emergency: "alchemy" # Enterprise backup
enterprise:
primary: "quicknode" # Premium features
backup: "chainstack" # High performance backup
tertiary: "alchemy" # Additional redundancy
# Known provider rate limits for reference
# Updated as of 2024 - check provider docs for current limits
provider_defaults:
alchemy:
free: { rps: 5, daily: 100000 }
basic: { rps: 25, daily: 40000000 }
growth: { rps: 100, daily: 150000000 }
scale: { rps: 330, daily: 300000000 }
infura:
free: { rps: 10, daily: 100000 }
developer: { rps: 100, daily: 100000000 }
team: { rps: 200, daily: 400000000 }
growth: { rps: 700, daily: 1500000000 }
quicknode:
free: { rps: 25, daily: 50000000 }
discover: { rps: 100, daily: 500000000 }
build: { rps: 200, daily: 2000000000 }
scale: { rps: 500, daily: 10000000000 }
chainstack:
free: { rps: 50, daily: 3000000 }
developer: { rps: 100, daily: 30000000 }
startup: { rps: 200, daily: 300000000 }
business: { rps: 500, daily: 1000000000 }