5.4.3.7 Invoke chaincode in Public Key Upload Mode
For DApps in Public Key Upload mode, the participant needs to assemble the transaction message locally, and invoke this interface to initiate the transaction from the off-BSN system to the DApp’s chaincode.
1. Interface address: https://PCNGatewayAddress/api/fabric/v1/node/trans
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 | N | |
3 | Signature Value | mac | String | Y | |
Header | |||||
1 | user unique ID | userCode | String | Y | |
2 | DApp unique ID | appCode | String | Y | |
Body | |||||
1 | Transaction data | transData | String | Y | the transaction data should be encoded with base64 |
Example:
{"header":{"userCode":"USER0001202004151958010871292","appCode":"app0001202004161020152918451","tId":""},"mac":"MEUCIQCv8EZ2OqbSbI9xGGKX06Mquh+g+NhhbUoAJBbnemXdagIgNMF7W7ecu5uej9BpVx04qwJuVijbgcp3VYIcjDK0Z38=","body":{"transData":"Cq0KCrsJCpcBCAMaCwi9gPr0BRD0o+Z2IhxhcHAwMDAxMjAyMDA0MTYxMDIwMTUyOTE4NDUxKkBjM2M2NTIzOTU4YzM4MTExOTJiOGQzNThkZDI2MTdmMWIxNGNiNjYxZGU2YjAyMmMxYTgyMjI2OWU4YThjNDhkOiYSJBIiY2NfYXBwMDAwMTIwMjAwNDE2MTAyMDE1MjkxODQ1MV8wMBKeCAqBCAoLT3JnYk5vZGVNU1AS8QctLS0tLUJFR0lOIENFUlRJRklDQVRFLS0tLS0KTUlJQ3ZUQ0NBbVNnQXdJQkFnSVVWanBGZTJFaERFaHJlOHBBVTh4bkd3dXhPbU13Q2dZSUtvWkl6ajBFQXdJdwpUakVMTUFrR0ExVUVCaE1DUTA0eEVEQU9CZ05WQkFnVEIwSmxhV3BwYm1jeEREQUtCZ05WQkFvVEEwSlRUakVQCk1BMEdBMVVFQ3hNR1kyeHBaVzUwTVE0d0RBWURWUVFERXdWaWMyNWpZVEFnRncweU1EQTBNVGt3TkRN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1IbwbgLAyoHXUNnjZSGOqBDheQMSbQprCmkIARIkEiJjY19hcHAwMDAxMjAyMDA0MTYxMDIwMTUyOTE4NDUxXzAwGj8KA3NldAo4eyJiYXNlS2V5IjoidGVzdDIwMjAwNDA0IiwiYmFzZVZhbHVlIjoidGhpcyBpcyBzdHJpbmcgIn0SRjBEAiB+mOUKY7fRjcZ1/qc96YP9GGod3UK56jJaWaE4o3J90QIgeirrjyzL6zQLN89tv3jDpI7vxKChkGM9u8IEFiFEGYo="}}
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, can be null |
Body | |||||
1 | block information | blockInfo | blockInfo | N | If code is not 0, then leave blank |
2 | chaincode response result | ccRes | ccRes | N | If code is not 0, then leave blank |
blockInfo | |||||
1 | Transaction Id | txId | String | Y | |
2 | Block HASH | blockHash | String | N | On synchronous mode, returns Block HASH |
3 | status value | status | Int | Y | refer to detailed transaction status description in 5.4.3.17 |
ccRes | |||||
1 | chaincode response status | ccCode | Int | Y | 200: successful ;500: failed |
2 | chaincode response result | ccData | Str | N | actual chaincode response result |
Example:
{
"header": {
"code": 0,
"msg": "Transaction Successful"
},
"mac": "MEQCICXNk40O+Gkqqe2XgoaxdOoIvDQe4RfLtwXkxjC7ce8TAiBLVu6PjOqWueVB3t4h7REpNdcVf6L0qVzfdA1yovuc7g==",
"body": {
"blockInfo": {
"txId": "c3c6523958c3811192b8d358dd2617f1b14cb661de6b022c1a822269e8a8c48d",
"blockHash": "",
"status": 0
},
"ccRes": {
"ccCode": 200,
"ccData": "SUCCESS"
}
}
}