getBlockCommitment
https://api.triport.io/v1/solReturns the amount of cluster stake, in lamports, that has voted on a particular Solana block (slot).
getBlockCommitment reports how much of the cluster's stake has voted on the
block produced at a given slot. It returns a commitment array describing
the stake-weighted vote depth for that block, plus the totalStake active in
the current epoch. Together these let you judge how finalized a block is: the
more stake concentrated at the highest lockout depth, the less likely the block
is to be rolled back.
Pass the target slot as the single positional parameter. If the node has no
commitment information for the requested slot — for example a slot it never
saw, or one already purged from its ledger — the commitment field is returned
as null while totalStake still reflects the epoch's active stake.
This is a low-level inspection method. For everyday "is this transaction
final?" checks, prefer querying with a commitment config of finalized on the
relevant read method; reach for getBlockCommitment when you need the raw
stake-weighted vote distribution for a specific block.
Parameters
JSON-RPC params is a positional array: [slot].
slotintegerrequiredResponse
For a slot the node knows nothing about, commitment is null:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"commitment": null,
"totalStake": 42000000000
}
}resultobjectBlockCommitment object.result.commitmentinteger[] | nullnull when the node has no commitment data for the slot.result.totalStakeintegerErrors
Errors are returned in the standard JSON-RPC error envelope. See the shared errors reference for the full envelope shape and shared codes.
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | slot is missing or not an integer. |
401 | Unauthorized | Missing or invalid Authorization: Bearer key. |
429 | Rate limited | More than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600). |
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io/v1/sol", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getBlockCommitment",
params: [348392041],
}),
});
const { result } = await res.json();
if (result.commitment === null) {
console.log("No commitment data for that slot");
} else {
const voted = result.commitment.reduce((a, b) => a + b, 0);
console.log(`${voted} / ${result.totalStake} lamports voted on the block`);
}TypeScript SDK (@triport/sdk)
import { TriportClient } from "@triport/sdk";
const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });
const { commitment, totalStake } = await client.solana.getBlockCommitment(348392041);
console.log(commitment === null
? "No commitment data for that slot"
: `voted stake across depths: ${commitment.join(", ")} (total ${totalStake})`);Python (triport-sdk)
import os
from triport import TriportClient
client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])
result = client.solana.get_block_commitment(348392041)
if result["commitment"] is None:
print("No commitment data for that slot")
else:
voted = sum(result["commitment"])
print(f"{voted} / {result['totalStake']} lamports voted on the block")Notes
- Lamports, not SOL: every value in
commitmentandtotalStakeis an integer count of lamports. Divide by1e9for a SOL figure. - Unknown slots: always handle
commitment === nullbefore reducing or indexing the array — it is the documented signal that the node has no vote data for the requested slot. - Related methods: use
getSlotto find the cluster's current slot, andgetBalancefor account balances. To confirm transaction finality directly, pass acommitmentconfig rather than inspecting raw vote depths here.