Just wanted to share a quick guide on how to set up your own serverless on-chain monitoring tool using Cloudflare Workers.
1. Setting Things Up
First, go to Cloudflare and create a new Worker.
You’ve got two ways to deploy it:
- Use Wrangler (CLI) if you’re experienced.
- Or just copy and paste the script directly into Cloudflare’s web editor, way easier for most.
2. Connecting to the Chain (RPC)
You’ll need to connect to the blockchain.
- Look for an RPC provider (you can grab a free one, but having a paid option as a backup is a smart move).
- In your Cloudflare settings, set up Secret Variables: MY_RPC_URL (for main) and MY_RPC_URL2 (for backup).
3. Data Collection
To gather and parse extra data, we can use Blockscout’s free tier or etherscan.
- Sign up for Blockscout or etherscan.
- Generate an API Key.
- Add it to your Cloudflare Secret Variables as: BLOCKSCOUT_API_KEY.
4. The Script
I’ve made the worker script open-source. It takes care of request routing and API calls on its own.
Check out the code here: 🔗 https://github.com/nesia26/severless-EVMexplorer/blob/main/worker.js
Demos:
Ethereum Explorer: https://etherscan-lite.iqbal.sbs/
Base Explorer: https://baseplorer.iqbal.sbs/
Creating a Serverless EVM Explorer for ETH and Base
0 replies 389 views