getLatestBlockhash RPC 方法

返回最新的区块哈希值

版本限制

此方法仅适用于 solana-core v1.9 或更新版本。对于 solana-core v1.8 及以下版本,请使用 getRecentBlockhash

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

params

objectoptional

包含以下字段的配置对象:

result

Response
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 2792
},
"value": {
"blockhash": "EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N",
"lastValidBlockHeight": 3090
}
},
"id": 1
}
object

RpcResponse JSON 对象,其中 value 字段设置为包含以下内容的 JSON 对象:

Is this page helpful?