Solana RPC API手册

getBlockHeight

getBlockHeight方法返回节点的当前区块高度

请求参数

  • <object> - (可选) Commitment

响应结果

getBlockHeight方法的返回结果的result字段为:

  • <u64> - 当前区块高度

示例代码

请求:

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

响应:

{"jsonrpc":"2.0","result":1233,"id":1}