Learn getBlocks use cases, code examples, request parameters, response structure, and tips.
getBlocks
RPC method allows you to retrieve a list of confirmed block slot numbers between a specified start slot and an optional end slot. This is useful when you need to know which blocks have been confirmed in a particular range without fetching the full content of each block.
getBlock
if needed.getBlocks
method takes the following parameters:
start_slot
(u64, required): The first slot to consider for the range (inclusive).end_slot
(u64, optional): The last slot to consider for the range (inclusive).
start_slot
.start_slot
and end_slot
(or latest slot if end_slot
is omitted) must not exceed 500,000 slots.commitment
(string, optional): Specifies the commitment level for the query. If omitted, the default commitment of the node is used. This is passed as the sole field in a configuration object as the last parameter.result
field of the JSON-RPC response will be an array of u64 integers. Each integer in the array represents a confirmed block slot number within the specified range.
[5, 6, 7, 8, 9, 10]
250000000
and 250000010
.
260000000
up to the latest block confirmed by the node (respecting the 500,000 slot range limit from the start slot).
confirmed
commitment level.
start_slot
values might return empty arrays or errors depending on the node’s configuration and ledger retention.commitment
level and which node you query, especially for very recent slots.getBlock
: getBlocks
is often used as a first step to identify relevant block slots before using getBlock
to retrieve the full details of individual blocks within that list.getBlocks
has a range limit, if you need to scan a very large portion of the chain, you’ll need to make multiple calls to getBlocks
, chunking your desired total range into segments of 500,000 slots or less.getBlocks
RPC method to list confirmed block slots on the Solana network.