Documentation Index
Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
Use this file to discover all available pages before exploring further.
u64 整数数组,记录从深度 0 到 MAX_LOCKOUT_HISTORY 的每个深度上对该区块投票的集群质押量(以 lamports 为单位)。
当前 epoch 的总活跃质押量,以 lamports 为单位。
代码示例
基本请求
curl http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getBlockCommitment",
"params": [5]
}'
使用 web3.js
import { Connection } from '@solana/web3.js';
const connection = new Connection('http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');
const commitment = await connection.getBlockCommitment(5);
console.log(commitment);
使用 Python
from solana.rpc.api import Client
client = Client("http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY")
response = client.get_block_commitment(5)
print(response)
注意事项
- 返回特定区块的 commitment 信息
- commitment 数组表示质押权重分布
- totalStake 值代表当前 epoch 的总活跃质押量
- 响应是即时的,因为它从当前状态读取
最佳实践
- 使用此方法验证区块确认状态
- 比较 commitment 值以了解共识级别
- 适当处理网络错误并重试