5.4.3.10 Get block information API

After the data is uploaded to the chain, the off-BSN system can use this interface on the PCN gateway to get the block information of the current transaction (body.blockInfo), the status (body.blockInfo.status), and transaction ID (body.blockInfo.txId). If the status value is 0, it signifies that the transaction has been successful and a block has been created. The block information can be queried according to the transaction ID.

1. Interface address: https://PCNGatewayAddress/api/fabric/v1/node/getBlockInfo

2. Call Method: POST

3. Signature algorithm: required and refer to Section 5.4.3.1

4. Call parameters

No. Field name Field Type Required Remarks
1 Header header Map Y
2 Body body Map Y
3 Signature Value mac String Y
Header
1 user unique ID userCode String Y
2 DApp unique ID appCode String Y
Body
1 Block number blockNumber Int64 N Can’t be null at the same time
2 Block HASH blockHash String N Can’t be null at the same time
3 Transaction Id txId String N Can’t be null at the same time

Example:

{"header": {"userCode": "USER0001202004151958010871292","appCode": "app0001202004161020152918451","tId": ""},"mac": "MEUCIQCrGthrAvNalUsWEdnDxZkNXF4nCpXOxIFQdp1YYhGvugIgKvYql9Ex6RCcOhqt6coufNPH/QhtKYNeThWJ2rEL+4g=","body": {"blockNumber": 6,"blockHash": "","txId": ""}}

5. Response parameters

No. Field name Field Type Required Remarks
1 header header Map Y
2 body body Map Y
3 signature value mac String Y
Header
1 Response ID code int Y 0: authentication successful -1: authentication failed
2 Response Message msg String N if code=0 then can be null
Body
1 Block Hash blockHash String Y
2 Block Number blockNumber Long Y
3 Previous Block Hash preBlockHash String Y
4 Block Size blockSize Long Y byte
5 The number of transactions on current block blockTxCount Int Y
6 Transaction detail transactions TransactionData Y Transaction Detail
TransactionData
1 Transaction Id txId String
2 Transaction Status status Int refer to detailed transaction status description in 5.4.3.18
3 Transaction Provider createName String
4 Transaction timestamp second timeSpanSec Int64
5 Transaction timestamp nonasecond timeSpanNsec Int64

Example:

{
  "header": {
    "code": 0,
    "msg": "Transaction Successful"
  },
  "mac": "MEUCIQC8nfFnHw4sEYJmaSTT1xepxMGgomxyJtt0ysyGgPB0AwIgfuuiegdGEbBi/2wmFCco39wmik3isLWtvnN9ZmJDTdk=",
  "body": {
    "blockHash": "fc83c306677925efee540b4d7b7ca73e06f144cae34c706f1101d6b395ada2da",
    "blockNumber": 6,
    "preBlockHash": "93c86551d812229274e144093cd4bd17dacb35bc6a01779930e11f43f886bf34",
    "blockSize": 7020,
    "blockTxCount": 1,
    "transactions": [
      {
        "txId": "a8639f3a796267e048d475b00fe7646a4524f1c20d71880e19708821177b7bdb",
        "status": 0,
        "createName": "test02@app0001202004161020152918451",
        "timeSpanSec": 1587271285,
        "timeSpanNsec": 26436800
      }
    ]
  }
}
© 2019-2024 Red Date (Hong Kong) Technology Limited. all right reserved,powered by GitbookFile Modify: 2023-02-16 12:22:01

results matching ""

    No results matching ""

    results matching ""

      No results matching ""