corda / net.corda.core.transactions / LedgerTransaction

# LedgerTransaction

`class LedgerTransaction : BaseTransaction`

A LedgerTransaction is derived from a WireTransaction. It is the result of doing the following operations:

- Downloading and locally storing all the dependencies of the transaction.
- Resolving the input states and loading them into memory.
- Doing some basic key lookups on the Commands to see if any keys are from a recognised party, thus converting the Command objects into AuthenticatedObject.
- Deserialising the output states.

All the above refer to inputs using a (txhash, output index) pair.

### Constructors

<init> | `LedgerTransaction(inputs: List<StateAndRef<*>>, outputs: List<TransactionState<ContractState>>, commands: List<AuthenticatedObject<CommandData>>, attachments: List<Attachment>, id: SecureHash, notary: Party?, signers: List<CompositeKey>, timestamp: Timestamp?, type: TransactionType)` A LedgerTransaction is derived from a WireTransaction. It is the result of doing the following operations:

### Properties

attachments | `val attachments: List<Attachment>` A list of Attachment objects identified by the transaction that are needed for this transaction to verify.
commands | `val commands: List<AuthenticatedObject<CommandData>>` Arbitrary data passed to the program of each input state.
id | `val id: SecureHash` The hash of the original serialised WireTransaction.
inputs | `val inputs: List<StateAndRef<*>>` The resolved input states which will be consumed/invalidated by the execution of this transaction.

### Inherited Properties

mustSign | `val mustSign: List<CompositeKey>` Composite keys that need to be fulfilled by signatures in order for the transaction to be valid. In a SignedTransaction this list is used to check whether there are any missing signatures. Note that there is nothing that forces the list to be the correct list of signers for this transaction until the transaction is verified by using LedgerTransaction.verify.
notary | `val notary: Party?` If present, the notary for this transaction. If absent then the transaction is not notarised at all. This is intended for issuance/genesis transactions that don't consume any other states and thus can't double spend anything.
outputs | `val outputs: List<TransactionState<ContractState>>` Ordered list of states defined by this transaction, along with the associated notaries.
timestamp | `val timestamp: Timestamp?` If specified, a time window in which this transaction may have been notarised. Contracts can check this time window to find out when a transaction is deemed to have occurred, from the ledger's perspective.
type | `val type: TransactionType` Pointer to a class that defines the behaviour of this transaction: either normal, or "notary changing".

### Functions

equals | `fun equals(other: Any?): Boolean`
hashCode | `fun hashCode(): Int`
outRef | `fun <T : ContractState> outRef(index: Int): StateAndRef<T>`
toTransactionForContract | `fun toTransactionForContract(): TransactionForContract` Strips the transaction down to a form that is usable by the contract verify functions
verify | `fun verify(): Unit` Verifies this transaction and throws an exception if not valid, depending on the type. For general transactions:

### Inherited Functions

checkInvariants | `fun checkInvariants(): Unit`
toString | `open fun toString(): String`