Reputation: 453
Im fairly new to the hyperledger scene and i'm doing a research project regarding DLT apps. In the scenario i'm researching it would be preferred for two parties to be able to sign a contract. I know this is possible in the raw hyperledger SDK in the form of signed chaincode but i would also like to make use of the modelling language end ease of composer.
My question: is it possible to generate, sign, deploy, instantie and call chaincode from within composer apps? If not what would be an alternative solution for doing so within composer? I'm thinking about defining a contract model but i'm not sure how to make sure both parties sign and attain ownership of said contract 'asset'; considering the nature of assets on the ledger.
Thanks in advance.
Upvotes: 0
Views: 255
Reputation: 2297
If you model a signature transaction, then your transaction processor function can consider your contract asset "signed" when it has 2 signatures, each submitted by different participants to the contract.
E.g. something like (not tested):
asset Contract {
Participant[] parties
Participant[] signatories
}
transaction Signature {
--> Contract contract
}
Pseudo code for TP function:
When a Signature is received, if the currentParticipant() is in the set of parties for the contract, and is not in the signatories, then add them to the signatories.
A contract is signed when all elements in the parties array are also in the signatories array.
Upvotes: 3