net.corda.core.transactions

## Class LedgerTransaction

- BaseTransaction
- - net.corda.core.transactions.LedgerTransaction

- All Implemented Interfaces:
    NamedByHash

      public class LedgerTransaction
      extends BaseTransaction

  A LedgerTransaction is derived from a `class 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 `class Command`s to see if any keys are from a recognised party, thus converting the `class Command` objects into `class AuthenticatedObject`.

  - Deserialising the output states.

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

  See Also:
    `class WireTransaction`, `class Command`, `class Command`, `class AuthenticatedObject`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LedgerTransaction(java.util.List<? extends net.corda.core.contracts.StateAndRef<?>> inputs, java.util.List<? extends net.corda.core.contracts.TransactionState<? extends net.corda.core.contracts.ContractState>> outputs, java.util.List<? extends net.corda.core.contracts.AuthenticatedObject<? extends net.corda.core.contracts.CommandData>> commands, java.util.List<? extends net.corda.core.contracts.Attachment> attachments, SecureHash id, Party notary, java.util.List<? extends net.corda.core.crypto.CompositeKey> signers, Timestamp timestamp, TransactionType type)` A LedgerTransaction is derived from a `class WireTransaction`. It is the result of doing the following operations:

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object other)`
    `java.util.List<net.corda.core.contracts.Attachment>` | `getAttachments()` A list of
    `java.util.List<net.corda.core.contracts.AuthenticatedObject>` | `getCommands()` Arbitrary data passed to the program of each input state.
    `SecureHash` | `getId()` The hash of the original serialised WireTransaction.
    `java.util.List<net.corda.core.contracts.StateAndRef>` | `getInputs()` The resolved input states which will be consumed/invalidated by the execution of this transaction.
    `int` | `hashCode()`
    `<T extends ContractState> StateAndRef<T>` | `outRef(int index)`
    `TransactionForContract` | `toTransactionForContract()` Strips the transaction down to a form that is usable by the contract verify functions
    `void` | `verify()` Verifies this transaction and throws an exception if not valid, depending on the type. For general transactions:

    - ### Methods inherited from class net.corda.core.transactions.BaseTransaction

      `checkInvariants, equals, getInputs, getMustSign, getNotary, getOutputs, getTimestamp, getType, hashCode, toString`

    - ### Methods inherited from interface net.corda.core.contracts.NamedByHash

      `getId`

- - ### Constructor Detail

    - #### LedgerTransaction

          public LedgerTransaction(java.util.List<? extends net.corda.core.contracts.StateAndRef<?>> inputs,
                                   java.util.List<? extends net.corda.core.contracts.TransactionState<? extends net.corda.core.contracts.ContractState>> outputs,
                                   java.util.List<? extends net.corda.core.contracts.AuthenticatedObject<? extends net.corda.core.contracts.CommandData>> commands,
                                   java.util.List<? extends net.corda.core.contracts.Attachment> attachments,
                                   SecureHash id,
                                   Party notary,
                                   java.util.List<? extends net.corda.core.crypto.CompositeKey> signers,
                                   Timestamp timestamp,
                                   TransactionType type)

      A LedgerTransaction is derived from a `class 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 `class Command`s to see if any keys are from a recognised party, thus converting the `class Command` objects into `class AuthenticatedObject`.

      - Deserialising the output states.

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

      Parameters:
        `inputs` - The resolved input states which will be consumed/invalidated by the execution of this transaction.
        `commands` - Arbitrary data passed to the program of each input state.
        `attachments` - A list of`interface Attachment`objects identified by the transaction that are needed for this transaction to verify.
        `id` - The hash of the original serialised WireTransaction.
      See Also:
        `class WireTransaction`, `class Command`, `class Command`, `class AuthenticatedObject`

  - ### Method Detail

    - #### outRef

          public <T extends ContractState> StateAndRef<T> outRef(int index)

    - #### toTransactionForContract

          public TransactionForContract toTransactionForContract()

      Strips the transaction down to a form that is usable by the contract verify functions

    - #### verify

          public void verify()

      Verifies this transaction and throws an exception if not valid, depending on the type. For general transactions:

      - The contracts are run with the transaction as the input.

      - The list of keys mentioned in commands is compared against the signers list.

      Throws:
        - if anything goes wrong.

    - #### equals

          public boolean equals(java.lang.Object other)

    - #### hashCode

          public int hashCode()

    - #### getInputs

          public java.util.List<net.corda.core.contracts.StateAndRef> getInputs()

      The resolved input states which will be consumed/invalidated by the execution of this transaction.

    - #### getCommands

          public java.util.List<net.corda.core.contracts.AuthenticatedObject> getCommands()

      Arbitrary data passed to the program of each input state.

    - #### getAttachments

          public java.util.List<net.corda.core.contracts.Attachment> getAttachments()

      A list of

      `interface Attachment`objects identified by the transaction that are needed for this transaction to verify.

      See Also:
        `interface Attachment`

    - #### getId

          public SecureHash getId()

      The hash of the original serialised WireTransaction.