Nicholas Rogers
Nicholas Rogers

Reputation: 360

In Corda, am I able to include a party as an optional signer?

Is optional transaction signing is possible? I know that the command explicitly outlines the required signers (parties that must sign a transaction for it to be notarised), but can a party have the option to sign? How could we implement this?

The use-case is an anti-money laundering entity that will sign depending on the level of trust of the transacting party.

val requiredSigners = listOf<PublicKey>()
val optionalSigners = listOf<PublicKey>()

tb.addCommand(TestContract.Commands.TestCommand(), requiredSigners, optionalSigners)

The code above isn't possible using the existing SDK.

Upvotes: 1

Views: 141

Answers (1)

Nicholas Rogers
Nicholas Rogers

Reputation: 360

If the level of trust is known when creating a transaction, we can explicitly indicate the required signers when adding the TestCommand() to the transaction builder.

Once a transaction is signed, it becomes immutable. Which means we are unable to add additional required signers.

To enable optional signers, we would adjust the contents of the required signers based on the inputs to and outputs from the transaction builder (or any other business logic). Then in the Corda contract - we could verify the number of required signatures based on that same business logic.

In short: Commands define who needs to sign, but the check logic in your verify method in your Corda contract is what looks at the states included and decides which public keys should be in the commands. It is therefore perfectly possible to have conditional logic surrounding required signers.

Upvotes: 1

Related Questions