in-solana by Supanode

getBlockCommitment — Solana RPC Method

getBlockCommitment returns the amount of cluster stake that has voted on a block at the given slot, broken down by confirmation depth. This is useful for understanding how finalized a particular block is.

Parameters

NameTypeRequiredDescription
slotu64YesSlot number of the block.

This method takes no configuration object — only the slot number.

Request

curl -X POST https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBlockCommitment",
    "params": [311857920]
  }'

TypeScript (@solana/kit)

import { createSolanaRpc } from "@solana/kit";

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const commitment = await rpc.getBlockCommitment(311857920n).send();

console.log(`Total stake: ${commitment.totalStake}`);

Response

{
  "jsonrpc": "2.0",
  "result": {
    "commitment": [
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 397515810144
    ],
    "totalStake": 397515810144
  },
  "id": 1
}
FieldTypeDescription
commitmentarray or nullArray of 32 u64 values. Index i represents the amount of stake (in lamports) that has confirmed the block at depth i. null if the block is unknown.
totalStakeu64Total active stake in lamports for the current epoch.

Understanding the commitment array

The array has 32 entries indexed 0 through 31. Each entry is the amount of stake (in lamports) that has reached at least that confirmation depth for the block. Entry 31 (the last) represents the maximum possible confirmation — equivalent to finalized. If commitment[31] equals totalStake, the block is fully finalized with all stake confirming it.

A block with commitment set to null means the node has no information about that slot — it may be a skipped slot, a future slot, or a slot beyond the node’s history.

Common errors

  • Unknown block — commitment is null. The slot may have been skipped, or the node has no data for it.
  • Slot not yet reached — querying a future slot returns commitment: null since no votes can exist yet.

Performance

getBlockCommitment is a lightweight query that reads vote state from memory. It does not fetch block data. The response is always small (a fixed-size array of 32 numbers).

FAQ

What does the commitment array represent? Each index i shows the total lamports of stake that have confirmed the block at depth i or greater. A higher depth means stronger confirmation. Index 31 represents the maximum confirmation depth.

How do I check if a block is finalized? A block is finalized when it has been confirmed by a supermajority (more than 2/3) of the total stake. Check if commitment[31] is greater than totalStake * 2 / 3.

What is totalStake? totalStake is the total amount of active stake in the cluster for the current epoch. It provides the denominator for calculating what percentage of stake has confirmed the block.

Why would commitment be null? The node has no vote data for that slot. This happens for skipped slots, very old slots where vote data has been discarded, or future slots that have not been reached yet.

Parameters

ParameterTypeRequiredDescriptionDefault
slotu64YesSlot number of the block to query.—

Updated: