All Products
Search
Document Center

Get Block

Last Updated: Apr 15, 2022

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

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

{
  "Success": true,
  "Result": {
    "number": 281,
    "hash": "4795bd5ac67db26b8b09e01da4e23b04a95a485914b0731ff5691c759df5725c",
    "create_time": 1581581371,
    "previous_hash": "c5ae9e9385bba2848fe5dc56a5d1185ba41184ce0344dded33c81a9142756c86",
    "transactions": [
      "e49d411a2ff32caa1688b5e0a07a957d2d8a4c8c124554772d07145214b3ba13",
      "53b106675bb5d39b81142c572ec14dba92d9726f1216f96f008aac35be237fda",
      "669e80e03dcc2e90af4494f2f7ada861e2b12b5041078a50065a3657312b558b"
    ]
  },
  "Error": {
    "code": 200,
    "message": "Success",
    "request_id": "313f10a5-bf79-48e1-9cdc-4345c9064a9c"
  }
}

Error Code

Please refer to Error Code