Forum chevron_right Corda 5 – CorDapp Development chevron_right Corda 5 Beta 2 Transaction Signatories & self signing changes.

  • Creator
    Topic
  • #11281
    Peter Li
    Keymaster

    In Corda 4 and Corda 5 beta 1, the self signing of the transaction is by a seperate function called signInitialTransaction() as in Corda 4 or toSignedTransaction(my key) as in Corda 5 beta 1.

    Starting from Corda 5 beta 2, we remove the parameter of toSignedTransaction() functions. As a result, all of the required signatures for a transaction will need to be added to the transaction via the addSignatories() functions when building the transaction.  (This signature is most likely the transaction proposer’s signature.)

    For example, Alice, Bob, Charlie three parties in a network:

    1. Alice borrow $10 from Bob, creating a loanstate between Alice and Bob
    2. Bob as the lender want to transfer his debt to Charlie, so the new loanstate is betwwen Alice and Charlie.

    Note that for step 2, Bob as the transaction initiator will propose the transaction. In the old fashion, he will put his own signature on the transaction after the transaction building, but now, the toSignedTransaction() does not take in any parameter now. So he needs to add his signature to the transaction when building the transaction.

     

     

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #11282
    Peter Li
    Keymaster

    Here is what happen if the transaction proposer does not add his/her own signature via the addSignatories() function:

    You will get an error saying: The publickeys do not have any private counterparts available

    #11386
    Sneha Damle
    Keymaster

    Take a look at the code sample which shows how signing is done in the current beta-2 release of Next-Gen Corda.

     

     

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Subscribe to our newsletter to stay up to date on the latest developer news, tools, and articles.