block_getBatchBlocksByHash

根据区块哈希列表批量查询区块详细信息。

Parameters

  1. <Object>
  • hashes: [<string>] - 要查询的区块哈希数组,哈希值为32字节的十六进制字符串。
  • isPlain: <boolean> - 值为true,表示返回的区块不包括区块内的交易。值为false表示返回的区块包括区块内的交易信息。

Returns

  1. [<Block>] - Block对象数组,Block对象字段见 Block.

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

  1. # Request
  2. curl -X POST --data ' {"jsonrpc":"2.0","method":"block_getBatchBlocksByHash","params":[{
  3. "hashes":["0x810c92919fba632471b543905d8b4f8567c4fac27e5929d2eca8558c68cb7cf0","0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b"]
  4. }],"id":1}'
  5.  
  6. # Response
  7. {
  8. "jsonrpc": "2.0",
  9. "namespace": "global",
  10. "id": 1,
  11. "code": 0,
  12. "message": "SUCCESS",
  13. "result": [
  14. {
  15. "version": "1.3",
  16. "number": "0x3",
  17. "hash": "0x810c92919fba632471b543905d8b4f8567c4fac27e5929d2eca8558c68cb7cf0",
  18. "parentHash": "0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b",
  19. "writeTime": 1509448178829111592,
  20. "avgTime": "0x0",
  21. "txcounts": "0x0",
  22. "merkleRoot": "0x97b0d9473478886f5b0aee123d5652b15d4ae3ab41cc487cda9d8885cb003481"
  23. },
  24. {
  25. "version": "1.3",
  26. "number": "0x2",
  27. "hash": "0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b",
  28. "parentHash": "0x4cd9f393aabb2df51c09e66925c4513e23f0dbbb9e94d0351c1c3ec7539144a0",
  29. "writeTime": 1509440823930976319,
  30. "avgTime": "0x6",
  31. "txcounts": "0x1",
  32. "merkleRoot": "0x97b0d9473478886f5b0aee123d5652b15d4ae3ab41cc487cda9d8885cb003481",
  33. "transactions": [
  34. {
  35. "version": "1.3",
  36. "hash": "0x22321358931c577ceaa2088d914758148dc6c1b6096a0b3f565d130f03ca75e4",
  37. "blockNumber": "0x2",
  38. "blockHash": "0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b",
  39. "txIndex": "0x0",
  40. "from": "0x17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
  41. "to": "0xaeccd2fd1118334402c5de1cb014a9c192c498df",
  42. "amount": "0x0",
  43. "timestamp": 1509440823410000000,
  44. "nonce": 8291834415403909,
  45. "extra": "",
  46. "executeTime": "0x6",
  47. "payload": "0x0a9ae69d"
  48. }
  49. ]
  50. }
  51. ]
  52. }

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

  1. # Request
  2. curl -X POST --data ' {"jsonrpc":"2.0","method":"block_getBatchBlocksByHash","params":[{
  3. "hashes":["0x810c92919fba632471b543905d8b4f8567c4fac27e5929d2eca8558c68cb7cf0","0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b"],
  4. "isPlain": true
  5. }],"id":1}'
  6.  
  7. # Response
  8. {
  9. "jsonrpc": "2.0",
  10. "namespace": "global",
  11. "id": 1,
  12. "code": 0,
  13. "message": "SUCCESS",
  14. "result": [
  15. {
  16. "version": "1.3",
  17. "number": "0x3",
  18. "hash": "0x810c92919fba632471b543905d8b4f8567c4fac27e5929d2eca8558c68cb7cf0",
  19. "parentHash": "0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b",
  20. "writeTime": 1509448178829111592,
  21. "avgTime": "0x0",
  22. "txcounts": "0x0",
  23. "merkleRoot": "0x97b0d9473478886f5b0aee123d5652b15d4ae3ab41cc487cda9d8885cb003481"
  24. },
  25. {
  26. "version": "1.3",
  27. "number": "0x2",
  28. "hash": "0x9c41efcc50ec6af6e3d14e1669f37bd1fc0cfe5836af6ab1e43ced98653c938b",
  29. "parentHash": "0x4cd9f393aabb2df51c09e66925c4513e23f0dbbb9e94d0351c1c3ec7539144a0",
  30. "writeTime": 1509440823930976319,
  31. "avgTime": "0x6",
  32. "txcounts": "0x1",
  33. "merkleRoot": "0x97b0d9473478886f5b0aee123d5652b15d4ae3ab41cc487cda9d8885cb003481"
  34. }
  35. ]
  36. }