# getBlocks

Solana API method that returns a list of confirmed blocks between two slots.


The maximum range allowed is 500,000 slots.


  • <u64> — the start_slot, as u64 integer.
    • <u64> — (optional) the end_slot, as u64 integer, must be no more than 500,000 blocks higher than the start_slot.
    • <object> — (optional) the configuration object containing the following field:
      • commitment: <string> — (optional) the commitment; processed is not supported. If the parameter is not provided, the default is finalized.


  • array — The result field will be an array of u64 integers listing confirmed blocks between the start_slot and either end_slot if provided or the latest confirmed block, inclusive.


  • Solana web3.js
  • Solana.py
  • cURL
import { PublicKey, Connection } from "@solana/web3.js"

const nodeUrl = "CHAINSTACK_NODE_URL"
const connect = new Connection(nodeUrl);

(async () => {  
  console.log(await connect.getBlocks(151696557, 151696700));