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_id [R] ¶
- @return [String] 32-byte transaction ID of the output being spent (internal byte order)
prev_tx_out_index [R] ¶
- @return [Integer] index of the output within the previous transaction
sequence [R] ¶
- @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, 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
txid_from_hex(hex) ¶
Convert a hex transaction ID to internal byte order (reversed). - @param hex [String] hex-encoded transaction ID (display order) - @return [String] 32-byte transaction ID in internal byte order
Public Instance Methods¶
initialize(prev_tx_id:, prev_tx_out_index:, unlocking_script: = nil, sequence: = 0xFFFFFFFF) ¶
- @param
prev_tx_id[String] 32-byte transaction ID (internal byte order) - @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_tx_id + 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)
txid_hex() ¶
The previous transaction ID in hex (display order). - @return [String] hex-encoded transaction ID