chain/get_block
chain/get_block
调用返回指定区块的详细数据。
注意,nodeos时需要启用chain_api_plugin插件。
调用参数
调用参数为一个JSON对象,用来指定要提取数据的区块,其成员如下:
- block_num_or_id:字符串,要提取数据的区块序号或ID
返回值
get_block
调用返回描述指定区块数据的JSON对象,其成员如下:
- previous:前一个区块的ID,字符串
- timestamp:区块时间戳,时间字符串
- transaction_mroot
- action_mroot
- block_mroot
- producer:出块账号,字符串
- schedule_version:调度器版本,数值
- new_producers:新出现的出块账号集合,空或数组
- producer_signature:出块账号的签名,字符串
- regions:分区集合,数组
- input_transactions:区块中包含的交易集合,数组
- id:区块ID,字符串
- block_num:区块序号,整数
- ref_block_prefix:参考块前缀,整数
示例代码
调用请求:
~$ curl -X POST --url http://127.0.0.1:8888/v1/chain/get_block -d '{
"block_num_or_id": "000000056d75b0581b4fbb96affa36669a37173d21f46f8cb974f760e94bbe14"
}'
返回结果:
{
"previous": "00000004471d48fe40706e73ce27f9cf7bac1704ae55279c7a58c0173718a711",
"timestamp": "2018-04-18T16:24:23.500",
"transaction_mroot": "e366c0cc3519bb0f2ddaec20928fa4d6aae546194bb1c4205c67be429147ed4a",
"action_mroot": "77e5e91b594ab4ebc44ebc8c7ecdc9d26409c5a07452d3b20a4840562fdeb658",
"block_mroot": "4ef85b0d212f3fffabdd65680d32dd7dded3461d9df226a6e3dc232e42978f8b",
"producer": "eosio",
"schedule_version": 0,
"new_producers": null,
"producer_signature": "EOSJzEdFDsueKCerL7a6AdxMxiT851cEiugFB7ux1PAGn5eMmco8j32NsaKupxibheQGVFEqyEdjMub67VZjKmsLzuNxxKtUA",
"regions": [{
"region": 0,
"cycles_summary": [
[{
"read_locks": [],
"write_locks": [],
"transactions": [{
"status": "executed",
"kcpu_usage": 2,
"net_usage_words": 38,
"id": "9880c128683e24845ccd282ebe026bd522f7fa9c6278d885f6ed35164c680669"
}]
}]
]
}],
"input_transactions": [],
"id": "000000056d75b0581b4fbb96affa36669a37173d21f46f8cb974f760e94bbe14",
"block_num": 5,
"ref_block_prefix": 2528857883
}