block_latestBlock
获取最新区块。
Parameters
无
Returns
<Block>
- Block对象字段如下:
version
:<string>
- 平台版本号。number
:<string>
- 区块的高度。hash
:<string>
- 区块的哈希值,32字节的十六进制字符串。parentHash
:<string>
- 父区块哈希值,32字节的十六进制字符串。writeTime
:<number>
- 区块生成的unix时间戳。avgTime
:<string>
- 当前区块中,交易的平均处理时间(单位ms)。txCounts
:<string>
- 当前区块中打包的交易数量。merkleRoot
:<string>
- Merkle树的根哈希。transactions
:[<Transaction>]
- 区块中的交易列表。
Example1:正常的请求
- # Request
- curl -X POST --data '{"jsonrpc":"2.0", "namespace":"global", "method":" block_latestBlock","params":[],"id":71}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace":"global",
- "id": 1,
- "code": 0,
- "message": "SUCCESS",
- "result": {
- "version": "1.0",
- "number": "0x3",
- "hash": "0x00acc3e13d8124fe799d55d7d2af06223148dc7bbc723718bb1a88fead34c914",
- "parentHash": "0x2b709670922de0dda68926f96cffbe48c980c4325d416dab62b4be27fd73cee9",
- "writeTime": 1481778653997475900,
- "avgTime": "0x2",
- "txcounts": "0x1",
- "merkleRoot": "0xc6fb0054aa90f3bfc78fe79cc459f7c7f268af7eef23bd4d8fc85204cb00ab6c",
- "transactions": [
- {
- "version": "1.0",
- "hash": "0xf57a6443d08cda4a3dfb8083804b6334d17d7af51c94a5f98ed67179b59169ae",
- "blockNumber": "0x3",
- "blockHash": "0x00acc3e13d8124fe799d55d7d2af06223148dc7bbc723718bb1a88fead34c914",
- "txIndex": "0x0",
- "from": "0x17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
- "to": "0xaeccd2fd1118334402c5de1cb014a9c192c498df",
- "amount": "0x0",
- "timestamp": 1481778652973000000,
- "nonce": 3573634504790373,
- "extra": "",
- "executeTime": "0x2",
- "payload": "0x81053a70000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001c8"
- }
- ]
- }
- }
Example2:如果链上一个区块都没有
- # Request
- curl -X POST --data '{"jsonrpc":"2.0", "namespace":"global", "method":" block_latestBlock","params":[],"id":71}'
- # Response
- {
- "jsonrpc": "2.0",
- "namespace": "global",
- "id": 1,
- "code": -32602,
- "message": "There is no block generated!"
- }
当前内容版权归 Hyperchain 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Hyperchain .