A comprehensive CLI tool for stress testing and benchmarking Solana RPC endpoints with customizable concurrency and account inputs. This tool helps developers evaluate the performance of different RPC endpoints, optimize applications, and identify potential bottlenecks -- especially when configuring Lantern.
- Comprehensive Test Suite: Run all RPC methods simultaneously with the
runallcommand - Dynamic Configuration: Generate and load test configurations with API keys
- Smart Progress Tracking: Real-time progress bars and detailed statistics with dynamic updates
- Dynamic Latency Display: Automatic unit selection (ΞΌs, ms, s) based on performance
- Test different Solana RPC methods (getAccountInfo, getProgramAccounts, getMultipleAccounts)
- Configure concurrency level for parallel requests
- Specify test duration
- Provide accounts/programs individually or from a file
- Seed account addresses from programs for testing purposes
- Comprehensive performance metrics (requests/second, latency statistics)
- Limit the number of accounts/programs to process
- Real-time progress tracking with visual progress bars during testing
- Dual RPC architecture for seeding vs testing separation
- Installation
- Quick Start
- Project Structure
- Architecture Overview
- Usage
- Configuration
- API Reference
- Examples
- Troubleshooting
- Go 1.24.2 or higher
- Git
This will run a local server that the Lantern configuration tool can connect to and use.
# Clone the repository
git clone https://github.com/alphabatem/RPC_tests
cd rpc_test
# Install Prerequisites
go mod tidy
# Build the application
go run server.go# Clone the repository
git clone https://github.com/alphabatem/RPC_tests
cd rpc_test
# Build the application
go build -o rpc_test
# Make it executable (Linux/macOS)
chmod +x rpc_test# Check if the binary was created successfully
./rpc_test --helpThe runall command provides a complete testing workflow:
# Run comprehensive test suite with API key and target RPC
./rpc_test runall --api-key YOUR_API_KEY --url https://your-target-rpc.com
# Run with custom settings
./rpc_test runall --api-key YOUR_API_KEY --url https://your-target-rpc.com --concurrency 10 --duration 30
# Limit accounts used for testing
./rpc_test runall --api-key YOUR_API_KEY --url https://your-target-rpc.com --limit 50What runall does:
- Generates test configuration with your API key
- Creates data directory (./data/) for storing test files
- Seeds 100 accounts from the specified program using remote RPC and gPA
- Runs all RPC methods concurrently against your target RPC, using seeded accounts as needed
- Provides comprehensive statistics with dynamic latency display and real-time progress tracking
rpc_test/
βββ main.go # Application entry point
βββ go.mod # Go module dependencies
βββ go.sum # Dependency checksums
βββ README.md # This file
βββ config-template.json # Template configuration file
βββ config.json # Generated configuration (gitignored)
βββ .gitignore # Git ignore rules
βββ rpc_test # Compiled binary (gitignored)
βββ cmd/ # Command implementations
β βββ root.go # Root command and global flags
β βββ common.go # Shared utilities and variables
β βββ runall.go # Comprehensive test suite command
β βββ getAccountInfo.go # getAccountInfo RPC testing
β βββ getMultipleAccounts.go # getMultipleAccounts RPC testing
β βββ getProgramAccounts.go # getProgramAccounts RPC testing
β βββ seed.go # Account seeding functionality
βββ methods/ # RPC method implementations
β βββ rpc.go # Base RPC client wrapper
β βββ getAccountInfo.go # getAccountInfo implementation
β βββ getMultipleAccounts.go # getMultipleAccounts implementation
β βββ getProgramAccounts.go # getProgramAccounts implementation
β βββ seed.go # Account seeding logic
βββ data/ # Test data and generated files
β βββ test_accounts.txt # Generated test accounts
βββ *.txt # Example account/program files
- Command Layer (
cmd/): Implements CLI commands using Cobra framework - Method Layer (
methods/): Contains RPC method implementations using solana-go - Configuration Management: Dynamic config generation and loading
- Progress Tracking: Real-time progress monitoring with visual feedback
- Statistics: Comprehensive metrics calculation and reporting
The runall command uses a uses two RPCs. This lets you get program accounts from one RPC (the "remote" RPC), then use those to build tests against another (the "target"). This is mainly useful in testing Lantern, by setting Lantern as the target RPC.
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Remote RPC β β Target RPC β β Local Files β
β (Config) β β (--url flag) β β (data/) β
βββββββββββββββββββ€ βββββββββββββββββββ€ βββββββββββββββββββ€
β β’ Seeding β β β’ Testing β β β’ Account lists β
β β’ Data fetch β β β’ Benchmarking β β β’ Config files β
β β’ Reliable β β β’ Performance β β β’ Results β
β β’ API key auth β β β’ Load testing β β β’ Logs β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Configuration Phase: Generate/load config with API keys
- Seeding Phase: Fetch account data from reliable remote RPC
- Testing Phase: Run tests against target RPC endpoint
- Analysis Phase: Calculate and display comprehensive statistics
# Basic comprehensive test (requires --url flag)
./rpc_test runall --api-key YOUR_API_KEY --url https://your-target-rpc.com
# Advanced comprehensive test
./rpc_test runall --api-key YOUR_API_KEY --url https://your-target-rpc.com --concurrency 15 --duration 45 --limit 200# Basic usage for getAccountInfo
./rpc_test getAccountInfo --account <ACCOUNT_ADDRESS> --concurrency 10 --duration 30
# Using an account file for getAccountInfo
./rpc_test getAccountInfo --account-file accounts.txt --concurrency 10 --duration 30
# Basic usage for getMultipleAccounts
./rpc_test getMultipleAccounts --account <ACCOUNT_ADDRESS> --concurrency 10 --duration 30
# Using multiple accounts for getMultipleAccounts (will batch 5-15 accounts randomly)
./rpc_test getMultipleAccounts --account addr1 --account addr2 --account addr3 --concurrency 10 --duration 30
# Basic usage for getProgramAccounts
./rpc_test getProgramAccounts --program <PROGRAM_ADDRESS> --concurrency 50 --duration 60
# Using a program file for getProgramAccounts
./rpc_test getProgramAccounts --program-file programs.txt --concurrency 50 --duration 60
# Seed account data from a program for testing
./rpc_test seed --program <PROGRAM_ADDRESS> --output accounts.txt
# Seed account data with a limit of 1000 accounts
./rpc_test seed --program <PROGRAM_ADDRESS> --output accounts.txt --limit 1000
# Test with limited number of accounts
./rpc_test getAccountInfo --account-file accounts.txt --limit 100 --concurrency 10runall: Execute comprehensive test suite with all methodsgetAccountInfo: Run tests against the getAccountInfo RPC methodgetMultipleAccounts: Run tests against the getMultipleAccounts RPC methodgetProgramAccounts: Run tests against the getProgramAccounts RPC methodseed: Fetch program accounts and save their addresses to a file for testing purposes
-u, --url: RPC endpoint URL (default: "https://api.mainnet-beta.solana.com")-c, --concurrency: Number of concurrent requests (default: 1)-d, --duration: Test duration in seconds (default: 10)-a, --account: Account addresses to use in tests (can be specified multiple times)-f, --account-file: File containing account addresses (one per line)-l, --limit: Limit the number of accounts/programs to process (0 for no limit)-k, --api-key: API key for RPC endpoint (available globally, saved in config by runall)
-k, --api-key: API key for RPC endpoint (will be saved in config) REQUIRED-u, --url: Target RPC endpoint URL for testing REQUIRED-c, --concurrency: Number of concurrent requests per method (default: 5)-d, --duration: Test duration in seconds per method (default: 15)-l, --limit: Limit the number of accounts to use (0 for no limit)
Note: Both --api-key and --url flags are REQUIRED for runall command.
-a, --account: Accounts to use in tests (accepts multiple accounts, will rotate between them)-f, --account-file: File containing accounts (one per line, requests sent will rotate between them)
-a, --account: Accounts to use in tests (will rotate between specified accounts in blocks of 5-15, randomly selected)-f, --account-file: File containing accounts (one per line, will rotate between them)
Note: getMultipleAccounts automatically batches accounts (5-15 per request) from your provided account list.
-p, --program: Program accounts to use in tests (can specify more than one)-f, --program-file: File containing program accounts (one per line)
Note: For getProgramAccounts, the -f flag uses --program-file instead of --account-file.
-p, --program: Program accounts to fetch accounts from (can specify multiple programs)-f, --program-file: File containing program accounts (one per line)-o, --output: Output file to store program accounts for future tests (default: "accounts.txt")
The application generates a config.json file with the following structure:
9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
6ycRTkj1RM3L4sZcKHk8HULaFvEBaLGAiQpVpC9MPcKm
7Np41oeYqPefeNQEHSv1UDhYrehxin3NStELsSKCT4K2
2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c
FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X
whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc
{
"maximum_ram": 8,
"maximum_disk": 10,
"location": "./data/",
"mode": "normal",
"cache_requests": false,
"monitoring": false,
"monitoring_url": "",
"log_level": "INFO",
"rpc_url": "https://us.rpc.fluxbeam.xyz",
"rpc_apikey": "YOUR_API_KEY_HERE",
"programs": {
"2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c": {
"discriminator": 2,
"filters": []
}
}
}- Auto-generation: The
runallcommand automatically generates a default configuration - API Key Storage: API keys are securely stored in the config file
- Template-based: Uses
config-template.jsonas a base template - Dynamic Loading: Configuration is loaded at runtime
- Data Directory: Automatically creates
./data/directory for storing test files and results
- Purpose: Fetch account information for specific addresses
- Use Case: Testing account data retrieval performance
- Parameters: Account addresses (single or multiple)
- Rotation: Cycles through provided accounts for load distribution
- Purpose: Fetch information for multiple accounts in a single request
- Use Case: Testing batch account data retrieval
- Parameters: Multiple account addresses
- Batching: Automatically groups 5-15 accounts per request (randomized)
- Purpose: Fetch all accounts owned by a specific program
- Use Case: Testing program account enumeration
- Parameters: Program addresses
The test suite reports comprehensive metrics:
- Total Duration: Actual time taken to complete the test
- Total Requests: Number of requests processed
- Successful Requests: Count and percentage of successful requests
- Failed Requests: Count and percentage of failed requests
- Requests per second: Average number of requests processed per second
- Min Latency: Minimum request latency (auto-formatted: ΞΌs, ms, or s)
- Max Latency: Maximum request latency (auto-formatted: ΞΌs, ms, or s)
- Avg Latency: Average request latency (auto-formatted: ΞΌs, ms, or s)
- Visual Progress Bars: Real-time progress display with completion percentage
- Live Statistics: Current RPS, request counts, and elapsed time
- Method-specific Progress: Individual progress tracking for each RPC method in runall
- Individual Method Results: Detailed stats for each RPC method
- Overall Test Summary: Combined statistics across all methods
- Performance Insights: Best/worst performing methods with ratios
- Latency Comparison: Fastest vs slowest methods with performance ratios
9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
6ycRTkj1RM3L4sZcKHk8HULaFvEBaLGAiQpVpC9MPcKm
7Np41oeYqPefeNQEHSv1UDhYrehxin3NStELsSKCT4K2
2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c
FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X
whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc
π Starting comprehensive RPC test suite...
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Step 1: Generating test configuration...
[ββββββββββββββββββββββββββββββ] Config generated... β
β
Test configuration saved to: ./config.json
π Step 1.5: Loading configuration with API key...
[ββββββββββββββββββββββββββββββ] Config loaded... β
β
Configuration loaded successfully
π± Step 2: Seeding accounts from program...
π Using remote RPC for seeding: https://us.rpc.fluxbeam.xyz
π Fetching accounts from program 2wT8Yq49k...
β
Successfully seeded accounts
β
Accounts seeded to: ./data/test_accounts.txt
β‘ Step 3: Running all RPC methods...
π― Using target RPC for testing: https://your-target-rpc.com
π Testing 3 methods with 100 accounts
βοΈ Concurrency: 5, Duration: 15s per method
π [1/3] Starting getAccountInfo test...
π [2/3] Starting getMultipleAccounts test...
π [3/3] Starting getProgramAccounts test...
[ββββββββββββββββββββ] getAccountInfo: 80.0% | 12s/15s | Requests: 1250 | RPS: 104.2
[ββββββββββββββββββββ] getMultipleAccounts: 73.3% | 11s/15s | Requests: 1100 | RPS: 100.0
[ββββββββββββββββββββ] getProgramAccounts: 86.7% | 13s/15s | Requests: 1300 | RPS: 100.0
β
getAccountInfo completed successfully
β
getMultipleAccounts completed successfully
β
getProgramAccounts completed successfully
π Step 4: Generating comprehensive statistics...
[ββββββββββββββββββββββββββββββ] Statistics calculated... β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π COMPREHENSIVE TEST RESULTS
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π INDIVIDUAL METHOD RESULTS:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π GETACCOUNTINFO:
Duration: 15.00 seconds
Total Requests: 1250
Successful: 1245 (99.60%)
Failed: 5 (0.40%)
Requests/second: 83.00
Min Latency: 45.23 ΞΌs
Max Latency: 125.67 ΞΌs
Avg Latency: 78.45 ΞΌs
π― OVERALL TEST SUMMARY:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Total Duration: 45.00 seconds
π’ Total Requests: 3650
β
Total Successful: 3635 (99.59%)
β Total Failed: 15 (0.41%)
β‘ Overall RPS: 81.11
π Methods Tested: 3
π‘ PERFORMANCE INSIGHTS:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Best Performing: getAccountInfo (83.00 RPS)
π Worst Performing: getProgramAccounts (80.00 RPS)
π Performance Ratio: 96.4% (worst/best)
β±οΈ LATENCY COMPARISON:
β‘ Fastest Method: getAccountInfo (78.45 ΞΌs avg)
π Slowest Method: getProgramAccounts (245.12 ΞΌs avg)
π Latency Ratio: 3.1x (slowest/fastest)
β
Comprehensive test suite completed successfully!
Error: authentication failed
Solution: Ensure your API key is valid and has the necessary permissions. You can get a free API key at FluxRPC
Error: connection refused
Solution: Verify the RPC endpoint URL and check network connectivity. FluxRPC endpoints are available by logging in and navigating to the "API Keys" page.
Error: rate limit exceeded
Solution: Reduce concurrency or increase delays between requests.
Error: no accounts found
Solution: Check if the program address is valid and contains accounts.
Enable verbose logging for debugging:
# Set log level to DEBUG
export LOG_LEVEL=DEBUG
./rpc_test runall --api-key YOUR_API_KEY --url https://your-target-rpc.com- Concurrency Tuning: Start with low concurrency and gradually increase
- Duration Adjustment: Use longer durations for more accurate metrics
- Account Limits: Limit accounts for faster testing iterations
- Network Optimization: Use RPC endpoints closer to your location (https://configurator.fluxrpc.com/ will try and auto-detect this for you)
- Go 1.24.2+
- Git
- Make (optional, for build scripts)
# Clone the repository
git clone <repository-url>
cd rpc_test
# Install dependencies
go mod download
# Run tests
go test ./...
# Build for development
go build -o rpc_test
# Run with development flags
./rpc_test --helpKey dependencies used in this project:
- github.com/spf13/cobra: CLI framework
- github.com/gagliardetto/solana-go: Solana blockchain interaction
- go.uber.org/zap: Structured logging
- github.com/fatih/color: Colored terminal output
- root.go: Main command setup and global flags
- common.go: Shared utilities and variables
- runall.go: Comprehensive test suite implementation
- getAccountInfo.go: getAccountInfo command
- getMultipleAccounts.go: getMultipleAccounts command
- getProgramAccounts.go: getProgramAccounts command
- seed.go: Account seeding command
- rpc.go: Base RPC client wrapper
- getAccountInfo.go: getAccountInfo RPC implementation
- getMultipleAccounts.go: getMultipleAccounts RPC implementation
- getProgramAccounts.go: getProgramAccounts RPC implementation
- seed.go: Account seeding logic
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run specific test
go test ./methods -v
# Run benchmarks
go test -bench=. ./...# Build for current platform
go build -o rpc_test
# Build for specific platform
GOOS=linux GOARCH=amd64 go build -o rpc_test_linux
GOOS=darwin GOARCH=amd64 go build -o rpc_test_macos
GOOS=windows GOARCH=amd64 go build -o rpc_test_windows.exe- Solana Labs for the Solana blockchain
- Gagliardetto for the excellent solana-go library
- The Solana community for feedback and contributions