getBlockTime RPC 方法

返回区块的估计生成时间。

每个 validator 会定期将其 UTC 时间报告到分类账中, 通过间歇性地为特定区块的投票添加时间戳。 请求区块的时间是根据分类账中记录的一组最近区块的投票时间戳的 权重平均值计算得出的。

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

params

u64required

区块编号,由 Slot 标识

result

Response
{
"jsonrpc": "2.0",
"result": 1574721591,
"id": 1
}
i64

估计生成时间,以 Unix 时间戳表示(自 Unix 纪元以来的秒数)

Is this page helpful?