|
| 1 | +!!! info "Content disclaimer" |
| 2 | + |
| 3 | + Please view the third-party content disclaimer [here](https://github.com/0xPolygon/polygon-docs/blob/main/CONTENT_DISCLAIMER.md). |
| 4 | + |
| 5 | + |
| 6 | +# Polygon RPC Proxy and Caching |
| 7 | + |
| 8 | +[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. |
| 9 | + |
| 10 | +- [github](https://github.com/erpc/erpc)<br/> |
| 11 | +- [docs](https://docs.erpc.cloud/)<br/> |
| 12 | +- [telegram](https://t.me/erpc_cloud)<br/> |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +<br /> |
| 17 | + |
| 18 | +# Quickstart |
| 19 | + |
| 20 | +1. Create your [`erpc.yaml`](https://docs.erpc.cloud/config/example) configuration file: |
| 21 | +```yaml title="erpc.yaml" |
| 22 | +logLevel: debug |
| 23 | +projects: |
| 24 | + - id: main |
| 25 | + upstreams: |
| 26 | + # You don't need to define architecture (e.g. evm) or chain id (e.g. 137) |
| 27 | + # as they will be detected automatically by eRPC. |
| 28 | + - endpoint: https://polygon-mainnet.blastapi.io/xxxx |
| 29 | + - endpoint: evm+alchemy://xxxx-my-alchemy-api-key-xxxx |
| 30 | +``` |
| 31 | + See [a complete config example](https://docs.erpc.cloud/config/example) for inspiration. |
| 32 | +
|
| 33 | +2. Use the Docker image: |
| 34 | +```bash |
| 35 | +docker run -v $(pwd)/erpc.yaml:/root/erpc.yaml -p 4000:4000 -p 4001:4001 ghcr.io/erpc/erpc:latest |
| 36 | +``` |
| 37 | + |
| 38 | +3. Send your first request: |
| 39 | +```bash |
| 40 | +curl --location 'http://localhost:4000/main/evm/137' \ |
| 41 | +--header 'Content-Type: application/json' \ |
| 42 | +--data '{ |
| 43 | + "method": "eth_getBlockByNumber", |
| 44 | + "params": [ |
| 45 | + "0x397f96e", |
| 46 | + false |
| 47 | + ], |
| 48 | + "id": 9199, |
| 49 | + "jsonrpc": "2.0" |
| 50 | +}' |
| 51 | +``` |
| 52 | + |
| 53 | +4. Bring up monitoring stack (Prometheus, Grafana) using `docker-compose`: |
| 54 | +```bash |
| 55 | +# clone the repo if you haven't |
| 56 | +git clone https://github.com/erpc/erpc.git |
| 57 | +cd erpc |
| 58 | + |
| 59 | +# bring up the monitoring stack |
| 60 | +docker-compose up -d |
| 61 | +``` |
| 62 | + |
| 63 | +5. Open Grafana at [http://localhost:3000](http://localhost:3000) and login with the following credentials: |
| 64 | + ```text |
| 65 | + username: admin |
| 66 | + password: admin |
| 67 | + ``` |
| 68 | + |
| 69 | +6. Send more requests and watch the metrics being collected and visualized in Grafana. |
| 70 | + |
| 71 | + |
0 commit comments