- You’ll learn how to install and use Chainbench, an open-source blockchain infrastructure benchmarking tool built on Locust.
- You’ll run load tests against your RPC endpoints using built-in profiles for EVM chains and Solana.
- You’ll discover available methods on endpoints and create custom test profiles.
- You’ll understand how to use both web UI and headless modes for interactive and automated testing.
Main article
In this tutorial, you will:- Install Chainbench and explore its features.
- Run load tests against blockchain RPC endpoints using single methods and profiles.
- Use the discover command to check method availability on your nodes.
- Create custom profiles for specific testing scenarios.
- Run tests in both web UI and headless modes.
Prerequisites
- Chainstack account to deploy blockchain RPC endpoints for testing
- Python 3.10+ installed on your machine
- A blockchain RPC endpoint to test (Chainstack provides elastic and dedicated nodes across 70+ protocols)
Overview
To get started with Chainbench:- Install Chainbench using pip.
- Explore available commands and profiles.
- Run a single-method load test.
- Run a profile-based load test.
- Use the discover command to check method availability.
- Create a custom profile for your specific use case.
- Run tests in headless mode for automation.
Step-by-step
Install Chainbench
Install Chainbench using pip:Alternative installation with Poetry
If you prefer to work with the source code or contribute to the project:
Explore available resources
Before running tests, explore what’s available:- EVM chains: Ethereum, BSC, Polygon, Arbitrum, Optimism, Avalanche, Fantom, Base, Gnosis, Oasis, Ronin
- Non-EVM: Solana, Starknet (partial support)
- Generic EVM profiles:
evm.light,evm.heavy,evm.get_logs,evm.debug_trace,evm.all
--shape:
- step: Load increases in discrete steps
- spike: 10% users → spike to 100% → back to 10%
--shape, Chainbench uses the default ramp-up pattern (users ramp up until the target is reached, then it holds steady for the rest of the test).
Run a single-method load test
Test a single RPC method against your endpoint:eth_blockNumber— the RPC method to test--users 50— number of simulated users making concurrent requests--workers 2— number of worker processes (Locust workers)--test-time 5m— test duration (supports s, m, h suffixes)--target— your Chainstack RPC endpoint URL--headless— run without the web UI--autoquit— exit automatically when the test completes
YOUR_CHAINSTACK_ENDPOINT with your actual endpoint. See View node access and credentials.
Example output shows requests per second (RPS), response times, and failure rates.
Run a profile-based load test
Profiles define realistic traffic patterns with multiple methods and weighted distributions. Run a test using the general BSC profile:evm.light profile includes common read methods:
eth_blockNumbereth_getBalanceeth_chainIdeth_getBlockByNumbereth_getTransactionByHasheth_getTransactionReceiptweb3_clientVersion
evm.heavy profile includes resource-intensive methods like eth_getLogs and debug/trace methods (enabled with --debug-trace-methods).
Use the discover command
Before running load tests, verify which methods your endpoint supports:- ✓ for working methods
- ✗ for unsupported methods
- Error codes for methods that return errors
- Verifying node configuration before delivery
- Comparing method support across different node providers
- Quick smoke testing of endpoints
Run tests in web UI mode
For interactive testing with real-time statistics:http://localhost:8089 where you can:
- Adjust users, spawn rate, and test duration
- View real-time charts and statistics
- Start and stop tests interactively
- Download test results
Selecting profiles in the web UI
If you want to pick a profile interactively in the Locust UI, start Chainbench with a profile directory and omit If you installed Chainbench with Then pass the printed path to
--profile and the method argument.If you cloned the Chainbench repository, run this command from the repo root:pip, print the built-in EVM profiles directory:--profile-dir.Create a custom profile
Create a custom profile for your specific traffic pattern. Save this asmy_profile.py:
Configure test data options
Chainbench generates realistic test data from the blockchain. Configure data generation: Test data size:| Size | Blocks sampled |
|---|---|
| XS | 10 |
| S | 100 (default) |
| M | 1,000 |
| L | 10,000 |
| XL | 100,000 |
Use load pattern shapes
Control how load is distributed over time: Step pattern:Monitor sync lag during tests
Track how far behind the node is during load testing:Run batch requests
Test batch JSON-RPC requests:Run tests on a remote server
For long-running tests on a server:./results/{profile_name}/{timestamp}/.
Open
report.html to review latency percentiles, RPS, and failures. Use the CSV files (for example, report.csv_stats.csv) if you want to process results programmatically.Available EVM methods
Chainbench supports testing these EVM methods (among others):| Category | Methods |
|---|---|
| Block | eth_blockNumber, eth_getBlockByNumber, eth_getBlockByHash |
| Transaction | eth_getTransactionByHash, eth_getTransactionReceipt, eth_getTransactionCount |
| Account | eth_getBalance, eth_getCode, eth_getStorageAt |
| Call | eth_call, eth_estimateGas |
| Logs | eth_getLogs |
| Debug | debug_traceTransaction, debug_traceCall, debug_traceBlockByNumber |
| Trace | trace_transaction, trace_block, trace_call |
Debug and trace methods
Debug and trace methods are excluded by default. Enable them with--debug-trace-methods.Solana testing
Test Solana endpoints with the Solana profile:getAccountInfogetBlockgetTransactiongetBalancegetTokenAccountsByOwnergetMultipleAccountsgetSignaturesForAddress
Conclusion
Chainbench provides a powerful way to benchmark and load test your blockchain infrastructure. Use it to:- Validate node performance before production deployment
- Compare performance across different node providers
- Test custom traffic patterns matching your application’s usage
- Monitor node behavior under various load conditions
- Automate performance testing in CI/CD pipelines