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.
sig_op_count
property
writable
¶
The number of signature operations in this input.
signature_script_as_hex
property
¶
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.
__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:
|
signature_script
|
The unlocking script (signature).
TYPE:
|
sequence
|
Sequence number for relative time locks.
TYPE:
|
sig_op_count
|
Number of signature operations.
TYPE:
|
utxo
|
Optional UTXO entry reference for signing.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TransactionInput
|
A new TransactionInput instance.
TYPE:
|
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:
|
| RETURNS | DESCRIPTION |
|---|---|
TransactionInput
|
A new TransactionInput instance.
TYPE:
|
| 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:
|
to_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:
|