Writes & subscriptions
BlockDB splits writes into real-time writes and batch writes, and builds block event subscription on top of them.Real-time writes
Real-time writes target normal-sized online writes and provide near real-time, low-latency ingestion. The SDK offers:
Use these for continuously arriving online data.
Batch writes
When you need to write massive amounts of data (for example historical backfill), use batch writes. Their characteristics:- Submit a single asynchronous write job containing millions of rows.
- Unbounded submission throughput: data is staged through object storage, so it does not consume the real-time network and memory path, and you can submit jobs continuously at high throughput.
- Fast actual ingestion: the underlying speed of large batch writes reaches hundreds of thousands to over a million rows per second, depending on the table type and the size of the underlying database.
BatchWriteService gRPC service. In the InitWriteJob request you choose the target table type with the strategy field:
Real-time vs batch writes
All write interfaces return a uniform
WriteResult (affectedRows plus a jobID).
Block subscription events (BlockSubscribeEvent)
Every time BlockDB successfully writes to a Block table, it publishes a block subscription event (BlockSubscribeEvent). Per the subscribe protocol definition, the event fields are:
Events are distributed through a Kafka event source, and subscribers receive them as a stream through the
Subscribe service.
The subscription loop
Through the event subscription mechanism (the Subscribe API), BlockDB closes the loop of “data production → event notification → downstream consumption”, keeping your business logic fully in sync with the chain’s heartbeat (its block production rate):Table-to-table ETL pipelines
You do not need to subscribe to the rawest trace and event block tables. You can start from any existing topic-specific Block table on the platform and process it further, turning subscriptions into an ETL pipeline that simplifies data processing.Multi-table alignment
When your business logic depends on several upstream tables computed in parallel, you must ensure every table has finished writing the target height before consuming it safely. BlockDB includes anAligned state machine that handles out-of-order cross-table event streams automatically — see Multi-table block height alignment.