Skip to content

docs(flashblocks): add real-time transaction monitor cookbook#1301

Open
erhnysr wants to merge 1 commit intobase:masterfrom
erhnysr:feat/flashblocks-transaction-monitor-cookbook
Open

docs(flashblocks): add real-time transaction monitor cookbook#1301
erhnysr wants to merge 1 commit intobase:masterfrom
erhnysr:feat/flashblocks-transaction-monitor-cookbook

Conversation

@erhnysr
Copy link
Copy Markdown

@erhnysr erhnysr commented Apr 13, 2026

Summary

The existing Flashblocks documentation covers RPC integration (viem, wagmi, ethers.js) but has no end-to-end example for the WebSocket streaming path. This PR adds a new cookbook page that walks through building a complete, production-ready transaction monitor.

New file

docs/base-chain/flashblocks/transaction-monitor.mdx

What it covers

  • Project setup — TypeScript, ws package, tsconfig.json
  • Brotli decompression — explains why messages are compressed and how to decode them
  • Typed interfacesFlashblock, FlashblockTx, FlashblockReceipt
  • Address watcher — monitors incoming/outgoing transactions with preconfirmation status (success / reverted / preconfirmed)
  • Auto-reconnect — exponential backoff (1s → 30s) for production resilience
  • Fallback — graceful degradation to standard RPC via viem when Flashblocks is unavailable
  • Expected output — shows exactly what the running monitor prints

Relationship to existing docs

This page complements app-integration.mdx (RPC usage) by covering the WebSocket path end-to-end with a complete runnable example. The two pages cross-link each other.

Testing

The TypeScript compiles cleanly. The WebSocket connection, Brotli decompression, and address-matching logic have been verified against the mainnet Flashblocks endpoint.

Added a new cookbook page that walks through building a production-ready
transaction monitor using Flashblocks WebSocket streaming.

Covers:
- Project setup (TypeScript, ws package)
- Brotli decompression of WebSocket messages
- Typed interfaces for Flashblock data structures
- Address watcher with preconfirmation status (success/reverted/preconfirmed)
- Auto-reconnect with exponential backoff
- Fallback to standard RPC via viem when Flashblocks is unavailable

This page complements app-integration.mdx (RPC usage) by covering the
WebSocket path end-to-end with a complete runnable example.
@cb-heimdall
Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/2
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants