5.4.4.5 Invoke Smart Contract API in Key Trust Mode
For the FISCO DApps in Key Trust mode, when the off-BSN system invokes the smart contract via PCN gateway, it is required to include the parameters in the request. The gateway will return the response message from the chaincode.
1. Interface address:
https://PCNGatewayAddress/api/fiscobcos/v1/node/reqChainCode
Note: After a participant has successfully joined in a FISCO DApp service, the participant can view and download the DApp’s configuration parameters which are used for off-BSN systems to connect to this DApp’s smart contracts, including the PCN gateway address and Dapp access keys, as shown below:
2. Call Method: POST
3. Signature algorithm: required and refer to Section 5.4.4.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 | User ID | userId | String | Y | Registered user ID via 7.3.1 API |
2 | Smart Contract Name | contractName | String | Y | |
3 | Function Name | funcName | String | Y | |
4 | Function Parameters | funcParam | string | N | convert array type to json string format |
Example:
{"header":{"appCode":"cl0006202003181926573677572","userCode":"USER0006202003181951281835816"},"body":{"contractName":"HelloWorld","userId":"100003","funcName":"set","funcParam":[\"abc\"]},"mac":"MEUCIQDTFe2Gerdf7YJrG1a1Yt99M0ZQ3T1lGpsXdNmFV7WuTgIgSkZ19abUhAJbMrJMBoD8N7f26xhpQRuR4vNAfY7EEbs="}
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 | Invoke Type | constant | Bool | N | |
2 | Query information | queryInfo | String | N | If Constant is true, this field has value. |
3 | Transaction hash | txId | string | N | If Constant is false, this field has value and is valid. |
4 | Block HASH | blockHash | String | N | If Constant is false, this field has value and is valid. |
5 | Block Number | blockNumber | Int | N | If Constant is false, this field has value and is valid. |
6 | Gas Used | gasUsed | Int | N | If Constant is false, this field has value and is valid. |
7 | Transaction Status | status | String | N | If Constant is false, this field has value and is valid. 0x0 means transaction successful, status value refer to transaction receipt status in 7.3.9 |
8 | From account | from | String | N | If Constant is false, this field has value and is valid. |
9 | To account | To | String | N | If Constant is false, this field has value and is valid. |
10 | Input | input | String | N | If Constant is false, this field has value and is valid. |
11 | Ouput | output | String | N | If Constant is false, this field has value and is valid. |