getBlocksWithLimit
Returns a list of confirmed blocks starting at the given slot, up to the specified limit.
Parameters
startSlot
: (integer) [required] - The starting slot number for the range of blocks to query.limit
: (integer) [required] - The maximum number of confirmed blocks to return, starting from the specified slot. Must be no more than 500,000 blocks higher thanstartSlot
.config
: (object) [optional] - Configuration object with the following options:commitment
: (string) [optional] - The commitment level to use for the query. The default isfinalized
. Possible values are:finalized
- Queries the most recent block confirmed by a super majority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.confirmed
- Queries the most recent block that has been voted on by a super majority of the cluster.
Returns
result
: (integer) - An array of u64
integers representing the block numbers from the startSlot
up to the specified limit
.
Request
- curl
curl https://solana-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id":1, "method":"getBlocksWithLimit", "params":[371661723, 10]}'
Response
- JSON
{
"jsonrpc":"2.0",
"result":[371661723,371661724,371661725,371661726,371661727,371661728,371661729,371661730,371661731,371661732],
"id":1
}