Overview
This guide will walk you through setting up Sol RPC Router from scratch. You’ll learn how to build the router, configure Redis, set up backend endpoints, create API keys, and make your first authenticated request.Prerequisites: Make sure you have Rust (2021 edition) and Redis installed. See the Installation guide for detailed setup instructions.
Quick Setup
Clone and Build
Build Sol RPC Router from source:This will create two binaries:
./target/release/sol-rpc-router- The main proxy server./target/release/rpc-admin- The API key management CLI
Start Redis
Sol RPC Router requires Redis for API key storage and rate limiting:Verify Redis is running:
Configure the Router
Create a Here’s a minimal configuration to get started:
config.toml file based on the example:config.toml
Configuration Details:
port: HTTP server listens here. WebSocket automatically usesport + 1weight: Higher values receive more traffic (10:5 = 2:1 distribution)ws_url: Optional WebSocket endpoint for subscriptionsmethod_routes: Pin specific RPC methods to backends
Create an API Key
Use the Output:Common rpc-admin commands:
rpc-admin CLI to create your first API key:Test WebSocket Connections
Sol RPC Router supports WebSocket subscriptions on both the main HTTP port (via upgrade) and a dedicated WebSocket port:Monitor Health and Metrics
Check backend health status:Rate Limiting in Action
Test the rate limiter by exceeding your configured limit:429 Too Many Requests.
Next Steps
Configuration Guide
Learn about advanced configuration options, method routing, and health checks
API Reference
Complete endpoint documentation and request/response examples
Deployment
Production deployment strategies, monitoring, and best practices
Metrics & Monitoring
Set up Prometheus and Grafana dashboards for your router
Troubleshooting
Redis connection failed
Redis connection failed
Error:
Failed to initialize Redis KeyStoreSolutions:- Verify Redis is running:
redis-cli ping - Check the
redis_urlin your config.toml - Ensure Redis is accessible on the configured port
- Check firewall rules if Redis is on a remote host
401 Unauthorized
401 Unauthorized
Backend connection errors
Backend connection errors
Error:
Failed to connect to backendSolutions:- Verify backend URLs are correct in config.toml
- Test backend connectivity:
curl <backend_url> - Check the
/healthendpoint for backend status - Review
health_check.method- ensure the RPC method is supported
All backends marked unhealthy
All backends marked unhealthy
Solutions:
- Check
/healthendpoint for error details - Verify
health_check.methodis a valid RPC method (e.g.,getSlot) - Increase
health_check.timeout_secsif backends are slow - Review backend logs for errors
- Test backends directly with curl