Skip to content

g00dv1n/sol-rpc-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana RPC Router & Balancer

The Solana RPC Router is a tool designed to efficiently route and balance traffic between regular Solana RPC servers and those that support the DAS API. The router supports simple round-robin and weighted round-robin balancing strategies. Keep in mind that this is just a proof of concept (PoC), but it works.

Usage

make build
./bin/sol-rpc-router -c proxy_config.json

Set up the router behind NGINX or in a Docker container, and use it as a universal endpoint for all your RPC calls within your app.

Config Example

proxy_config.json

{
  "port": 9999,
  "host": "127.0.0.1",
  "regularRpc": {
    "balancerType": "rr",
    "servers": [
      {
        "url": "https://solana-mainnet.core.chainstack.com/API_KEY"
      },
      {
        "url": "https://solana-mainnet.core.chainstack.com/API_KEY"
      }
    ]
  },
  "dasRpc": {
    "balancerType": "wrr",
    "servers": [
      {
        "url": "https://mainnet.helius-rpc.com/?api-key=API_KEY",
        "weight": 2
      },
      {
        "url": "https://mainnet.helius-rpc.com/?api-key=API_KEY",
        "weight": 1
      }
    ]
  }
}