简体   繁体   中英

Signed contracts between two parties in hyperledger composer

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.

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.

Eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM