{"id":16751196,"url":"https://github.com/shalzz/ethereum-worker","last_synced_at":"2025-03-21T22:32:08.380Z","repository":{"id":41715889,"uuid":"239810145","full_name":"shalzz/ethereum-worker","owner":"shalzz","description":"A caching layer for an ethereum node using Cloudflares CDN and Cloudflare workers","archived":false,"fork":false,"pushed_at":"2023-03-07T13:59:09.000Z","size":1056,"stargazers_count":37,"open_issues_count":13,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T05:51:13.641Z","etag":null,"topics":["argo-tunnel","cache","cloudflare-eth","cloudflare-workers","ethereum","ethereum-gateway","ethereum-node","ethereum-node-api","geth-node","infura","json-rpc","workers"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shalzz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"shalzz"}},"created_at":"2020-02-11T16:29:51.000Z","updated_at":"2025-01-09T11:12:23.000Z","dependencies_parsed_at":"2024-10-28T11:38:52.928Z","dependency_job_id":"b7a8e809-1c21-4541-b861-99a1800821bf","html_url":"https://github.com/shalzz/ethereum-worker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalzz%2Fethereum-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalzz%2Fethereum-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalzz%2Fethereum-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalzz%2Fethereum-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shalzz","download_url":"https://codeload.github.com/shalzz/ethereum-worker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244880443,"owners_count":20525507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argo-tunnel","cache","cloudflare-eth","cloudflare-workers","ethereum","ethereum-gateway","ethereum-node","ethereum-node-api","geth-node","infura","json-rpc","workers"],"created_at":"2024-10-13T02:43:16.567Z","updated_at":"2025-03-21T22:32:08.100Z","avatar_url":"https://github.com/shalzz.png","language":"TypeScript","funding_links":["https://github.com/sponsors/shalzz"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n  \u003ch1\u003eEthereum worker\u003c/h1\u003e\n  \u003cstrong\u003eRun your own Ethereum node with CDN caching on a Raspberry Pi or the cloud\u003c/strong\u003e\n\n\u003c/div\u003e\n\n## About\n\nA scaling solution for Ethereum nodes by caching responses using Clouldflares\ntechnologies like Argo tunnels and Cloudflare workers.\n\nThis is very similar to the official Cloudflare Ethereum Gateway service\nprovided by Cloudflare [here][1] but allows you to run and configure your own geth\nor parity node and put it behind a global edge computing network with robust caching\nfacilities.\n\n## Philosophy\n\nWith the immutable property of blockchains and a block based model it is easier\nto aggressively cache a response without worrying about invalidating a cache on updates/writes\nwithin a block rather than indexing individual transactions and blocks to store\nin a database which are unlikely to change save for the latest few blocks\n(80-100 for ethereum) to account for a chain re-org.\n\nWhich is why we, among others like Cloudflares Ethereum Gateway service, have decided to go with\nthis approach.\n\n## Demo\n\nWe have a demo worker running that you can use to quickly try out how it works at:\nhttps://ethereum-worker.8bitlabs.workers.dev\n\nFor example, query the `web3_clientVersion` using curl\n```\n$ curl -d '{\"method\":\"web3_clientVersion\",\"params\":[],\"id\":1,\"jsonrpc\":\"2.0\"}' https://ethereum-worker.8bitlabs.workers.dev\n```\n\n## Try it for free\n\nCloudflare provides free modes of both the services we will be using.\n\n* [Free Argo tunnels][2]\n* [Free workers with worker.dev][3]\n\n## Install\n\nTo deploy a Cloudflare worker we need to install the `wrangler` CLI tool from\nCloudflare. Follow the instructions here to [install][4] it on your machine.\n\nOnce you have `wrangler` installed, create a Cloudflare account if you haven't already\nand configure `wrangler` with your account using\n\n```\nwrangler config\n```\n\nYou'll need to\nprovide your email associated with your account and your Global API Key.\n\nFor help on how to create an API key see this [support article][5].\nIt is possible to use a scope limited API key for this but it is not well documented\nand you will have to do some trial and error to get it working.\n\nBefore we can publish our worker to enable us to serve cached responses for the\nsame kinds of requests we need to specify the `ORIGIN_URL` which points to the server where we have our Ethereum node running.\n\nThe `ORIGIN_URL` can be the IP address of our server with the port specified\nlistening for RPC requests or it can be a load balancer domain name. But with\nCloudflare workers an Argo tunnel is recommended since they work well together\nand are optimised for each other with the added benefit of Argo tunnels being cheaper\ncompare to the prices usually charged by major cloud providers for a load balancer.\n\nIf you don't already have a Ethereum client running see [below][6] for helm charts that\ncan help you get one running. If you have a client running and just want to setup\nan Argo tunnel see official docs [here][7].\n\nTo change the `ORIGIN_URL` edit the `wrangler.toml` file and specify the URL as an environment variable.\n\n```\nvars = { ORIGIN_URL = \"https://url-pointing-to-my-ethereum-node.com\"}\n```\n\nNow we are ready to publish. Make sure we have `workers_dev = true` set so that\nwe only use the free workers tier plan.\n\n## Write Specific Endpoint\n\nOptionally you can specify a separate endpoint to use for write operations,\nfor example the flashbots RPC endpoint.\n\nTo do so, specify a `WRITE_URL` var in your `wrangler.toml` file\n\n```\nvars = { ORIGIN_URL = \"https://url-pointing-to-my-ethereum-node.com\", WRITE_URL = \"https://rpc.flashbots.net\" }\n```\n\n## Publish\n\nTo publish all we need to do now it run the command\n\n```\nwrangler publish\n```\n\nAnd if everything went well you should now see a workers.dev URL that you can use\nto query your web3 JSON-RPC requests utilizing the CDN and edge computing\ncapabilities of the Cloudflare network!\n\n## Helm Charts\n\nIf you are looking to quickly deploy an Ethereum client with Argo tunnels setup,\nwe provide Helm Charts for deploying the Ethereum  clients `geth` and `parity`\nto a Kubernetes clusters with a Argo tunnel running as a side car model.\n\nSee the `helm-chart` folder and chart specific `README.md` for more details.\n\n\n[1]: https://cloudflare-eth.com\n[2]: https://developers.cloudflare.com/argo-tunnel/trycloudflare/\n[3]: https://developers.cloudflare.com/workers/quickstart#publish-to-workers-dev\n[4]: https://developers.cloudflare.com/workers/tooling/wrangler/install/\n[5]: https://support.cloudflare.com/hc/en-us/articles/200167836-Managing-API-Tokens-and-Keys\n[6]: #helm-charts\n[7]: https://developers.cloudflare.com/argo-tunnel/quickstart/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalzz%2Fethereum-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshalzz%2Fethereum-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalzz%2Fethereum-worker/lists"}