5.4.4.13 Smart Contract Event Registration API

Smart contract event in a DApp can trigger the off-BSN system to process further transactions. This interface is used to register the smart contract event to be monitored.

1. Interface address:

https://PCNGatewayAddress/api/fiscobcos/v1/event/register

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 Event Type eventType String Y 1.Block generation event 2.Contract event
2 Contract address contractAddress String N EventType is 1 then can be null; EventType is 2 then EventType and contractName cannot be null at the same time
3 Contract name contractName String N EventType is 1 then can be null; EventType is 2 then EventType and contractName cannot be null at the same time
4 Notification URL notifyUrl String Y
5 Attached parameters attachArgs String N

Example:

{"header":{"userCode":"USER0001202006042321579692440","appCode":"app0001202006042323057101002","tId":""},"mac":"MEUCIQCMP1ToZS5e8S94kYZ/8y5XfeyjRyUrPFpeIQMES3SGpQIgO8b6O8Kk/qpNTo1vbNTwyAYNaw6HBi9OkAH8Rp23j8s=","body":{"eventType":1,"contractAddress":"0x866aefc204b8f8fdc3e45b908fd43d76667d7f76","contractName":"BsnBaseContractk1","notifyUrl":"http://127.0.0.1:18080","attachArgs":"abc=123"}}

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: successful -1: failed
2 Response Message msg String Y
Body
1 Event ID eventId String Y Null when the code is not 0

Example:

{
  "header": {
    "code": 0,
    "msg": "Transaction successful"
  },
  "mac": "MEUCIQDYSTwYhh6EDHT5Z7ukcqXW9LMjZW6WPnrv8Xt14RuH2AIgIwa5K7NK4/TThzs8z6VfkpNNJU+dzAXeypFmfjkru88=",
  "body": {
    "eventId": "xxxxxxxxxxxxxxxxxxxxxxxxxx"
  }
}
© 2019-2023 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 ""