Advanced contract design topics
In the following sections, we will explore topics that allow us to develop fully functional contracts including cross-contract and cross-ledger invocations, composite keys, querying techniques, indexing of data, and explain the key transaction mechanisms.
Cross-contract and cross-ledger invocation
In complex business process workflows spanning multiple contracts and channels, a contract may need to invoke other contracts as parts of its logic. In our solution, this happens when transactions of LetterOfCreditContract
and ExportLicenseContract
require information from TradeContract
about TradeAgreements
.
Both Contract APIs provide function invokeChaincode
, which calls the contract within the same or a different channel. The Java Contract API has the additional invokeChaincodeWithStringArgs
, which simplifies the handling of string arguments.
The functions use the transaction context of the calling function to invoke the contract and thus...