Get Block

更新时间:
复制 MD 格式

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

ParameterDescription
networkThe name of the Fabric channel.
numThe block number. Set to latest to retrieve the most recent block.

Response elements

Top-level fields

FieldTypeDescription
SuccessBooleanIndicates whether the request succeeded.
ErrorObjectThe error details.
ResultObjectThe block details.

Error object

FieldTypeDescription
codeIntegerThe error code.
messageStringThe error description.
request_idStringThe request ID.

Block object

FieldTypeDescription
numberIntegerThe block number.
hashStringThe hex-encoded hash of this block.
previous_hashStringThe hex-encoded hash of the previous block.
create_timeIntegerThe block creation time, in UNIX timestamp format.
transactionsList\<String\>The transaction IDs of the transactions included in this block.
dataObjectThe 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.