getBlocks RPC 方法

返回两个 slot 之间已确认区块的列表

$ curl https://api.devnet.solana.com -s -X \
> POST -H "Content-Type: application/json" -d '
> {
> "jsonrpc": "2.0",
> "id": 1,
> "method": "getBlocks",
> "params": [
> 5,
> 10,
> {
> "commitment": "finalized"
> }
> ]
> }
> '

params

u64required

起始 slot

u64optional

结束 slot(必须不超过 start_slot 的 500,000 个区块)

objectoptional

配置对象

result

Response
{
"jsonrpc": "2.0",
"result": [5, 6, 7, 8, 9, 10],
"id": 1
}
array

一个 u64 整数数组,列出了从 start_slotend_slot(如果提供)或最新确认的 slot(含)之间的已确认区块。最大范围为 500,000 个 slot。

Is this page helpful?