SignedTransaction - corda

corda / net.corda.core.transactions / SignedTransaction

# SignedTransaction

`data class SignedTransaction : TransactionWithSignatures`

SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for a public key (including composite keys) 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 Merkle root 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.

### Parameters

`sigs` - a list of signatures from individual (non-composite) public keys. This is passed as a list of signatures when verifying composite key signatures, but may be used as individual signatures where a single key is expected to sign.

### Exceptions

#### SignaturesMissingException | `class SignaturesMissingException : NamedByHash, SignatureException, CordaThrowable`

### Constructors

#### <init> | `SignedTransaction(ctx: CoreTransaction, sigs: List<TransactionSignature>)` SignedTransaction wraps a serialized WireTransaction. It contains one or more signatures, each one for a public key (including composite keys) 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 Merkle root 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. `SignedTransaction(txBits: SerializedBytes<CoreTransaction>, sigs: List<TransactionSignature>)`

### Properties

#### coreTransaction | Lazily calculated access to the deserialised/hashed transaction data. `val coreTransaction: CoreTransaction`
#### id | The id of the contained WireTransaction. `val id: SecureHash`
#### inputs | Helper to access the inputs of the contained transaction. `val inputs: List<StateRef>`
#### networkParametersHash | Helper to access the network parameters hash for the contained transaction. `val networkParametersHash: SecureHash?`
#### notary | Helper to access the notary of the contained transaction. `val notary: Party?`
#### notaryChangeTx | Returns the contained NotaryChangeWireTransaction, or throws if this is a normal transaction. `val notaryChangeTx: NotaryChangeWireTransaction`
#### references | Helper to access the unspendable inputs of the contained transaction. `val references: List<StateRef>`
#### requiredSigningKeys | Specifies all the public keys that require signatures for the transaction to be valid. `val requiredSigningKeys: Set<PublicKey>`
#### sigs | a list of signatures from individual (non-composite) public keys. This is passed as a list of signatures when verifying composite key signatures, but may be used as individual signatures where a single key is expected to sign. `val sigs: List<TransactionSignature>`
#### tx | Returns the contained WireTransaction, or throws if this is a notary change or contract upgrade transaction. `val tx: WireTransaction`
#### txBits | `val txBits: SerializedBytes<CoreTransaction>`

### Functions

#### buildFilteredTransaction | Helper function to directly build a FilteredTransaction using provided filtering functions, without first accessing the WireTransaction. `fun buildFilteredTransaction(filtering: Predicate<Any>): FilteredTransaction`
#### getKeyDescriptions | Get a human readable description of where signatures are required from, and are missing, to assist in debugging the underlying cause. `fun getKeyDescriptions(keys: Set<PublicKey>): ArrayList<String>`
#### isNotaryChangeTransaction | `fun isNotaryChangeTransaction(): Boolean`
#### plus | Alias for withAdditionalSignature to let you use Kotlin operator overloading. `operator fun plus(sig: TransactionSignature): SignedTransaction` Alias for withAdditionalSignatures to let you use Kotlin operator overloading. `operator fun plus(sigList: Collection<TransactionSignature>): SignedTransaction`
#### resolveBaseTransaction | Resolves the underlying base transaction and then returns it, handling any special case transactions such as NotaryChangeWireTransaction. `fun resolveBaseTransaction(servicesForResolution: ServicesForResolution): BaseTransaction`
#### resolveContractUpgradeTransaction | If coreTransaction is a ContractUpgradeWireTransaction, loads the input states and resolves it to a ContractUpgradeLedgerTransaction so the signatures can be verified. `fun resolveContractUpgradeTransaction(services: ServicesForResolution): ContractUpgradeLedgerTransaction`
#### resolveNotaryChangeTransaction | If transaction is a NotaryChangeWireTransaction, loads the input states and resolves it to a NotaryChangeLedgerTransaction so the signatures can be verified. `fun resolveNotaryChangeTransaction(services: ServicesForResolution): NotaryChangeLedgerTransaction` `fun resolveNotaryChangeTransaction(services: ServiceHub): NotaryChangeLedgerTransaction`
#### resolveTransactionWithSignatures | Resolves the underlying transaction with signatures and then returns it, handling any special case transactions such as NotaryChangeWireTransaction. `fun resolveTransactionWithSignatures(services: ServicesForResolution): TransactionWithSignatures`
#### toLedgerTransaction | Checks the transaction's signatures are valid, optionally calls verifyRequiredSignatures 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. `fun toLedgerTransaction(services: ServiceHub, checkSufficientSignatures: Boolean = true): LedgerTransaction`
#### toString | `fun toString(): String`
#### verify | Checks the transaction's signatures are valid, optionally calls verifyRequiredSignatures to check all required signatures are present. Resolves inputs and attachments from the local storage and performs full transaction verification, including running the contracts. `fun verify(services: ServiceHub, checkSufficientSignatures: Boolean = true): Unit`
#### withAdditionalSignature | `fun withAdditionalSignature(keyPair: KeyPair, signatureMetadata: SignatureMetadata): SignedTransaction` Returns the same transaction but with an additional (unchecked) signature. `fun withAdditionalSignature(sig: TransactionSignature): SignedTransaction`
#### withAdditionalSignatures | Returns the same transaction but with an additional (unchecked) signatures. `fun withAdditionalSignatures(sigList: Iterable<TransactionSignature>): SignedTransaction`