corda / net.corda.core.flows / CollectSignaturesFlow / <init>


CollectSignaturesFlow(partiallySignedTx: SignedTransaction, sessionsToCollectFrom: Collection<FlowSession>, progressTracker: ProgressTracker = CollectSignaturesFlow.tracker()) CollectSignaturesFlow(partiallySignedTx: SignedTransaction, sessionsToCollectFrom: Collection<FlowSession>, myOptionalKeys: Iterable<PublicKey>?, progressTracker: ProgressTracker = CollectSignaturesFlow.tracker())

The CollectSignaturesFlow is used to automate the collection of counterparty signatures for a given transaction.

You would typically use this flow after you have built a transaction with the TransactionBuilder and signed it with your key pair. If there are additional signatures to collect then they can be collected using this flow. Signatures are collected based upon the WireTransaction.requiredSigningKeys property which contains the union of all the PublicKeys listed in the transaction's commands as well as a notary's public key, if required. This flow returns a SignedTransaction which can then be passed to the FinalityFlow for notarisation. The other side of this flow is the SignTransactionFlow.

WARNING: This flow ONLY works with ServiceHub.legalIdentityKeys and WILL break if used with randomly generated keys by the ServiceHub.keyManagementService.


  1. The provided transaction is invalid
  2. Any of the required signing parties cannot be found in the ServiceHub.networkMapCache of the initiator
  3. If the wrong key has been used by a counterparty to sign the transaction
  4. The counterparty rejects the provided transaction

Example - issuing a multi-lateral agreement which requires N signatures:

    val builder = TransactionBuilder(notaryRef)
    val issueCommand = Command(Agreement.Commands.Issue(), state.participants)

    builder.withItems(state, issueCommand)

    // Transaction creator signs transaction.
    val ptx = serviceHub.signInitialTransaction(builder)

    // Call to CollectSignaturesFlow.
    // The returned signed transaction will have all signatures appended apart from the notary's.
    val stx = subFlow(CollectSignaturesFlow(ptx))


partiallySignedTx - Transaction to collect the remaining signatures for

sessionsToCollectFrom - A session for every party we need to collect a signature from. Must be an exact match.

myOptionalKeys - set of keys in the transaction which are owned by this node. This includes keys used on commands, not just in the states. If null, the default well known identity of the node is used.