Skip to main content

RPC Reverse Proxy - proxy to Web3 Pi Ethereum nodes

Project description

RPC Reverse Proxy

A reverse proxy for Geth intended for use within Web3Pi ecosystem.

RPC Reverse Proxy comes out-of-the-box with several features:

  • Multiple geth nodes - you can hide multiple Geth nodes under single instance of reverse proxy
  • JSON-RPC parser - our custom parser validates JSON-RPC requests before they reach the nodes
  • Admin portal - comes embedded in, allowing you the following:
    • Authentication - generate API-keys and control access to your reverse proxy
    • User plans - control how much data users can process
    • Activity stats - see how much data each user processes, monitor node usage
    • Admin API - use JSON-RPC based API to perform various operations on your reverse proxy

Setup

Simply install web3pi-proxy package using your Python package manager, using pip for example:

pip install web3pi-proxy

RPC Reverse Proxy expects you to provide ETH_ENDPOINTS environment variable to your system.

It should be a list of endpoint descriptors for JSON-RPC over HTTP communication with Geth.

Refer to the following example:

export ETH_ENDPOINTS='[{"name": "rpi geth 1", "url": "http://eop-1.local:8545/"}, {"name": "infura", "url": "https://mainnet.infura.io/v3/<YOUR_INFURA_API_KEY>"}]'

You can define as many endpoints as you wish and chose their names however suits you.

Run

After configuring endpoints, you can run your reverse proxy with command

web3pi-proxy

Admin service

Admin service starts alongside the reverse proxy.

You can access admin webpage with your browser using admin server's URL and providing admin auth token as a 'token' query param, like so:

http://0.0.0.0:6561/?token=<ADMIN_AUTH_TOKEN>

Reference Image

Admin Panel

The admin auth token will be output to your terminal, during the launch.

Token is not stored and will be randomly generated on each launch.

Outside of admin portal, the admin service allows several operations, performed by submitting JSON-RPC requests. Use admin auth token in Authorization header of your HTTP POST request for authentication.

get_endpoints

Get list of currently configured endpoints, no parameters required.

add_endpoint

Add new endpoint at runtime by providing its name and URL. For example, in order to add endpoint local under URL localhost:8545 :

{"jsonrpc": "2.0", "method": "add_endpoint", "params": ["local", "http://localhost:8545/"], "id": 0}

IMPORTANT: Resulting changes are saved in local .env file for reuse.

update_endpoint

Change existing endpoint's configuration at runtime by providing its name and URL. For example, in order to change endpoint's local port to 8546 :

{"jsonrpc": "2.0", "method": "update_endpoint", "params": ["local", "http://localhost:8546/"], "id": 0}

IMPORTANT: Resulting changes are saved in local .env file for reuse.

remove_endpoint

Remove endpoint at runtime by providing its name. For example, in order to remove endpoint local :

{"jsonrpc": "2.0", "method": "update_endpoint", "params": ["local"], "id": 0}

IMPORTANT: Resulting changes are saved in local .env file for reuse.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

web3pi_proxy-0.4.tar.gz (68.5 kB view details)

Uploaded Source

Built Distribution

web3pi_proxy-0.4-py3-none-any.whl (99.1 kB view details)

Uploaded Python 3

File details

Details for the file web3pi_proxy-0.4.tar.gz.

File metadata

  • Download URL: web3pi_proxy-0.4.tar.gz
  • Upload date:
  • Size: 68.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-40-generic

File hashes

Hashes for web3pi_proxy-0.4.tar.gz
Algorithm Hash digest
SHA256 f7275f5ec2d4820eb2273e12b3772f73eead12c0ef92590501a774844d5a6b95
MD5 b8550c14f91254b56739105445cd02af
BLAKE2b-256 c12ca93fc51d0724276d9385f2eee4e418ee38c3494de5bd7922ddb36cfb0d5d

See more details on using hashes here.

File details

Details for the file web3pi_proxy-0.4-py3-none-any.whl.

File metadata

  • Download URL: web3pi_proxy-0.4-py3-none-any.whl
  • Upload date:
  • Size: 99.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.8.0-40-generic

File hashes

Hashes for web3pi_proxy-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b0fa765a0b9e9bcacd5574e91c0dfd9ae02150f52e76f9ae096021293775eb7b
MD5 f720082c53f9205dae906a00745414d1
BLAKE2b-256 c56823d1a9c593d5917df1e2d72f48a267d50d0534d61686d2fdd321a7e197a8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page