block_getBlockByHash

根据区块的哈希值查询区块详细信息。

Parameters

  1. <string> - 32字节的十六进制字符串,区块的哈希值。
  2. <boolean> - 值为true,表示返回的区块不包括区块内的交易。值为false表示返回的区块包括区块内的交易信息。

Returns

  1. <Block> - Block对象字段见 Block.

Example1:返回的区块包括交易信息

  1. # Request
  2. curl -X POST data '{"jsonrpc":"2.0","namespace":"global","method":"block_getBlockByHash","params":["0x00acc3e13d8124fe799d55d7d2af06223148dc7bbc723718bb1a88fead34c914", false],"id":1}'
  3.  
  4. # Response
  5. {
  6. "jsonrpc": "2.0",
  7. "namespace":"global",
  8. "id": 1,
  9. "code": 0,
  10. "message": "SUCCESS",
  11. "result": {
  12. "version": "1.0"
  13. "number": "0x3",
  14. "hash": "0x00acc3e13d8124fe799d55d7d2af06223148dc7bbc723718bb1a88fead34c914",
  15. "parentHash": "0x2b709670922de0dda68926f96cffbe48c980c4325d416dab62b4be27fd73cee9",
  16. "writeTime": 1481778653997475900,
  17. "avgTime": "0x2",
  18. "txcounts": "0x1",
  19. "merkleRoot": "0xc6fb0054aa90f3bfc78fe79cc459f7c7f268af7eef23bd4d8fc85204cb00ab6c",
  20. "transactions": [
  21. {
  22. "version": "1.0",
  23. "hash": "0xf57a6443d08cda4a3dfb8083804b6334d17d7af51c94a5f98ed67179b59169ae",
  24. "blockNumber": "0x3",
  25. "blockHash": "0x00acc3e13d8124fe799d55d7d2af06223148dc7bbc723718bb1a88fead34c914",
  26. "txIndex": "0x0",
  27. "from": "0x17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
  28. "to": "0xaeccd2fd1118334402c5de1cb014a9c192c498df",
  29. "amount": "0x0",
  30. "timestamp": 1481778652973000000,
  31. "nonce": 3573634504790373,
  32. "extra": "",
  33. "executeTime": "0x2",
  34. "payload": "0x81053a70000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001c8"
  35. }
  36. ]
  37. }
  38. }

Example2:返回的区块不包括交易信息

  1. # Request
  2. curl -X POST data '{"jsonrpc":"2.0","namespace":"global","method":"block_getBlockByHash","params":["0x00acc3e13d8124fe799d55d7d2af06223148dc7bbc723718bb1a88fead34c914", true],"id":1}'
  3.  
  4. # Response
  5. {
  6. "jsonrpc": "2.0",
  7. "namespace":"global",
  8. "id": 1,
  9. "code": 0,
  10. "message": "SUCCESS",
  11. "result": {
  12. "version": "1.0",
  13. "number": "0x3",
  14. "hash": "0x00acc3e13d8124fe799d55d7d2af06223148dc7bbc723718bb1a88fead34c914",
  15. "parentHash": "0x2b709670922de0dda68926f96cffbe48c980c4325d416dab62b4be27fd73cee9",
  16. "writeTime": 1481778653997475900,
  17. "avgTime": "0x2",
  18. "txcounts": "0x1",
  19. "merkleRoot": "0xc6fb0054aa90f3bfc78fe79cc459f7c7f268af7eef23bd4d8fc85204cb00ab6c"
  20. }
  21. }