Skip to main content
To chart a block-level metric over months, you don’t need every block. blockInterval returns every n-th block. With the Python client:
Blocks whose number is a multiple of 300 (blockOffset defaults to 0). Use blockOffset to shift the phase: "blockInterval": 300, "blockOffset": 150 returns 19426150, 19426450, ….

Intervals for common periods

Block times aren’t perfectly regular, so these give approximately evenly spaced samples. Use timestamp for the x-axis, not the block number.

Cost

One year of Ethereum is about 2.6 million blocks. Hourly samples are about 8,760 rows; with the four fields above (about 40 bytes per row), that’s 350 KB. A year of hourly base fees costs almost nothing. The range still pages at 50,000 blocks, so a year is about 53 requests. Use the pagination loop.

Rules

  • blockInterval applies only to the blocks stream. It needs block fields selected.
  • Logs and transactions in the same request are not sampled.
  • With a logs or transactions filter, the blocks stream already holds only blocks with a match; sampling applies on top of that.