Skip to content

userbox020/RPC-Nodes-Benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base RPC Benchmark & Failover Engine

A high-performance benchmarking tool for comparing RPC providers on Base and Ethereum networks.

Features

  • Measures latency: average, p50, p95, p99
  • Compares HTTP and WebSocket performance
  • Benchmarks common providers: Alchemy, Infura, PublicNode, Ankr, Blast, BlockPI, Coinbase, DRPC, LlamaRPC, 1RPC, QuickNode, Chainstack, GetBlock, Tenderly
  • Uses async high-speed testing with aiohttp and websockets
  • Selects the fastest healthy RPC endpoint automatically

Why This Matters

RPC performance directly impacts trading bots, DeFi execution speed, and real-time applications. This tool helps identify the fastest and most reliable provider for latency-sensitive infrastructure.

Install

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

Configure Providers

These public HTTP providers work without credentials when available for the selected network:

  • PublicNode
  • Ankr
  • Blast
  • BlockPI
  • Coinbase for Base
  • DRPC
  • LlamaRPC
  • 1RPC

Alchemy and Infura are enabled when you provide API keys:

$env:ALCHEMY_API_KEY="your_alchemy_key"
$env:INFURA_API_KEY="your_infura_key"

You can also override any endpoint directly:

$env:ALCHEMY_BASE_HTTP_URL="https://base-mainnet.g.alchemy.com/v2/..."
$env:ALCHEMY_BASE_WS_URL="wss://base-mainnet.g.alchemy.com/v2/..."
$env:INFURA_ETHEREUM_HTTP_URL="https://mainnet.infura.io/v3/..."
$env:INFURA_ETHEREUM_WS_URL="wss://mainnet.infura.io/ws/v3/..."

Direct URL overrides use this format:

PROVIDER_NETWORK_HTTP_URL
PROVIDER_NETWORK_WS_URL
PROVIDER_HTTP_URL
PROVIDER_WS_URL

Examples:

$env:QUICKNODE_BASE_HTTP_URL="https://your-endpoint.base-mainnet.quiknode.pro/..."
$env:QUICKNODE_BASE_WS_URL="wss://your-endpoint.base-mainnet.quiknode.pro/..."
$env:CHAINSTACK_ETHEREUM_HTTP_URL="https://your-chainstack-node"
$env:TENDERLY_BASE_HTTP_URL="https://base-mainnet.gateway.tenderly.co/..."
$env:GETBLOCK_ETHEREUM_HTTP_URL="https://go.getblock.io/..."
$env:ONE_RPC_BASE_HTTP_URL="https://1rpc.io/base"

Usage

Benchmark Base over HTTP and WebSocket:

python rpc_benchmark.py --network base --transport all --requests 50 --concurrency 10

Benchmark Ethereum HTTP only:

python rpc_benchmark.py --network ethereum --transport http --requests 100 --concurrency 20

Benchmark a specific set of providers:

python rpc_benchmark.py --network base --transport http --providers publicnode,ankr,quicknode

Benchmark every configured common provider:

python rpc_benchmark.py --network base --transport all --providers all

Example Output

Provider     Network   Type   Avg(ms)  P50(ms)  P95(ms)  P99(ms)  Success
-------------------------------------------------------------------------
Alchemy      base      http       104      101      120      130     100%
Infura       base      http       118      116      140      155      99%
PublicNode   base      http       103      100      115      121     100%

Fastest healthy RPC: PublicNode (http) at 103 avg
https://base-rpc.publicnode.com

Use Cases

  • Optimize trading infrastructure
  • Select the best RPC provider dynamically
  • Monitor RPC performance over time

Tech Stack

  • Python asyncio
  • aiohttp
  • websockets

Author

Blockchain Infrastructure Engineer focused on performance optimization

About

Base RPC Benchmark & Failover Engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages