Context
The bot's heartbeat. Subscribes to newHeads over WebSocket and routes each new block into the scanning pipeline. Structured logging makes it grep-able (chain=bsc block=N) and Prometheus-ready for later.
Scope
charon-scanner/src/listener.rs with a BlockListener task
subscribe_blocks() via alloy's pub-sub provider
- Emits events into an
mpsc channel consumed by the rest of the pipeline
- Every received block logs structured fields:
chain, block, timestamp
- Code path is written for a single chain today but shaped so
tokio::select! across multiple chains is a drop-in later
Acceptance criteria
References
- PRD section 5c (Multi-Chain Listener Orchestration)
Context
The bot's heartbeat. Subscribes to
newHeadsover WebSocket and routes each new block into the scanning pipeline. Structured logging makes it grep-able (chain=bsc block=N) and Prometheus-ready for later.Scope
charon-scanner/src/listener.rswith aBlockListenertasksubscribe_blocks()via alloy's pub-sub providermpscchannel consumed by the rest of the pipelinechain,block,timestamptokio::select!across multiple chains is a drop-in laterAcceptance criteria
tokiotask without blockingmainINFOlevel, verbose atRUST_LOG=debugReferences