Advanced smart contract packaging
The final section in this chapter is a short but important one—how to best exploit smart contract packaging. In Chapter 7, Developing Applications, we learned that packaging was a fairly straightforward activity, and in many cases it will be so.
However, when using private data, verify-style, insert-style, and transfer-style contracts, there are opportunities and traps of which we should be aware.
In summary, proper packaging of smart contracts can:
- Allow different endorsement policies to be applied to the same smart contract
- Ensure organizations only see the smart contract code they need to see
- Minimize distribution of unnecessary code
As we saw in Chapter 6, Developing Smart Contracts, Fabric 2 has significantly improved smart contract packaging. The most important change is the introduction of a smart contract package (chaincode) definition. In most cases, there will be a one-to-one mapping between...