The Unstoppable RPC Endpoint: Aggregating RPC endpoints for improved availability, low latency, and enhanced security. Open source and accessible to all DApp projects.
Solution is based on Cloudflare Workers, using Cloudflare KV Storage plugin and Cloudflare Caching API.
- Install npm and yarn locally
- Create Cloudflare account
- Install dependencies
yarn install
- Login into wrangler locally
yarn run wrangler login
- Create KV namespace in Cloudflare KV
- for development create preview KV
yarn run wrangler kv:namespace create CONFIG_KV --preview
- for production create regular KV
yarn run wrangler kv:namespace create CONFIG_KV
add config from console output into wrangler.toml
file, example:
- dev:
kv_namespaces = [
{ binding = "CONFIG_KV", preview_id = "PREVIEW_ID" }
]
- prod:
kv_namespaces = [
{ binding = "CONFIG_KV", id = "ID" },
]
- Prepare node list data with your list of endpoints
Example and structure could be found in node-config-example.json
Tips:
- you can specify coordinates of node to get geo routing benefits and minimize latency
- this info could be extracted from IP by external services such IP Info
- Enter node list data into created KV namespace
- go to Cloudflare UI -> Workers KV page
- select your created namespace
- create new item(entry) into namespace
- key -
origins
- value - valid JSON as array, example could be found in node-config-example.json.
- key -
- Make sure KV namespace is created and node list is configured
- Run web server locally
yarn run wrangler dev
- Make sure KV namespace is created and node list is configured
- Publish worker code to Cloudflare Workers
yarn run wrangler publish
The project was done for ETH Belgrade hackathon 2023
Team members: