Skip to content

TransactionInput (Class)

A transaction input referencing a previous output.

Inputs reference UTXOs (unspent transaction outputs) that are being spent.

previous_outpoint property writable

previous_outpoint: TransactionOutpoint

The outpoint referencing the UTXO being spent.

sequence property writable

sequence: int

The sequence number used for relative time locks.

sig_op_count property writable

sig_op_count: int

The number of signature operations in this input.

signature_script_as_hex property

signature_script_as_hex: Optional[str]

The unlocking script (signature) as a hex string, or None if not set.

utxo property

utxo: Optional[UtxoEntryReference]

The UTXO entry reference for transaction signing, or None if not set.

__eq__

__eq__(other: TransactionInput) -> bool

__new__

__new__(previous_outpoint: TransactionOutpoint, signature_script: Binary, sequence: int, sig_op_count: int, utxo: Optional[UtxoEntryReference] = None) -> TransactionInput

Create a new transaction input.

PARAMETER DESCRIPTION
previous_outpoint

Reference to the UTXO being spent.

TYPE: TransactionOutpoint

signature_script

The unlocking script (signature).

TYPE: Binary

sequence

Sequence number for relative time locks.

TYPE: int

sig_op_count

Number of signature operations.

TYPE: int

utxo

Optional UTXO entry reference for signing.

TYPE: Optional[UtxoEntryReference] DEFAULT: None

RETURNS DESCRIPTION
TransactionInput

A new TransactionInput instance.

TYPE: TransactionInput

from_dict classmethod

from_dict(dict: dict) -> TransactionInput

Create a TransactionInput from a dictionary.

PARAMETER DESCRIPTION
dict

Dictionary containing transaction input fields with keys: - 'previousOutpoint' (dict): Dict with 'transactionId' (str) and 'index' (int) keys - 'signatureScript' (str | None): The signature script as hex string - 'sequence' (int): Sequence number - 'sigOpCount' (int): Signature operation count - 'utxo' (dict | None): Optional UTXO entry reference dict

TYPE: dict

RETURNS DESCRIPTION
TransactionInput

A new TransactionInput instance.

TYPE: TransactionInput

RAISES DESCRIPTION
KeyError

If required keys are missing.

ValueError

If values are invalid.

signature_script

signature_script(value: Binary) -> None

Set the unlocking script (signature).

PARAMETER DESCRIPTION
value

The signature script as bytes or hex string.

TYPE: Binary

to_dict

to_dict() -> dict

Get a dictionary representation of the TransactionInput. Note that this creates a second separate object on the Python heap.

RETURNS DESCRIPTION
dict

the TransactionInput in dictionary form.

TYPE: dict