This is a small Go indexer that fetches Ethereum event logs for a single
contract/topic on Sepolia, enriches them with block headers, and persists
compact records into a local bbolt database (indexer.db).
How to run it
Prereqs:
Go 1.25.6 (see go.mod)
Network access to Sepolia RPCs
Local:
go run .
go run . --print (prints up to 10 records after ingest)
Makefile shortcuts:
make run
make run-print
make test
Docker:
make docker-build
make docker-run
make docker-run-print
Notes:
The database is created at ./indexer.db.
The Docker run targets mount the repo as /data so indexer.db persists
on your host.
Design / architecture notes
Core flow:
main.go builds a worker list from configured RPC endpoints.
indexer.New(...) resolves the target contract/topic and the block range.
The indexer splits the range into fixed-size chunks and feeds them to
worker goroutines.
Each worker calls FetchLogs, sorts logs by block/log index, loads headers,
and emits Record slices on a channel.
The store consumes ordered blocks and persists records to bbolt.
Concurrency:
Workers run in goroutines and pull ranges from a channel.
The store consumes a channel of record slices and commits in order.