Class BSV::Transaction::TransactionInput ¶
Inherits: Object
A transaction input referencing a previous output to spend.
Inputs identify the output being spent by its transaction ID and output index (the "outpoint"), and provide an unlocking script to satisfy the locking script conditions.
Attributes¶
prev_tx_out_index [R] ¶
- @return [Integer] index of the output within the previous transaction
prev_wtxid [R] ¶
- @return [String] 32-byte wire-order transaction ID of the output being spent
sequence [RW] ¶
- @return [Integer] sequence number (default: 0xFFFFFFFF)
source_locking_script [RW] ¶
- @return [Script::Script, nil] locking script of the source output (needed for sighash)
source_satoshis [RW] ¶
- @return [Integer, nil] satoshi value of the source output (needed for sighash)
source_transaction [RW] ¶
- @return [Transaction::Tx, nil] the full source transaction (for BEEF wiring)
unlocking_script [RW] ¶
- @return [Script::Script, nil] the unlocking script (set after signing)
unlocking_script_template [RW] ¶
- @return [UnlockingScriptTemplate, nil] template for deferred signing
Public Class Methods¶
from_binary(data, offset = 0) ¶
Deserialise a transaction input from binary data. - @param data [String] binary data - @param offset [Integer] byte offset to start reading from - @return [Array(TransactionInput, Integer)] the input and bytes consumed
wtxid_from_hex(hex) ¶
Convert a display-order hex transaction ID to wire-order bytes. - @param hex [String] hex-encoded transaction ID (display order) - @return [String] 32-byte transaction ID in wire byte order
Public Instance Methods¶
dtxid_hex() ¶
The previous transaction ID in display-order hex. - @return [String] hex-encoded transaction ID (display order)
initialize(prev_wtxid:, prev_tx_out_index:, unlocking_script: = nil, sequence: = 0xFFFFFFFF) ¶
- @param
prev_wtxid[String] 32-byte wire-order transaction ID - @param
prev_tx_out_index[Integer] output index in the previous transaction - @param
unlocking_script[Script::Script, nil] unlocking script (nil if unsigned) - @param
sequence[Integer] sequence number - @return [TransactionInput] a new instance of TransactionInput
outpoint_binary() ¶
Serialise the outpoint (prev_wtxid + output index) as binary. - @return [String] 36-byte outpoint
to_binary() ¶
Serialise the input to its binary wire format. - @return [String] binary input (outpoint + varint + script + sequence)