Skip to content

block-wallet/eth-proxy

 
 

Repository files navigation

eth-proxy

Simple proxy for ethereum nodes to handle the authentication and endpoints. It exposes the '/' for RPC and optionally '/ws' for web sockets. Also it adds a customizable endpoint called "/status" used as a health check to know if the nodes was rate limited by sending a POST with a node method (ideally that doesn't consume compute units). The proxy adds Authorization header to all RPC/WS requests (optional).

Usage

  1. Install Docker.
  2. Spin up eth-proxy docker container:
    # RPC_ENDPOINT - RPC endpoint of the node deployed on Chainstack.
    # WS_ENDPOINT - WebSocket endpoint of the node deployed on Chainstack.
    # ENDPOINT - If the WS and RPC endpoints are the same you can use this variable.
    # USERNAME, PASSWORD - [optional] basic auth credentials to access the node deployed on Chainstack.
    
    # DNS: DNS host.
    # PORT: The proxy will listen to this port.
    # WS: flag in "YES" to enable a /ws endpoint allowing web sockets
    # STATUS_METHOD: node method to check if the node was rate limited or not.
    
  3. Use proxy to send requests to the node:
    curl 'http://localhost:8545' -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0","method": "eth_blockNumber","params": [],"id": 83}'
    

Packages

No packages published

Languages

  • Shell 87.9%
  • Dockerfile 12.1%