getBlockCommitment
The getBlockCommitment method returns commitment information for a particular block identified by its slot number. This method provides insight into how many validators have voted on the block and the total active stake behind those votes, which is crucial for understanding block finality and network consensus.
Solana uses a unique proof-of-stake consensus mechanism where validators vote on blocks to confirm them. The commitment of a block represents the total stake of all validators that have voted to confirm that block. Higher commitment percentages indicate stronger consensus and greater finality. This method is particularly valuable for applications that need to implement custom finality requirements or monitor network consensus in real-time.
Understanding block commitment is essential for security-critical applications. A block with low commitment might still be subject to fork resolution, while blocks with high commitment (especially those marked as finalized by the cluster) are considered permanent. This method helps developers make informed decisions about when to consider transactions as irreversible.
Parameters
parameter | type | description |
|---|---|---|
slot | number | The slot number of the block to query for commitment information |
Return Object
field | type | description |
|---|---|---|
commitment | array|null | Array of commitment numbers (u64) showing the total active stake that has voted on each level, or null if the slot is unknown |
totalStake | number | Total active stake in the cluster, in lamports |
Request Example
Response Example
Tip: The commitment array has 32 elements representing different commitment levels. The last non-zero element typically shows the highest commitment. To calculate commitment percentage, divide the sum of commitment values by totalStake. Blocks with commitment over 66.7% of total stake are generally considered secure.