Publishing events

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 []byte

testEventValue=[]byte("Certificate "+cert_id+" status is changed to "+status)

stub.SetEvent("testEvent",testEventValue)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset