【问题标题】:How to collect signatures from multiple state participants in a corda flow?如何从 Corda 流中的多个状态参与者收集签名?
【发布时间】:2018-01-10 16:28:10
【问题描述】:

我正在研究一个涉及三方的用例,比如说 PartyA、PartyB 和 PartyC。

在这种情况下,

  1. PartyA 发出一个 dealState(A 是唯一的参与者),

  2. 甲方将其卖给乙方(甲、乙为参与者),

  3. 现在甲方想把这个状态卖给丙方,但我们需要甲乙双方的签名,以及丙方接受销售过程的签名。

如何在第三种情况下收集原始发行方甲方的签名以使流程正常运行?

流程中的代码是这个(我作为PartyB销售)

val newOwnerFlow = initiateFlow(PartyC)

progressTracker.currentStep = GATHERING_SIGS

println("Finished gathering signatures stage 9")

// Send the state to the counterparty, and receive it back with their signature.
val fullySignedTx = subFlow(CollectSignaturesFlow(partSignedTx, setOf(newOwnerFlow), GATHERING_SIGS.childProgressTracker()))

// Stage 10.
progressTracker.currentStep = FINALISING_TRANSACTION

println("Finalizing transaction")

// Notarise and record the transaction in both parties' vaults.

return subFlow(FinalityFlow(fullySignedTx, FINALISING_TRANSACTION.childProgressTracker()))

如何让甲方签署交易?

【问题讨论】:

    标签: kotlin corda


    【解决方案1】:

    经过一些实验,我发现问题如下:

    您必须创建一个 setOf(flowSessions) 将每个参与者映射到其对应的initialFlow(),该initialFlow() 必须传递给CollectSignaturesFlow(),语法如下:

     val participantsParties = dealState.participants.map { serviceHub.identityService.wellKnownPartyFromAnonymous(it)!! }
    
     val flowSessions = (participantsParties - myIdentity).map { initiateFlow(it) }.toSet()
    
     progressTracker.currentStep = GATHERING_SIGS
    
     println("Finished gathering signatures stage 9")
    
     // Send the state to the counterparty, and receive it back with their signature.
    
     val fullySignedTx = subFlow(CollectSignaturesFlow(partSignedTx, flowSessions, GATHERING_SIGS.childProgressTracker()))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-20
      • 1970-01-01
      • 2023-04-07
      • 2018-11-01
      • 1970-01-01
      • 2021-10-01
      • 1970-01-01
      • 2020-06-11
      相关资源
      最近更新 更多