Solana RPC API手册

getBlockCommitment

getBlockCommitment方法返回指定区块的承诺。

请求参数

<u64> - 区块,以槽位标识

响应结果

getBlockCommitment方法返回一个JSON对象,主要字段为:

  • commitment - commitment, 值为以下两者之一:
    • <null> - 未知的区块
    • <array> - 承诺, u64整数数组,记录从0到MAX_LOCKOUT_HISTORY+1的每个深度的区块的投票抵押量
  • totalStake - 当前周期的活动抵押总和,单位lamport

示例代码

请求:

curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc":"2.0","id":1, "method":"getBlockCommitment","params":[5]}

响应:

{
  "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,10,32],
    "totalStake": 42
  },
  "id":1
}