ServiceHub.signInitialTransaction - corda

corda / net.corda.core.node / ServiceHub / signInitialTransaction

# signInitialTransaction

`open fun signInitialTransaction(builder: TransactionBuilder, publicKey: PublicKey): SignedTransaction`

Helper method to construct an initial partially signed transaction from a TransactionBuilder using keys stored inside the node. Signature metadata is added automatically.

### Parameters

`builder` - The TransactionBuilder to seal with the node's signature. Any existing signatures on the builder will be preserved.

`publicKey` - The PublicKey matched to the internal java.security.PrivateKey to use in signing this transaction. If the passed in key is actually a CompositeKey the code searches for the first child key hosted within this node to sign with.

Return
Returns a SignedTransaction with the new node signature attached.

`open fun signInitialTransaction(builder: TransactionBuilder): SignedTransaction`

Helper method to construct an initial partially signed transaction from a TransactionBuilder using the default identity key contained in the node. The legal identity key is used to sign.

### Parameters

`builder` - The TransactionBuilder to seal with the node's signature. Any existing signatures on the builder will be preserved.

Return
Returns a SignedTransaction with the new node signature attached.

`open fun signInitialTransaction(builder: TransactionBuilder, signingPubKeys: Iterable<PublicKey>): SignedTransaction`

Helper method to construct an initial partially signed transaction from a TransactionBuilder using a set of keys all held in this node.

### Parameters

`builder` - The TransactionBuilder to seal with the node's signature. Any existing signatures on the builder will be preserved.

`signingPubKeys` - A list of PublicKeys used to lookup the matching java.security.PrivateKey and sign.

### Exceptions

`IllegalArgumentException` - is thrown if any keys are unavailable locally.

Return
Returns a SignedTransaction with the new node signature attached.