ethscriptions-indexer v0.1.0
blobscriptions indexer
Ethscriptions indexer only for Blob-created ethscriptions, ESIP-8
How it works?
In src/indexing.ts we have trackBlobscriptions function, in future maybe the rest of the
Ethscriptions indexer. In it we use Viem's watchBlocks method to listen on blocks and track only
EIP-4844 (Blobs) transactions that has data: calldata (gzipped or not). Optionally you can track
all overall blob transactions, not only blobscription ones, by passing onlyBlobscriptions: false
to the trackBlobscriptions options. Then a the handler function passed to the
trackBlobscriptions is called in turn which is passed the transaction and block details.
In the trackBlobscriptions we DO NOT parse, process or validate the actual blob contents, we
don't even have it there. For how it can be done check exampleBlobProcessor function in the
src/main.ts we do it inside the handler we pass to trackBlobscriptions.
The idea is that you can do that on the handler you pass, once you are sure that the there's blobscription transaction.
Currently, src/main.ts has trackBlobscriptions handler function that just sends the data to a
given Webhook URL.
Deploy
Currently, I use Fly.io, which runs the src/main.ts with Bun
(a JavaScript/TypeScript runtime). And there is one server deployed at
https://deno-fly-viem-eths-indexer.fly.dev that is listening on mainnet and sending webhooks to
https://webhook.site/9392df98-49f1-407c-8531-6a7190e22e1f
If you want to deploy your own, you should:
- Register on Fly.io, install their CLI and login through there
- Register on GetBlock.io to get an RPC node url that support blob transactions
- In the ENV file you can pass your
RPC_URL,WEBHOOK_URLandINDEX_CHAIN_ID - Populate the environment variables in
.env.example, copy it to.env - Run
fly launch --yes --copy-config --name your-indexer-name(only the first time, thenfly deploy) - then run
npm run env:populate - Deploy using
fly deploy(you may need to update the Dockerfile/fly.tom)
In a bit I'll deploy a Cloudflare Worker that receives these webhooks, does the blob parsing and processing, and then re-distribute to registered webhooks (eg. you would be able to just give me a Webhook url).
Blobbed.xyz will receive the finalized stuff so it will show it in the site.
Example Creating blobs
Check out the create-blob-example.ts file.
If you don't want to deploy or anything, but just want to try create a BlobScription then you still need:
- to get RPC from GetBlock.io and put
RPC_URLin the.envfile - switch the
INDEX_CHAIN_IDto1 - add
CREATOR_PRIVATE_KEYand make sure this wallet has some funds (~5-10$), otherwise it won't be able to create a blobscription transaction - Run
bun run create-blob-example.ts
This way you'll use the currently deployed indexer and APIs (on blobbed.xyz).
2 years ago