Coding chaincode functions

In this section, we will implement the chaincode functions we looked at previously. To implement the chaincode functions, we will use three SHIM API functions that will read assets from the Worldstate and record changes. As we have already learned, reads and writes of these functions are recorded into ReadSet and WriteSet respectively, and the changes do not affect the state of the ledger immediately. Only after the transaction has passed through validation and has been committed into the ledger will the changes take effect.

The following snippet shows a list of asset API functions:

// Returns the value of the `key` from the Worldstate. // If the key does not exist in the Worldstate the function returns (nil, nil). ...

Get Blockchain Development with Hyperledger now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.