A lightweight, high-performance JSON-RPC load balancer and cache for the Rootstock (RSK) blockchain.
- Intelligent Routing: Read operations (e.g.,
eth_call,eth_estimateGas) are aggressively cached. Write operations strictly bypass the cache. - Load Balancing: Thread-safe, round-robin routing across multiple upstream RSK nodes.
- High Performance: Built with Rust, Axum, Tokio, and Moka for lock-free asynchronous caching and concurrent processing.
Configure the proxy via a .env file in the root directory.
Option A: Public Endpoints (Default / Lightweight) Best for general development without managing node infrastructure.
RSK_PROXY_PORT=8545
RSK_PROXY_UPSTREAMS=[https://public-node.rsk.co](https://public-node.rsk.co),[https://mycrypto.rsk.co](https://mycrypto.rsk.co)
Option B: Internal Docker Nodes (Ultra-low latency) Best for algorithmic trading setups requiring zero-latency network calls.
RSK_PROXY_PORT=8545
RSK_PROXY_UPSTREAMS=http://geth:8545,http://rskd:8545
Using the provided Nix flake ensures all native OpenSSL bindings and macOS SDK frameworks compile flawlessly.
# Drop into the isolated dev shell
git add flake.nix
nix develop
# Run the server
cargo run
(Alternatively, use standard cargo run if your host machine already has pkg-config and libssl-dev installed).
1. Proxy Only (Default)
Spins up just the Rust proxy, routing to the public endpoints in your .env.
docker-compose up --build -d
2. Proxy + Local Nodes
Spins up the proxy alongside fully isolated geth and rskd nodes. (Ensure your .env uses Option B before starting).
docker-compose --profile local-nodes up --build -d
1. Verify Uptime (Health Check)
curl http://localhost:8545/health
2. Test RPC Routing & Caching Fire a read-only request to test the proxy:
curl -X POST http://localhost:8545 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'
Run the command twice. The second call will return significantly faster as it hits the in-memory cache instead of the upstream node.
3. Run Unit Tests
cargo test