net.corda.core.transactions / SignedTransaction

SignedTransaction

data class SignedTransaction : NamedByHash

SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for a public key that is mentioned inside a transaction command. SignedTransaction is the top level transaction type and the type most frequently passed around the network and stored. The identity of a transaction is the hash of a WireTransaction, therefore if you are storing data keyed by WT hash be aware that multiple different STs may map to the same key (and they could be different in important ways, like validity). The signatures on a SignedTransaction might be invalid or missing: the type does not imply validity. A transaction ID should be the hash of the WireTransaction Merkle tree root. Thus adding or removing a signature does not change it.



Exceptions

SignaturesMissingException class SignaturesMissingException : NamedByHash, SignatureException

Constructors

<init> SignedTransaction(txBits: SerializedBytes<WireTransaction>, sigs: List<WithKey>, id: SecureHash)

SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for a public key that is mentioned inside a transaction command. SignedTransaction is the top level transaction type and the type most frequently passed around the network and stored. The identity of a transaction is the hash of a WireTransaction, therefore if you are storing data keyed by WT hash be aware that multiple different STs may map to the same key (and they could be different in important ways, like validity). The signatures on a SignedTransaction might be invalid or missing: the type does not imply validity. A transaction ID should be the hash of the WireTransaction Merkle tree root. Thus adding or removing a signature does not change it.

Properties

id val id: SecureHash
sigs val sigs: List<WithKey>
tx val tx: WireTransaction

Lazily calculated access to the deserialised/hashed transaction data.

txBits val txBits: SerializedBytes<WireTransaction>

Functions

checkSignaturesAreValid fun checkSignaturesAreValid(): Unit

Mathematically validates the signatures that are present on this transaction. This does not imply that the signatures are by the right keys, or that there are sufficient signatures, just that they arent corrupt. If you use this function directly youll need to do the other checks yourself. Probably you want verifySignatures instead.

plus operator fun plus(sig: WithKey): SignedTransaction

Alias for withAdditionalSignature to let you use Kotlin operator overloading.

operator fun plus(sigList: Collection<WithKey>): SignedTransaction

Alias for withAdditionalSignatures to let you use Kotlin operator overloading.

toLedgerTransaction fun toLedgerTransaction(services: ServiceHub): LedgerTransaction

Calls verifySignatures to check all required signatures are present, and then calls WireTransaction.toLedgerTransaction with the passed in ServiceHub to resolve the dependencies, returning an unverified LedgerTransaction.

verifySignatures fun verifySignatures(vararg allowedToBeMissing: PublicKey): WireTransaction

Verifies the signatures on this transaction and throws if any are missing which arent passed as parameters. In this context, "verifying" means checking they are valid signatures and that their public keys are in the contained transactions BaseTransaction.mustSign property.

withAdditionalSignature fun withAdditionalSignature(sig: WithKey): SignedTransaction

Returns the same transaction but with an additional (unchecked) signature.

withAdditionalSignatures fun withAdditionalSignatures(sigList: Iterable<WithKey>): SignedTransaction

Returns the same transaction but with an additional (unchecked) signatures.