A lightweight JSON-RPC proxy for EVM-compatible blockchains (Ethereum, Goerli, Sepolia, BSC, etc.).
Its goal is to safely expose blockchain calls to the frontend without leaking private provider keys, while offering load balancing, caching, rate limiting, and circuit breaking.
origin + ip.eth_chainId.All settings are controlled via environment variables.
cargo run --release
By default, the server listens at:
http://localhost:7878
GET /healthReturns a simple 200 OK with "ok".
Use this for health checks.
curl http://localhost:8080/health
# -> ok
POST /rpcProxies JSON-RPC requests to the configured upstreams.
Example:
curl -X POST http://localhost:8080/rpc \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}
Query parameter chain lets you select other EVM chains:
curl -X POST "http://localhost:8080/rpc?chain=sepolia" ...
Origin + real client IP.{
"error": "rate_limited"
}
For security, only safe methods are allowed by default:
eth_chainIdeth_getBalanceeth_calleth_estimateGaseth_getTransactionCounteth_sendRawTransactionnet_versionweb3_clientVersionRequests using disallowed methods return:
{
"error": "method_not_allowed",
"method": "eth_getLogs"
}
chain, environment variables, and available providers.eth_chainId responses are cached for short TTLs.Mapa de rutas ⇄ consumidor • GET /health → handlers::health::health Consumido por: checks de infra o curl (para ver que el server vive). • GET /meta → handlers::eth::meta::meta Consumido por: páginas que quieren saber methods, chains, rate_limit. (Útil para poblar UIs sin hardcodear). • GET / → handlers::home::home Consumido por: la portada (home) del sitio. • GET /ethereum → handlers::eth::ethereum::ethereum Consumido por: la página “Ethereum” (intro, allowed methods, enlaces). • GET /json-rpc-overview → handlers::eth::rpc_overview::rpc_overview Consumido por: doc/overview de JSON-RPC (explica requests/responses). • GET /rpc-providers → handlers::eth::rpc_providers::rpc_providers_page Consumido por: doc de proveedores (Infura/Alchemy/Ankr/PublicNode). • GET /dev/eth-upstreams → handlers::eth::dev_upstream::dev_upstreams_page Consumido por: página dev que hace fetch a /meta/upstreams para listar upstreams efectivos. • GET /meta/upstreams → handlers::eth::dev_upstream::meta_upstreams Consumido por: solo dev, la página anterior; devuelve JSON con {url, status, ttl_down_secs, provider}. Requiere EXPOSE_UPSTREAMS=1. • OPTIONS/POST /rpc → handlers::eth::rpc::{rpc_options, rpc} Consumido por: • Tu Playground (/eth-playground) vía fetch al dar “Run”. • Cualquier cliente JSON-RPC (curl/SDK) que pegue a tu proxy. • GET /eth-playground → handlers::eth::eth_playground::eth_playground Consumido por: el navegador. La página incluye JS que: 1. lee ?method= (si viene) 2. prellena el textarea 3. al “Run”, hace POST /rpc?chain=<…> con el body JSON.
MIT © neurons.me Maintained by neurons.me • Authored by suiGn