Corda如何进行部分签名的交易Corda 4?

时间:2019-06-03 09:17:10

标签: corda

我正在尝试以下情况,

从甲方到乙方有一个基本的IOU交易,其中发起方甲方将仅签署该交易,乙方仅接受该交易(不签署)。为了实现以下目标,我使用Corda样本项目的IOU流程在Corda 3中做了以下工作。

  1. 1。在transaction命令中,我仅传递了发起者拥有的密钥,而不是发送两个参与者拥有的密钥
  2. 我从合同中删除了“所有签署人”支票
  3. 我删除了“收集对方签名”步骤。

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

  1. 由于我没有将接受者拥有密钥设置为 txcommand,事务保存在启动器中,但不保存 由于会话问题,我从 正在关注。reference
  2. 看一下引用我已对其进行了纠正,现在Corda期望接受者的签名也违背了我的用例,如果我不添加,则会引发以下错误
      

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

    上的签名

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

P.S:我正在使用cordapp示例Java代码

2 个答案:

答案 0 :(得分:0)

这是实现相同功能的样品流

  @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))
        }
    }

答案 1 :(得分:0)

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