get_last_block_header
get_last_block_header
获取最新区块的头信息,其别名为getlastblockheader
。
输入参数
无
输出结果
- block_header:区块头信息结构
- block_size:区块字节数,unsigned int
- depth:区块深度,unsigned int
- difficulty:难度,unsigned int
- hash:区块哈希, string
- height:区块高度, unsigned int
- major_version:当前区块高度的monero协议主版本,unsigned int
- minor_version:当前区块高度的monero协议次版本,unsigned int
- nonce:用于挖块的一次性密码学随机数字,unsigned int
- num_txes:区块中的交易数量,不包括币基交易,unsigned int
- orphan_status:是否孤儿区块,boolean
- prev_hash:前一区块的哈希,string
- reward:原子单位计量的出块奖励,unsigned int,1 XMR = 1e12 原子单位
- timestamp:区块上链的unix时间戳,unsigned int
- status:RPC错误代码,string,"OK"表示一切正常
- untrusted:是否可信,boolean
示例代码
curl请求:
$ curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_last_block_header"}' -H 'Content-Type: application/json'
响应结果:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"block_header": {
"block_size": 62774,
"depth": 0,
"difficulty": 60097900840,
"hash": "3a289b8fa88b10e2163826c230b45d79f2be37d14fa3153ee58ff8a427782d14",
"height": 1562023,
"major_version": 7,
"minor_version": 7,
"nonce": 3789681204,
"num_txes": 5,
"orphan_status": false,
"prev_hash": "743e5d0a26849efe27b96086f2c4ecc39a0bc744bf21473dad6710221aff6ac3",
"reward": 4724029079703,
"timestamp": 1525029411
},
"status": "OK",
"untrusted": false
}
}