Skip to content

๐ŸŒ Proxying and caching web3 requests with Cloudflare workers

License

Notifications You must be signed in to change notification settings

AudiusProject/web3-provider-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Web3 Provider Proxy

A starting point for proxying and caching excessive web3 requests with Cloudflare workers

๐Ÿ™‹ โ‡ฐ ๐ŸŒ๐ŸŒŽ๐ŸŒ โ‡ฐ โ›“

Why would I need this?

At Audius, we've found it to be useful to be able to proxy and cache requets to web3 providers.

  1. Reliance on a single web3 provider has proven to be a dangerous single point of failure.

  2. Different users frequently read the same data from chain, which is both expensive and inefficient.

  3. Leaking your API keys for paid providers isnโ€™t great when theyโ€™re hard-coded in your client / DApp

This repo is the cloudflare worker we use to give us flexible caching functionality and a extremely minimal & non-opinionated fashion.

This is an entry-point! Not all-in solution & we welcome all forking / tweaking / contributing as such tools might meet your use-cases.

How do I use this?

  1. You'll need a Cloudflare account set up with workers enabled to get going. See Cloudflare's docs to get started.

  2. Clone or fork this repo!

  3. cp wrangler-template.toml wrangler.toml

    and replace the relevant environment variables you'd like to use. The import variables you'll want to pay attention to are

account_id: from your Cloudflare workers account
zone_id: from your Cloudflare workers account
name: what you'd like your worker to be called

PROVIDERS: an array of web3 providers you'd like to use
  1. Deploy your worker
wrangler publish
  1. You'll then want to set up a DNS record pointing to your workers site.

Image of DNS

And of course the 100:: is a dummy address per the docs

  1. Update your client to send requests to your new provider!

About

๐ŸŒ Proxying and caching web3 requests with Cloudflare workers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published