nick199910 / cached-eth-rpc

A simple http server to cache specific eth rpc requests in memory.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ETH RPC Cache Layer

A simple http server to cache specific eth rpc requests in memory. Useful for massive repeatedly requests to ETH rpc endpoints. Multiple endpoints/chains can be configured to be cached.

Usage (with docker)

  1. Edit docker-compose.yml

  2. docker-compose up

Usage

redis-url is optional

cargo run --release -- \
  --port=8124 \
  --bind=0.0.0.0 \
  --endpoint=eth=https://rpc.ankr.com/eth \
  --endpoint=bsc=https://rpc.ankr.com/bsc \
  --redis-url=redis://localhost:6379

Following redirection will be made:

Supported methods

Mainly supported requests with determined block number. Other methods will be directly send to the configured ETH rpc endpoint.

  • eth_call

  • eth_chainId

  • eth_estimateGas

  • eth_getBalance

  • eth_getBlockByHash

  • eth_getBlockByNumber

  • eth_getBlockReceipts

  • eth_getCode

  • eth_getLogs

  • eth_getStorageAt

  • eth_getTransactionByBlockHashAndIndex

  • eth_getTransactionByBlockNumberAndIndex

  • eth_getTransactionByHash

  • eth_getTransactionCount

  • eth_getTransactionReceipt

  • debug_traceBlockByHash

  • debug_traceBlockByNumber

  • debug_traceCall

  • debug_traceTransaction

About

A simple http server to cache specific eth rpc requests in memory.


Languages

Language:Rust 98.9%Language:Dockerfile 1.1%