Solana
Solana
Solana
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
getBlockCommitment reports how much validator stake has voted on a given slot, the signal that drives finality in Solana's Proof-of-Stake consensus (SOL is the staked native token). For the requested slot it returns a commitment array — 32 buckets indexed by how many confirmations a portion of stake has cast on the block — alongside totalStake, the total active stake in the current epoch measured in lamports. The deeper the votes concentrate toward the top of the array relative to totalStake, the closer the block is to finalized. Call it against https://solana.therpc.io/YOUR_API_KEY as a JSON-RPC 2.0 POST passing the slot as the single positional param.
| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | slot | integer | 是 | Slot number to read commitment for. |
| 类型 | 描述 |
|---|---|
| object | { commitment: [u64;32] | null, totalStake }. |
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | Invalid params | A param is missing, of the wrong type, or malformed (e.g. a non-base58 pubkey or a bad config field). |
-32004 | Block not available for slot | The slot is not in this node's ledger (purged, skipped, or behind first available block). Use an archival endpoint for deep history. |
-32603 | Internal error | The node hit an internal error serving the request — retry, and reduce the requested range/encoding if it persists. |
commitment is null for slots outside the node's recent voting window — old slots no longer carry per-slot vote data, so handle the null case rather than assuming an array.totalStake, not as absolute vote counts. The same bucket values mean very different things depending on how much SOL is staked in the epoch.