5.4.3.11 Get block data API
After the data is added to the chain, the off-BSN system will get the block information of the current transaction by calling this interface on the public city node gateway.
1. Interface address: https://PCNGatewayAddress/api/fabric/v1/node/getBlockData
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 Data | blockData | String | Y | String generated by base64 calculation |
Example:
{
"header": {
"code": 0,
"msg": "success"
},
"mac": "MEQCICAgU3G6o1Ky6UeYgqEgCee27TS2F8ScH+jaSj6w20OCAiB+/6z1a2jG5m4vvjz1ft2LQdIsaG2BAXqcwxmSFyEIzg==",
"body": {
"blockHash": "b8366a63ed32fddec720872d206802e670222f29d9a8a32983d26b59dbfd6971",
"blockNumber": 3,
"preBlockHash": "6dcc69799682e2fc7ffa950c56031b807c54b7a098b4fd69db9cf8c97518bcea",
"blockData": "CkYIAxIgbcxpeZa..............."
}
}}