Skip to content

Commit 66153ac

Browse files
authored
Merge pull request 0xPolygon#636 from kasrakhosravi/main
docs: erpc
2 parents 4fbfc2a + ffc2923 commit 66153ac

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
![Architecture](https://github.com/erpc/erpc/raw/main/assets/hla-diagram.svg)
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+
![eRPC Grafana Dashboard](https://docs.erpc.cloud/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmonitoring-example-erpc.2cb040a1.png&w=3840&q=75)

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ nav:
424424
- Chain indexer framework:
425425
- Overview: tools/chain-indexer-framework/overview.md
426426
- Usage: tools/chain-indexer-framework/usage.md
427+
- RPC Proxy:
428+
- eRPC: tools/rpc-proxy-caching/erpc.md
427429
- Data:
428430
- Alchemy subgraphs: https://docs.alchemy.com/docs/how-to-build-and-deploy-a-subgraph-on-polygon-zkevm-using-alchemy-subgraphs
429431
- Covalent: tools/data/covalent.md

0 commit comments

Comments
 (0)