0
votes

I am using Corda Version 4.

My CorDapp has four nodes - Notary node (validating), "Node A", "Node B" and "Node C". Following are the flows defined in the app -

Flow 1: "Node A" signs and sends a trade request to "Node B". "Node C" is also notified.

Following is my code for flow 1:

val tx = TransactionBuilder(notary).withItems(
              StateAndContract(tradeProposal, IOU_CONTRACT_ID),
              Command(IOUContract.Commands.Issue(),     listOf(tradeProposal.sender.owningKey)))
              .addAttachment(secHash)
tx.setTimeWindow(serviceHub.clock.instant(), 180.seconds)
val signedTx = serviceHub.signInitialTransaction(tx)
signedTx.verify(serviceHub)
val NodeBFlow = initiateFlow(NodeB)
val NodeCFlow = initiateFlow(NodeC)
subFlow(FinalityFlow(signedTx, listOf(NodeBFlow ,NodeCFlow )))
return signedTx.tx.outRef<State>(0)

Flow 2: "Node B" approves the trade request, self-signs it, gets signature from A and closes the trade. "Node C" is also notified.

val tx = TransactionBuilder(notary).
withItems(
latestRecord,
StateAndContract(newState, IOU_CONTRACT_ID),
Command(IOUContract.Commands.Completed(),
newState.participants.map { it.owningKey }))
tx.setTimeWindow(serviceHub.clock.instant(), 600.seconds)
tx.verify(serviceHub)
val partSignedTx = serviceHub.signInitialTransaction(tx)
val NodeAFlow = initiateFlow(newState.sender)
val NodeCFlow = initiateFlow(newState.recipient2)
val fullySignedTx = subFlow(CollectSignaturesFlow(partSignedTx,     setOf(NodeAFlow ,NodeCFlow)))
return subFlow(FinalityFlow(fullySignedTx, listOf(NodeAFlow ,NodeCFlow)))

I am getting following error while executing flow 1 -

Missing signatures on transaction 58C11D for keys:         aL9YufujsPipKTb8fjj897654322ogVS1s67PBWD3vn2fGzjUbEnN, by signers: notary
net.corda.core.transactions.SignedTransaction$SignaturesMissingException:     Missing signatures on transaction 58C11D for keys:         aL9YufujsPipKTb8fjj897654322ogVS1s67PBWD3vn2fGzjUbEnN, by signers: notary
1

1 Answers

2
votes

The notary throws that error because NodeC is included in the FinalityFlow (which sends the transaction to the notary), however it isn't part of the signers for the transaction

If you want to notify Node C without making it a required participant & signatory to the transaction, you want to use an "observer" type setup, you can find a code example here:

https://docs.corda.net/tutorial-observer-nodes.html

  • Developer Relations at R3