RPC Proxy API

Provides CORS-enabled RPC proxy with automatic failover for Base network

Overview

Purpose

RPC proxy service that provides CORS-enabled access to Base network RPC endpoints with automatic failover and load balancing.

Network

Base Mainnet (Chain ID: 8453)

Features

Automatic RPC rotation, WebSocket support, health monitoring, and CORS handling.

RPC Providers

Infura Base, Ankr Base with automatic failover

API Endpoints

GET /health Health check endpoint
Response
{ "status": "healthy", "timestamp": "2024-01-01T00:00:00.000Z", "instance": "worker_abc123_1704067200000" }
200 OK
GET /status Current RPC status and error counts
Response
{ "currentRPC": { "name": "Infura Base", "url": "https://base-mainnet.infura.io/v3/...", "index": 0 }, "rpcEndpoints": [ { "name": "Infura Base", "errorCount": 0, "lastError": null }, { "name": "Ankr Base", "errorCount": 2, "lastError": "2024-01-01T00:00:00.000Z" } ], "totalRequests": 1500, "lastRotation": "2024-01-01T00:00:00.000Z" }
200 OK
POST /reset-errors Reset error counts for all RPC endpoints (debug)
Response
{ "status": "success", "message": "Error counts reset for all RPC endpoints", "timestamp": "2024-01-01T00:00:00.000Z" }
200 OK
GET /ws-status/local Local WebSocket connection status
Response
{ "activeConnections": 5, "connectionsByOrigin": { "https://thetanuts.finance": 3, "https://odette.fi": 2 }, "backendConnections": { "0": { "connected": true, "connectedAt": "2024-01-01T00:00:00.000Z" } }, "instanceId": "worker_abc123_1704067200000" }
200 OK
GET /ws-status Global WebSocket status across all instances
Response
{ "instances": [ { "instanceId": "worker_abc123_1704067200000", "activeConnections": 5, "lastUpdate": "2024-01-01T00:00:00.000Z", "status": "active" } ], "totalConnections": 5, "lastCleanup": "2024-01-01T00:00:00.000Z" }
200 OK
POST /* (RPC calls) Proxy for all Ethereum RPC calls
Request Body

Standard Ethereum JSON-RPC 2.0 format

{ "jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6", "latest"], "id": 1 }
Response
{ "jsonrpc": "2.0", "result": "0x0", "id": 1 }
200 OK 500 Internal Error

CORS Configuration

The following origins are whitelisted for CORS access: