Type alias TransactionCommon<InputType, OutputType>

TransactionCommon<InputType, OutputType>: {
    inputs: InputType[];
    locktime: number;
    outputs: OutputType[];
    version: number;
}

Data type representing a transaction.

Type Parameters

Type declaration

  • inputs: InputType[]

    An array of inputs included in this transaction.

    Input order is critical to signing serializations, and reordering inputs may invalidate transactions.

  • locktime: number

    The locktime at which this transaction is considered valid – a positive integer from 0 to a maximum of 4294967295.

    Locktime can be provided as either a timestamp or a block height. Values less than 500000000 are understood to be a block height (the current block number in the chain, beginning from block 0). Values greater than or equal to 500000000 are understood to be a UNIX timestamp.

    For validating timestamp values, the median timestamp of the last 11 blocks (Median Time-Past) is used. The precise behavior is defined in BIP113.

    If the sequenceNumber of every transaction input is set to 0xffffffff (4294967295), locktime is disabled, and the transaction may be added to a block even if the specified locktime has not yet been reached. When locktime is disabled, if an OP_CHECKLOCKTIMEVERIFY operation is encountered during the verification of any input, an error is produced, and the transaction is invalid.

    Remarks

    There is a subtle difference in how locktime is disabled for a transaction and how it is "disabled" for a single input: locktime is only disabled for a transaction if every input has a sequence number of 0xffffffff; however, within each input, if the sequence number is set to 0xffffffff, locktime is disabled for that input (and OP_CHECKLOCKTIMEVERIFY operations will error if encountered).

    This difference is a minor virtual machine optimization – it allows inputs to be properly validated without requiring the virtual machine to check the sequence number of every other input (only that of the current input).

    This is inconsequential for valid transactions, since any transaction that disables locktime must have disabled locktime for all of its inputs; OP_CHECKLOCKTIMEVERIFY is always properly enforced. However, because an input can individually "disable locktime" without the full transaction actually disabling locktime, it is possible that a carefully-crafted transaction may fail to verify because "locktime is disabled" for the input – even if locktime is actually enforced on the transaction level.

  • outputs: OutputType[]

    An array of outputs included in this transaction.

    Output order is critical to signing serializations, and reordering outputs may invalidate transactions.

  • version: number

    The version of this transaction – a positive integer from 0 to a maximum of 4294967295. Since BIP68, most transactions use a version of 2.

Generated using TypeDoc