Class: ChaincodeInterface

ChaincodeInterface

Chaincodes must implement the methods in this interface. The Init() method is called during chaincode instantiation or upgrade to preform any necessary intitialization of the application state. Invoke() is called by invoke transaction or query requests. Both methods are provided with a stub object that can be used to discover information on the request (invoking identity, target channel, arguments, etc.) as well as talking with the peer to retrieve or update application state.

new ChaincodeInterface()

Methods


<async> Init(stub)

Called during chaincode instantiate and upgrade. This method can be used to initialize asset states
Parameters:
Name Type Description
stub ChaincodeStub The chaincode stub is implemented by the fabric-shim library and passed to the ChaincodeInterface calls by the Hyperledger Fabric platform. The stub encapsulates the APIs between the chaincode implementation and the Fabric peer

<async> Invoke(stub)

called throughout the life time of the chaincode to carry out business transaction logic and effect the asset states
Parameters:
Name Type Description
stub ChaincodeStub The chaincode stub is implemented by the fabric-shim library and passed to the ChaincodeInterface calls by the Hyperledger Fabric platform. The stub encapsulates the APIs between the chaincode implementation and the Fabric peer