【问题标题】:Corda How to Transact a Partially Signed transaction corda 4?Corda 如何处理部分签名的交易corda 4?
【发布时间】:2019-06-19 20:41:43
【问题描述】:

我正在尝试做以下场景,

有一个基本的IOU交易是甲方到乙方的,甲方作为发起人只签署交易,乙方接受(不签署)。为了实现以下目标,我使用 corda 示例项目的 IOU 流程做了以下在 Corda 3 中运行良好的事情。

  1. 1.在事务命令中,我只传递了拥有密钥的发起者,而不是发送拥有密钥的参与者
  2. 我从合同中删除了“所有签名者”检查
  3. 我删除了“收集对方签名”步骤。

当我将其移至 corda 4 时,我注意到以下内容

  1. 由于我没有将拥有密钥的接受者设置为 txcommand , 事务保存在initiator中但不是part 由于我从 关注。reference
  2. 查看参考我相应地纠正了它,现在 Corda 期待接受者的签名也违反我的用例,如果我不添加,它会抛出以下错误

    'net.corda.core.transactions.SignedTransaction$SignaturesMissingException:Missing 交易签名'

如果有任何解决方法,请告诉我。

P.S : 我正在使用 cordapp-example Java 代码

【问题讨论】:

    标签: corda


    【解决方案1】:

    这是实现相同功能的示例流程

      @InitiatingFlow
        @StartableByRPC
        class IssuerRegistration(
                val issuerData: IssuerData
    
        ) : BaseFlow<String>() {
            override val progressTracker = ProgressTracker()
    
            @Suspendable
            override fun call(): String {
    
    
    // We retrieve the notary identity from the network map.
                val notary = firstNotary
    
    
    // We create the transaction components.
                val meta_Info = Meta_Info("pdf", Utils.getCurrentDateTime(), Utils.getCurrentDateTime())
                val ids = Ids(issuerData.ids.dunsId)
    
    //create list of all parties involved in this flow
                val partList = ArrayList<Party>()
    
                partList.add(ourIdentity)
                partList.add(createParty("partyb", serviceHub))
    
    
    
    //random unique id of the state
                val userUniqueId = UUID.randomUUID()
    
    //create output state actually this will
    //save to related parties vault
                val outputState = IssuerState(userUniqueId.toString(),
                        issuerData.company_id,
                        issuerData.company_name,
                        issuerData.company_symbol,
                        ids,
                        meta_Info,
                        partList)
    
    
    //registration command will be verified by issuercontract
                val command = Command(RegistrationCommand.IssuerRegistration(),
                        ourIdentity.owningKey)
    
    // We create a transaction builder and add the components.
                val txBuilder = TransactionBuilder(notary = notary)
                        .addOutputState(outputState, RegistrationContract.ID)
                        .addCommand(command)
    
    // Verifying the transaction.
                txBuilder.verify(serviceHub)
    
    // Signing the transaction. from sender side
                val signedTx = serviceHub.signInitialTransaction(txBuilder)
    
                val listOfSession = ArrayList<FlowSession>()
                //creating all other party session to get
                //signature from to validate the transaction
    
                 val otherPartySession = initiateFlow(otherPartySession)
                 listOfSession.add(otherPartySession)
    
    
    
    
    //end the flow and write the transation data to related parties vault
                subFlow(FinalityFlow(signedTx, listOfSession))
    
    
                return userUniqueId.toString()
            }
    
    
        }
    
    // Replace Responder's definition with:
        @InitiatedBy(Flows.IssuerRegistration::class)
        class IssueResponder(private val otherPartySession: FlowSession) : FlowLogic<Unit>() {
            @Suspendable
            override fun call() {
                subFlow(ReceiveFinalityFlow(otherPartySession))
            }
        }
    

    【讨论】:

      【解决方案2】:

      问题出在接受者方面,因为我使用的是 SignTransactionFlow,它希望参与者都是签名者。一旦我评论了代码并运行了 ReceiveFinalityFlow,它就可以正常工作了。参考:SignTransactionFlow

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-10-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-07-19
        • 2020-11-18
        • 1970-01-01
        相关资源
        最近更新 更多