Parameters
Block number, identified by Slot
Response
Array of u64 integers logging the amount of cluster stake in lamports that has voted on the block at each depth from 0 to MAX_LOCKOUT_HISTORY.
Total active stake, in lamports, of the current epoch.
Code Examples
Basic Request
curl http://rpc.orbitflare.com -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getBlockCommitment",
"params": [5]
}'
Using web3.js
import { Connection } from '@solana/web3.js';
const connection = new Connection('http://rpc.orbitflare.com');
const commitment = await connection.getBlockCommitment(5);
console.log(commitment);
Using Python
from solana.rpc.api import Client
client = Client("http://rpc.orbitflare.com")
response = client.get_block_commitment(5)
print(response)
Notes
- Returns commitment information for a specific block
- The commitment array indicates stake weight distribution
- The totalStake value represents the total active stake in the current epoch
- The response is immediate as it reads from the current state
Best Practices
- Use this method to verify block confirmation status
- Compare commitment values to understand consensus levels
- Handle network errors and retry when appropriate