# getBlocks
Solana API method that returns a list of confirmed blocks between two slots.
Information
The maximum range allowed is 500,000 slots.
Parameters:
<u64>
— thestart_slot
, as u64 integer.<u64>
— (optional) theend_slot
, as u64 integer, must be no more than 500,000 blocks higher than thestart_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 isfinalized
.
Returns:
array
— The result field will be an array of u64 integers listing confirmed blocks between thestart_slot
and eitherend_slot
if provided or the latest confirmed block, inclusive.
Example:
- 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));
})();