Skip to main content
EventStream (exported from @tevm/voltaire/contract) streams decoded Ethereum event logs with adaptive block-range chunking, exponential backoff retries, deduplication, and AbortSignal cancellation.

Standalone Usage

Use EventStream directly from @tevm/voltaire/contract without needing the Contract wrapper:
When using the copyable Contract Pattern, usdc.events.Transfer(filter) constructs the same EventStream instance from the ABI.

Backfill Historical Events

backfill(options) fetches [fromBlock, toBlock] inclusively in adaptive chunks:
  • Starts at chunkSize (default 100 blocks).
  • Halves the chunk size when the RPC returns a “block range too large” or response-size error, down to minChunkSize (default 10).
  • Increases the chunk size by 25% after 5 consecutive successful chunks.
  • Retries transient errors with exponential backoff (retry.maxRetries default 3, initialDelay default 1000 ms, maxDelay default 30000 ms).

Watch Live Events

watch(options?) polls for new blocks and yields matching logs as blocks advance. Deduplication keys logs by ${blockNumber}:${logIndex}.

Backfill Then Watch

Chain backfill() into watch() starting at lastBlock + 1n for gapless indexing:

Yielded Result Shape

Error Handling

Import error classes from @tevm/voltaire/contract: