All Products
Search
Document Center

Get Block

Last Updated: Jun 11, 2020

Query the block information in blockchain network.

API

GET /api/v1/networks/{network}/blocks/{num}

Url Path Args Description
network Fabric channel name
num Block number, “latest” for newest block

Response

Name Type Description
Success Boolean Indicating if the request was successful.
Error Error -
Result Block -

Error

Name Type Description
code Integer Error code
message String Error description
request_id String The id of this request

Block

Name Type Description
number Integer Block number
hash String The hex encoded block hash of current block
previous_hash String The hex encoded block hash of previous block
create_time Integer Block create time in unix timestamp
transactions List<String> The transaction id of the transaction in this block
data Object The content is common.Block when block type is config

Examples

Request Example

  1. curl -X GET "http://your.gateway.endpoint/api/v1/networks/channel3/blocks/281" -H "accept: application/json" -H "Authorization: Bearer <Your Access Token>"

Example of Normal Return

  1. {
  2. "Success": true,
  3. "Result": {
  4. "number": 281,
  5. "hash": "4795bd5ac67db26b8b09e01da4e23b04a95a485914b0731ff5691c759df5725c",
  6. "create_time": 1581581371,
  7. "previous_hash": "c5ae9e9385bba2848fe5dc56a5d1185ba41184ce0344dded33c81a9142756c86",
  8. "transactions": [
  9. "e49d411a2ff32caa1688b5e0a07a957d2d8a4c8c124554772d07145214b3ba13",
  10. "53b106675bb5d39b81142c572ec14dba92d9726f1216f96f008aac35be237fda",
  11. "669e80e03dcc2e90af4494f2f7ada861e2b12b5041078a50065a3657312b558b"
  12. ]
  13. },
  14. "Error": {
  15. "code": 200,
  16. "message": "Success",
  17. "request_id": "313f10a5-bf79-48e1-9cdc-4345c9064a9c"
  18. }
  19. }

Error Code

Please refer to Error Code