{"id":25817469,"url":"https://github.com/dodoex/web3-rpc-proxy","last_synced_at":"2025-02-28T06:36:45.550Z","repository":{"id":250650069,"uuid":"835042756","full_name":"DODOEX/web3-rpc-proxy","owner":"DODOEX","description":"A cluster-deployable proxy middleware for accessing EVM blockchains, designed to provide users with the highest quality 🌟, most stable 💪, and up-to-date block height 📈 proxy access. 🚀✨✨✨","archived":false,"fork":false,"pushed_at":"2024-09-10T04:07:46.000Z","size":1952,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-09-11T06:49:05.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DODOEX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-29T03:35:00.000Z","updated_at":"2024-09-04T16:53:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"a28f8479-6c7e-49fd-b473-c83c3429d39b","html_url":"https://github.com/DODOEX/web3-rpc-proxy","commit_stats":null,"previous_names":["dodoex/web3-rpc-proxy"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DODOEX%2Fweb3-rpc-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DODOEX%2Fweb3-rpc-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DODOEX%2Fweb3-rpc-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DODOEX%2Fweb3-rpc-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DODOEX","download_url":"https://codeload.github.com/DODOEX/web3-rpc-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241112756,"owners_count":19911753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-28T06:36:44.962Z","updated_at":"2025-02-28T06:36:45.542Z","avatar_url":"https://github.com/DODOEX.png","language":"Go","readme":"\u003cdiv align=\"center\" id=\"top\"\u003e\n\n\u0026#xa0;\n\n  \u003cimg alt=\"logo\" width=\"80\" height=\"80\" style=\"border-radius: 20px\" src=\"docs/icon.png\"/\u003e\n\u003c/div\u003e\n\u003ch1 align=\"center\"\u003eWeb3 RPC Proxy\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg alt=\"Go Version Badge\" src=\"https://img.shields.io/badge/Go-1.21-blue\"/\u003e\n  \u0026#xa0;\n  \u003ca href=\"https://app.codacy.com/gh/DODOEX/web3-rpc-proxy?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=DODOEX/web3-rpc-proxy\u0026utm_campaign=Badge_Grade\"\u003e\u003cimg alt=\"Codacy Badge\" src=\"https://api.codacy.com/project/badge/Grade/de013bb362a3436c9d1872bce5ab3c04\"/\u003e\u003c/a\u003e\n  \u0026#xa0;\n  \u003cimg alt=\"License Badge\" src=\"https://img.shields.io/github/license/DODOEX/web3-rpc-proxy.svg\"/\u003e\n  \u0026#xa0;\n  \u003cimg alt=\"Release Badge\" src=\"https://img.shields.io/github/release/DODOEX/web3-rpc-proxy\"/\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.producthunt.com/posts/web3-rpc-proxy?embed=true\u0026utm_source=badge-featured\u0026utm_medium=badge\u0026utm_souce=badge-web3\u0026#0045;rpc\u0026#0045;proxy\" target=\"_blank\"\u003e\u003cimg src=\"https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=486360\u0026theme=light\u0026size=small\" alt=\"web3\u0026#0045;rpc\u0026#0045;proxy - A\u0026#0032;cluster\u0026#0045;deployable\u0026#0032;EVM\u0026#0032;blockchains\u0026#0032;rpc\u0026#0032;proxy\u0026#0032;middleware | Product Hunt\" style=\"width: 250px; height: 54px;\" width=\"250\" height=\"54\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"docs/README_ZH.md\"\u003e中文\u003c/a\u003e\n  \u0026#xa0;|\u0026#xa0;\n  \u003ca href=\"README.md\"\u003eEnglish\u003c/a\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n## :dart: Introduction\n\nWeb3 RPC Proxy is a proxy middleware for accessing EVM blockchains that supports cluster deployment, designed to provide users with optimal, stable, and latest block height proxy access.\n\n\u003cbr\u003e\n\n## :sparkles: Features\n\n- :zap: High concurrency, fast access\n- :raised_hands: Combined with [web3-rpc-provider](https://github.com/DODOEX/web3-rpc-provider) to automatically load available free endpoints\n- :dizzy: Flexible support for multiple chains\n- :mag: Efficient endpoint selection\n- :construction_worker: Supports distributed deployment\n- :chart_with_upwards_trend: Comprehensive reporting support\n\n\u003cbr\u003e\n\n### Functionality\n\n- Tenant isolation\n- Multi-bucket rate limiting\n- Request result caching and reuse\n- WSS endpoint configuration\n- Dynamic endpoint configuration updates\n- JSON-RPC API schema validation\n- Alternating retries across multiple endpoints\n- Prometheus metrics\n- Grafana monitoring reports\n\n\u003cbr\u003e\n\n## :rocket: Deployment\n\n```bash\n# Build the docker image\n$ docker build ./Dockerfile -t dodozoo/web3-rpc-proxy:latest\n\n# Run the image\n$ docker run -p 8080:8080 -d dodozoo/web3-rpc-proxy:latest\n```\n\nOr\n\n```bash\n# Start the service using docker compose\n$ docker-compose up\n```\n\nModify system configuration using the following environment variables:\n\n- `WEB3RPCPROXY_APP_HOST` to set the service host and port, default is `0.0.0.0:8080`\n- `WEB3RPCPROXY_ETCD_CONFIG_ENDPOINTS` to set the ETCD endpoints\n- `WEB3RPCPROXY_ETCD_SETUP_CONFIG_FILE` to specify the system startup configuration path on ETCD\n- `WEB3RPCPROXY_ETCD_ENDPOINTS_CONFIG_FILE` to specify the endpoint configuration path on ETCD for each chain\n\n### Dependencies\n\n- PostgreSQL Depends on [the Tenant table](internal/database/schema/tenant.go)\n- Redis Used for distributed rate limiting of Tenant in the service\n- Amqp, optional After completion, the request information will be published to the mq\n\n### Grafana Reports\nImport [the Grafana template file](config/grafana.json)\n\n![Grafana1](docs/grafana1.jpg)\n![Grafana2](docs/grafana2.jpg)\n![Grafana3](docs/grafana3.png)\n\n\u003cbr\u003e\n\n## :bulb: Usage\nThe usage is straightforward, just make a JSON-RPC request to a specific chain.\n\n```bash\n$ curl --location --request POST 'https://localhost:8080/{{CHAIN}}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '[\n    {\n        \"jsonrpc\": \"2.0\",\n        \"id\": 1,\n        \"method\": \"net_version\",\n        \"params\": []\n    },\n    {\n        \"jsonrpc\": \"2.0\",\n        \"id\": 2,\n        \"method\": \"eth_blockNumber\",\n        \"params\": []\n    }\n]'\n```\n\n- `CHAIN`: Required Represents\n    the Chain ID or code of a specific blockchain, refer to the YAML configuration file below.\n### Request Parameters:\n- `x_api_key`: Required\n    The client must provide an API key when accessing the service, otherwise, it will be rejected with a 403 error. It can also be provided via the `X-API-KEY` header.\n- `x_api_bucket`: Optional\n    Allows the client to specify different buckets based on the situation, placing different values into different buckets for separate rate limiting. It can also be provided via the `X-API-BUCKET` header, such as using different chain IDs as bucket values to isolate rate limiting.\n- `cache`: Optional, default `true`\n    Whether to use cache, acceptable values are `true`, `false`\n- `timeout`: Optional, default `30000ms`\n    Timeout duration, if exceeded, the request returns a 408 error\n- `attempts`: Optional, default `3`\n    Maximum retry attempts, 0 means no retries\n- `attempt_strategy`: Optional, default `same`\n    The strategy for selecting endpoints during failure retries: `same` always retries the same endpoint, `rotation` alternates retries among available endpoints\n- `endpoint_type`: Optional, string, `default`\n    Specifies the type of endpoint to select: `default` automatically selects the most suitable endpoint type based on the request method, acceptable values are `fullnode`, `activenode`\n\nFor details on the JSON-RPC call body, see [JSON-RPC API METHODS](https://ethereum.org/en/developers/docs/apis/json-rpc/#json-rpc-methods)\n\n\u003cbr\u003e\n\n## :wrench: Configuration\nSee [the default configuration file](config/default.yaml)\n\n\u003cbr\u003e\n\n## :technologist: Development\n\n### Starting the Project\n```bash\n# Clone the project\n$ git clone https://github.com/DODOEX/web3-rpc-proxy\n\n# Navigate to the project directory\n$ cd web3-rpc-proxy\n\n# Install project dependencies\ngo mod download\n\n# Start the project\ngo run ./cmd/main.go\n```\n\n### Local Debugging\nAdd a configuration `config/local.yaml` in the directory to override `config/default.yaml` for local development and debugging.\n\n\u003e [!NOTE]\n\u003e The endpoint configuration for each chain should be written under the `endpoints` configuration item.\n\u003e See [the default configuration file](config/default.yaml)\n\n### Technology\nThe project uses the following technologies:\n\n- [Fasthttp](https://github.com/valyala/fasthttp)\n- [PostgreSQL](https://www.postgresql.org)\n\n\u003cbr\u003e\n\n### Architecture\n\n![architecture](docs/architecture.png)\n\n## :speech_balloon: FAQs\n\n- How to select an endpoint?\n    \u003e The endpoints are selected based on the nodes configured in WEB3RPCPROXY_ETCD_ENDPOINTS_CONFIG_FILE, and are chosen by sorting them according to their calculated scores.\n\n- What is the configuration priority?\n    \u003e The configuration priority is: local \u003c env \u003c etcd.\n    \n\u003cbr\u003e\n\n## :busts_in_silhouette: Contribute\nIf you want to contribute to the Web3 RPC Proxy project:\n\nFix issues: Find and fix issues in the project.\nWrite documentation: Improve and write relevant documentation for the project.\nWrite tests: Write and optimize test cases for the project.\n\nIf you want to show appreciation or support the continued development of the Web3 RPC Proxy project, you can do so by:\n\nGiving the project a GitHub Star. Supporting the project by donating a cup of tea.\n\n\u003cbr\u003e\n\n## :memo: License\nThis project is under license from MIT. For more details, see [the LICENSE file](LICENSE).\n\n\u0026#xa0;\n\n\u003cdiv align=\"center\"\u003e\u003ca href=\"#top\"\u003eBack to top\u003c/a\u003e\u003c/div\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdodoex%2Fweb3-rpc-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdodoex%2Fweb3-rpc-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdodoex%2Fweb3-rpc-proxy/lists"}