Chaincode and block event notification API

This interface is implemented on the off-BSN system side. When the PCN gateway receives the notification of a triggered event, it uses this interface to notify the off-BSN system about the execution result.

After receiving the notification successfully, the off-BSN system returns a string containing “success”, otherwise, the gateway will send the notification again at 3, 12, 27, and 48 seconds respectively, for a total of five times.

1. Call method: POST

2. Signature algorithm: required and refer to Section

3. 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
1 user unique ID userCode String Y
2 DApp unique ID appCode String Y
1 Chaincode ID chainCode String N Null when the block event notification
2 PCN ID orgCode String Y
3 Registered Event key eventKey String N
4 Registered Event ID eventId String Y
5 Registered Event parameters attachArgs String N Additional parameters entered during registration
6 Monitored event key eventName String N The event name in the chaincode, null when the block event notification
7 Current Chaincode transaction Id txId String N Null when the block event notification
8 Monitored event value payload String N
9 Current Block Height blockNumber Long Y
10 Response random string nonceStr String Y Off-BSN system uses this value to judge if the notification is already received. This string remains the same at the repeated notifications.
11 Previous hash previousHash String N Null when chaincode event notification


Chaincode event nofitication
Block event notification

4. The payload parameter in the message is not passed in Fabric 1.4.3, please refer to https://github.com/hyperledger/fabric/blob/v1.4.3/core/peer/deliverevents.go#L251

For the specific code, if you need to use the payload parameter, you can get it as follows:

1) store the content to be passed through the event to the chain in the form of “key-value”.

2) pass the event name and the key splice in 1 as eventName, e.g.: eventkey_key.

3) register the event with a regular registration, e.g. : eventkey_[\s\S]*.

4) after receiving the event, parse the key according to the event name and call a query to get the value.

5) if the amount of payload data to be passed is not large, it can be directly spliced to enevtName, which has no length limitation.

© 2019-2021 Red Date (Hong Kong) Technology Limited. all right reserved,powered by GitbookFile Modify: 2022-01-24 16:30:04

results matching ""

    No results matching ""

    results matching ""

      No results matching ""