|
| 1 | +# Polygon RPC Proxy and Caching |
| 2 | + |
| 3 | +[eRPC](https://erpc.cloud/) is a fault-tolerant EVM RPC proxy and re-org aware permanent caching solution. It is built with read-heavy use-cases in mind such as data indexing and high-load frontend usage. |
| 4 | + |
| 5 | +- [github](https://github.com/erpc/erpc)<br/> |
| 6 | +- [docs](https://docs.erpc.cloud/)<br/> |
| 7 | +- [telegram](https://t.me/erpc_cloud)<br/> |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +<br /> |
| 12 | + |
| 13 | +# Features |
| 14 | + |
| 15 | +✅ **Fault-tolerant Proxy**: Retries, circuit-breakers, failovers and hedged requests make sure fastest most-reliable upstream is used. <br/><br/> |
| 16 | +✅ **Flexible Rate-limiters**: Define hourly, daily rate limits for each upstream provider, to control usage, costs and high-scale usage.<br/><br/> |
| 17 | +✅ **Permanent Caching**: Avoid redundant upstream costs by locally caching RPC responses, with reorg-aware caching layer.<br/><br/> |
| 18 | +✅ **Request Auto-routing**: You don't need to think about which upstream supports which eth\_\* method; eRPC automatically does that.<br/><br/> |
| 19 | +✅ **Normalized Errors**: Receive consistent error codes with details across 5+ third-party providers. With useful reporting of occurred errors.<br/><br/> |
| 20 | +✅ **RPC Metrics & Observability**: Single dashboard to observe rps throughput, errors, and avg. latency of all your RPC providers.<br/><br/> |
| 21 | + |
| 22 | +# Quick start |
| 23 | + |
| 24 | +1. Create your [`erpc.yaml`](https://docs.erpc.cloud/config/example) configuration file based on the [`erpc.yaml.dist`](https://github.com/erpc/erpc/blob/main/erpc.yaml.dist) file: |
| 25 | + |
| 26 | +```bash |
| 27 | +cp erpc.yaml.dist erpc.yaml |
| 28 | +code erpc.yaml |
| 29 | +``` |
| 30 | + |
| 31 | +See [a complete config example](https://docs.erpc.cloud/config/example) for inspiration. |
| 32 | + |
| 33 | +2. Use the Docker image: |
| 34 | + |
| 35 | +```bash |
| 36 | +docker run -v $(pwd)/erpc.yaml:/root/erpc.yaml -p 4000:4000 -p 4001:4001 ghcr.io/erpc/erpc:latest |
| 37 | +``` |
| 38 | + |
| 39 | +3. Send your first request: |
| 40 | + |
| 41 | +```bash |
| 42 | +curl --location 'http://localhost:4000/main/evm/137' \ |
| 43 | +--header 'Content-Type: application/json' \ |
| 44 | +--data '{ |
| 45 | + "method": "eth_getBlockByNumber", |
| 46 | + "params": [ |
| 47 | + "0x3948796", |
| 48 | + false |
| 49 | + ], |
| 50 | + "id": 9199, |
| 51 | + "jsonrpc": "2.0" |
| 52 | +}' |
| 53 | +``` |
| 54 | + |
| 55 | +4. Bring up monitoring stack (Prometheus, Grafana) using docker-compose: |
| 56 | + |
| 57 | +```bash |
| 58 | +# clone the repo if you haven't |
| 59 | +git clone https://github.com/erpc/erpc.git |
| 60 | +cd erpc |
| 61 | + |
| 62 | +# bring up the monitoring stack |
| 63 | +docker-compose up -d |
| 64 | +``` |
| 65 | + |
| 66 | +5. Open Grafana at [http://localhost:3000](http://localhost:3000) and login with the following credentials: |
| 67 | + |
| 68 | +- username: `admin` |
| 69 | +- password: `admin` |
| 70 | + |
| 71 | +6. Send more requests and watch the metrics being collected and visualized in Grafana. |
| 72 | + |
| 73 | + |
0 commit comments