September 2019
Intermediate to advanced
350 pages
9h 23m
English
Here, we'll see how to trigger events from chaincode. Using the SetEvent() method of ChaincodeStubInterface, events can be triggered by chaincode. Add the following code in the approveCertificate() method to emit the event after the certificate status is changed:
var testEventValue []bytetestEventValue=[]byte("Certificate "+cert_id+" status is changed to "+status)stub.SetEvent("testEvent",testEventValue)
Read now
Unlock full access