Documentation index

getBlocksWithLimit

Returns a list of confirmed blocks starting at the given slot, up to a maximum count. Unlike getBlocks which requires an end slot, this method lets you specify how many blocks you want. This is particularly useful for pagination, incremental indexing, and scenarios where you need a fixed number of blocks from a starting point.

Parameters

#TypeRequiredDescription
1u64YesStart slot (inclusive)
2u64YesMaximum number of blocks to return (limit up to 500,000)
3objectNoConfiguration object

Configuration object fields:

FieldTypeDescription
commitmentstringCommitment level: confirmed or finalized (default finalized)

Response

Returns an array:

FieldTypeDescription
resultarray[u64]Array of confirmed slot numbers

Code Examples

cURL

Terminal
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlocksWithLimit",
  "params": [
    166974000, 10
  ]
}'

TypeScript

TypeScript
const response = await fetch("http://88.216.36.108:7999", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getBlocksWithLimit",
    params: [
      166974000, 10
    ]
  }),
});
const { result } = await response.json();
console.log("Blocks:", result.length);

Python

Python
import requests

response = requests.post("http://88.216.36.108:7999", json={
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBlocksWithLimit",
    "params": [
        166974000, 10
    ]
})
result = response.json()["result"]
print(f"Blocks: {len(result)}")

Rust

Rust
use reqwest::Client;
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let res = client.post("http://88.216.36.108:7999")
        .json(&json!({
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getBlocksWithLimit",
            "params": [
                166974000_u64, 10_u64
            ]
        }))
        .send().await?
        .text().await?;
    println!("{}", res);
    Ok(())
}

Example Response

JSON
{
  "jsonrpc": "2.0",
  "result": [166974000, 166974001, 166974002, 166974003, 166974005, 166974006, 166974007, 166974008, 166974009, 166974010],
  "id": 1
}