# Web3Pi Reverse Proxy
A reverse proxy for Geth intended for use within Web3Pi ecosystem.
Web3Pi 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:
```bash
pip install web3pi-proxy
```
Web3Pi 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:
```bash
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
```bash
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](./admin/docs/screenshot_admin_example.jpg)
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/Web3-Pi/web3-reverse-proxy",
"name": "web3pi-proxy",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "web3pi, web3, rpi, raspberry, geth, ethereum, proxy",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/7d/eb/3cd73e90f8abc103fa7d7ee0265d3e201cdebe2815f39be62585649a2591/web3pi_proxy-0.3.tar.gz",
"platform": null,
"description": "# Web3Pi Reverse Proxy\n\nA reverse proxy for Geth intended for use within Web3Pi ecosystem.\n\nWeb3Pi Reverse Proxy comes out-of-the-box with several features:\n \n - Multiple geth nodes - you can hide multiple Geth nodes under single instance of reverse proxy\n - JSON-RPC parser - our custom parser validates JSON-RPC requests before they reach the nodes\n - Admin portal - comes embedded in, allowing you the following:\n\t- Authentication - generate API-keys and control access to your reverse proxy\n\t- User plans - control how much data users can process\n\t- Activity stats - see how much data each user processes, monitor node usage\n\t- Admin API - use JSON-RPC based API to perform various operations on your reverse proxy\n \n## Setup\n\nSimply install `web3pi-proxy` package using your Python package manager, using **pip** for example:\n\n```bash\npip install web3pi-proxy\n```\n\nWeb3Pi Reverse Proxy expects you to provide **ETH_ENDPOINTS** environment variable to your system.\n\nIt should be a list of endpoint descriptors for JSON-RPC over HTTP communication with Geth.\n\nRefer to the following example:\n\n```bash\nexport ETH_ENDPOINTS='[{\"name\": \"rpi geth 1\", \"url\": \"http://eop-1.local:8545/\"}, {\"name\": \"infura\", \"url\": \"https://mainnet.infura.io/v3/<YOUR_INFURA_API_KEY>\"}]'\n```\n\nYou can define as many endpoints as you wish and chose their names however suits you.\n\n## Run\n\nAfter configuring endpoints, you can run your reverse proxy with command\n\n```bash\nweb3pi-proxy\n```\n\n## Admin service\n\nAdmin service starts alongside the reverse proxy.\n\n\nYou can access admin webpage with your browser using admin server's URL and providing **admin auth token** as a 'token' query param, like so:\n\n```\nhttp://0.0.0.0:6561/?token=<ADMIN_AUTH_TOKEN>\n```\n\n### Reference Image\n\n![Admin Panel](./admin/docs/screenshot_admin_example.jpg)\n\n\nThe **admin auth token** will be output to your terminal, during the launch.\n\nToken is not stored and will be randomly generated on each launch.\n\nOutside of admin portal, the admin service allows several operations, performed by submitting JSON-RPC requests.\nUse **admin auth token** in **Authorization** header of your HTTP POST request for authentication.\n\n### get_endpoints\nGet list of currently configured endpoints, no parameters required.\n\n### add_endpoint\nAdd new endpoint at runtime by providing its **name** and **URL**. For example, in order to add endpoint ***local*** under URL ***localhost:8545*** :\n\n```\n{\"jsonrpc\": \"2.0\", \"method\": \"add_endpoint\", \"params\": [\"local\", \"http://localhost:8545/\"], \"id\": 0}\n```\n\n**IMPORTANT:** Resulting changes are saved in local `.env` file for reuse.\n\n### update_endpoint\nChange existing endpoint's configuration at runtime by providing its **name** and **URL**. For example, in order to change endpoint's ***local*** port to ***8546*** :\n\n```\n{\"jsonrpc\": \"2.0\", \"method\": \"update_endpoint\", \"params\": [\"local\", \"http://localhost:8546/\"], \"id\": 0}\n```\n\n**IMPORTANT:** Resulting changes are saved in local `.env` file for reuse.\n\n### remove_endpoint\nRemove endpoint at runtime by providing its **name**. For example, in order to remove endpoint ***local*** :\n\n```\n{\"jsonrpc\": \"2.0\", \"method\": \"update_endpoint\", \"params\": [\"local\"], \"id\": 0}\n```\n\n**IMPORTANT:** Resulting changes are saved in local `.env` file for reuse.\n",
"bugtrack_url": null,
"license": "GNU GENERAL PUBLIC LICENSE Version 3",
"summary": "A Web3 Pi Node Manager - proxy to Web3 Pi Ethereum nodes",
"version": "0.3",
"project_urls": {
"Homepage": "https://github.com/Web3-Pi/web3-reverse-proxy",
"Repository": "https://github.com/Web3-Pi/web3-reverse-proxy"
},
"split_keywords": [
"web3pi",
" web3",
" rpi",
" raspberry",
" geth",
" ethereum",
" proxy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "86c9dcd518e83e6d7d61d6dd36e0face0dcf6f8e475f2521ec307e1eb9bada13",
"md5": "643f2bf11ffb7fb722309117f9d41794",
"sha256": "50b51fe6d79ffed9fc5863d0bf53705d48978374df46866c3a21976264dc136d"
},
"downloads": -1,
"filename": "web3pi_proxy-0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "643f2bf11ffb7fb722309117f9d41794",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 97743,
"upload_time": "2024-08-10T13:35:48",
"upload_time_iso_8601": "2024-08-10T13:35:48.974713Z",
"url": "https://files.pythonhosted.org/packages/86/c9/dcd518e83e6d7d61d6dd36e0face0dcf6f8e475f2521ec307e1eb9bada13/web3pi_proxy-0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7deb3cd73e90f8abc103fa7d7ee0265d3e201cdebe2815f39be62585649a2591",
"md5": "805323be823c91bd96a4ad0866c2bb23",
"sha256": "7a6b6ef674a80c666f94152e42bd76bf68b5b1a51ce2027dfc3aa4a58f707063"
},
"downloads": -1,
"filename": "web3pi_proxy-0.3.tar.gz",
"has_sig": false,
"md5_digest": "805323be823c91bd96a4ad0866c2bb23",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 67146,
"upload_time": "2024-08-10T13:35:50",
"upload_time_iso_8601": "2024-08-10T13:35:50.786787Z",
"url": "https://files.pythonhosted.org/packages/7d/eb/3cd73e90f8abc103fa7d7ee0265d3e201cdebe2815f39be62585649a2591/web3pi_proxy-0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-10 13:35:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Web3-Pi",
"github_project": "web3-reverse-proxy",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "web3pi-proxy"
}