How u2u-labs/event-pool works
Project type and purpose
• This is a full-blown blockchain node / event-pool service written in Go. It combines:
• A CLI (Cobra) for on-chain operations and secret management
• A long-running server exposing gRPC/HTTP/WebSocket APIs
• Core blockchain sub-systems (P2P networking, consensus, state, txpool, block sync)
• An “Event Pool” feature that listens for smart-contract events, persists them, backfills history, and pushes them to clients in real time via WebSocket.
File structure
Top-level directories map to architectural layers:
• cmd/ → CLI entrypoints and commands (serve, secrets, output, etc.)
• server/ → The HTTP/gRPC/WebSocket server, system services, metrics
• internal/ → Core application logic (config loading, DB access, listener, worker, monitor)
• blockchain/, chain/, consensus/, network/, state/, txpool/, syncer/ → Underlying blockchain engine sub-systems
• pkg/ → Reusable packages (e.g. Ethereum client, MQTT, gRPC server helpers)
• prisma/ → Database schema/migrations for PostgreSQL
• secrets/ → Key/secret management APIs
• helper/ → Utility libraries (hex, keccak, keystore, progress bars, test helpers)
• data/ → Local test keys for P2P, consensus
• go.mod, Dockerfile, docker-compose.yaml → Build, containerization, orchestration
README for additional insights
• Purpose: “Event Pool” – listens to smart-contract events on supported L1 chains, stores them (PostgreSQL), publishes in real time (WebSocket + Redis pub/sub), supports historical backfill.
• Tech stack calls out: Go, Cobra, Viper, Prisma, go-ethereum, asynq (background jobs), WebSocket, Redis, PostgreSQL, Ethereum RPC.
• Configuration via config.yaml (server, database, redis, ethereum, websocket, asynq).
• Endpoints: HTTP API for chain/contract registration, WebSocket subscriptions, background job processing.