Skip to main content

Compute with BlockX

BlockDB handles storage; BlockX handles compute. When a single block carries a lot of data and blocks are produced frequently, single-process sequential handling cannot keep up with the block rate (on BSC, for example, you have only a few seconds per block). BlockX runs each block’s rows fully in parallel, keeping your business logic in sync with block production.

The most typical scenario

Most on-chain data processing follows the same pipeline:
The most typical upstream is a block trace table such as chain.trace.eth — one block holds hundreds or thousands of traces, which is a natural fit for fully parallel compute. And this pipeline uses the same configuration and the same function for real-time subscription and historical block backfill.

Wiring the pipeline with Pipeline

BlockX’s high-level wrapper Pipeline packages “source table → function → target table” into one object and exposes only two verbs:
  • backfill(block_start, block_end): batch backfill of historical blocks.
  • update(): catch up on historical gaps first, then switch to real-time subscription once caught up.
Both reuse the same triggers, the same function, and the same target_table.

Real-time and backfill share one configuration

backfill and update run on the same configuration: So you maintain one function and one Pipeline configuration. How much history to backfill and how far real-time should catch up are both handled by the same object, which naturally rules out “backfill and real-time logic drifting apart”.

Low-level interfaces (advanced)

Pipeline is the high-level wrapper. If you need finer control, bypass it and compose the low-level BlockTableCallConfig (what to compute), BlockWriteHandler (where results go), and TaskBuilder (submit the task):
For the complete API and configuration options, see the BlockX documentation. This page only covers the core path for working with BlockDB.