Matthew Layton
Matthew Layton

Reputation: 42229

Corda - multi-state transactions with different participant sets

I have a scenario where I want to issue several states to the network, but the states have different participants

Example

val state1 = ExampleState(ALICE, BOB)
val state2 = ExampleState(BOB, CHARLIE)

val command = Command(ExampleCommand.Issue(), ...participants?)

val transaction = TransactionBuilder(NOTARY)
    .addOutputState(state1, EXAMPLE_CONTRACT_ID)
    .addOutputState(state2, EXAMPLE_CONTRACT_ID)
    .addCommand(command)

Observations The first state needs to be signed by ALICE and BOB, but the second state needs to be signed by BOB and CHARLIE

Is it possible to perform this kind of transaction; i.e. a single transaction with multiple states, where each state may have different participants?

Upvotes: 1

Views: 532

Answers (1)

Roger Willis
Roger Willis

Reputation: 922

Yes, you shouldn't need to do anything special.

  • Commands specify the PublicKeys of who needs to sign.
  • State participants specify the distribution list for the states.

The PublicKeys listed in Commands are usually a subset of the PublicKeys in the participant lists of the states in the transaction.

Bear in mind that the distribution list for the transaction will be the union of all sets of participants in each state.

Upvotes: 1

Related Questions