Implementing chaincode functions
At this point, we now have the basic building blocks of chaincode. We have the Init
method, which initiates the chaincode and the Invoke
method, which receives request from the client and the access control mechanism. Now, we need to define the functionality of the chaincode.
Based on our scenario, the following tables summarize the list of functions that record and retrieve data to and from the ledger to provide the business logic of the smart contract. The tables also define the access control definitions of organization member, which are needed in order to invoke the respective functions.
The following table illustrates the chaincode modification functions, that is, how to record transactions on the ledger:
Function name | Permission to invoke | Description |
| Importer | Requests a trade agreement |
| Exporter | Accepts a trade agreement |
| Importer | Requests a letter of credit |
| Importer | Issues a letter of credit |
| Exporter | Accepts a letter of... |