Retrieves the details of a block in a Hyperledger Fabric channel, including its hash, creation time, and the transaction IDs it contains.
Request syntax
GET /api/v1/networks/{network}/blocks/{num}
Path parameters
| Parameter | Description |
|---|
network | The name of the Fabric channel. |
num | The block number. Set to latest to retrieve the most recent block. |
Response elements
Top-level fields
| Field | Type | Description |
|---|
Success | Boolean | Indicates whether the request succeeded. |
Error | Object | The error details. |
Result | Object | The block details. |
Error object
| Field | Type | Description |
|---|
code | Integer | The error code. |
message | String | The error description. |
request_id | String | The request ID. |
Block object
| Field | Type | Description |
|---|
number | Integer | The block number. |
hash | String | The hex-encoded hash of this block. |
previous_hash | String | The hex-encoded hash of the previous block. |
create_time | Integer | The block creation time, in UNIX timestamp format. |
transactions | List\<String\> | The transaction IDs of the transactions included in this block. |
data | Object | The block data. For configuration blocks, this contains the channel configuration. |
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>"
Response example
{
"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 codes
For a complete list of error codes, see Error codes.