https://github.com/requestnetwork/json-rpc-proxy
JSON-RPC caching proxy built with OpenResty
https://github.com/requestnetwork/json-rpc-proxy
Last synced: 6 months ago
JSON representation
JSON-RPC caching proxy built with OpenResty
- Host: GitHub
- URL: https://github.com/requestnetwork/json-rpc-proxy
- Owner: RequestNetwork
- License: mit
- Created: 2020-09-14T10:11:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-17T07:40:25.000Z (about 5 years ago)
- Last Synced: 2025-07-01T20:51:25.106Z (8 months ago)
- Language: Dockerfile
- Homepage:
- Size: 20.5 KB
- Stars: 7
- Watchers: 3
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JSON RPC Cache Proxy
This repo contains an Open-Resty caching proxy for JSON-RPC requests.
It caches JSON-RPC requests based on URI and the JSON-RPC `method` and `params` fields.
## Prerequisites
To build and run this project you need [docker](https://www.docker.com/) installed and running on your machine.
## Build
To build the docker image, go to the root directory of this repository and run:
```sh
docker build -t json-rpc-proxy .
```
## Run
To run the docker image, you can run the following command:
```sh
docker run --env "ADDRESS=rinkeby.infura.io" --env "CACHE_TIME=5s" -p 8080:80 json-rpc-proxy
```
Where:
* __ADDRESS__: is the address of the JSON RPC destination.
* __CACHE_TIME__: is the cache TTL (time to live)
## Use
In our example started at the Run step, to get the latest Rinkeby block number we can do:
```sh
curl http://localhost:8080/v3/ \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params": [],"id":1}