TxIn

class riemann.tx.TxIn(outpoint: riemann.tx.tx.Outpoint, stack_script: bytes, redeem_script: bytes, sequence: bytes)

A transaction input, composed of an outpoint, a script_sig and a sequence number. Legacy TxIn script sigs contain spend authorization information for the referenced UTXO. Compatibility TxIn script sigs contain the witness program only. Segwit Txin script sigs are empty.

The sequence number is used to set relative timelocks. See this blog post for details.

Parameters
  • outpoint – The Outpoint object pointing to the prevout being consumed by this input

  • stack_script – The Script program that sets the initial stack, if any. Legacy inputs are unsigned without this. Segwit inputs never have this.

  • redeem_script – The Script program that controls spending, if any. Only present when spending a Legacy or Compatibility SH UTXO. Segwit inputs never have this.

  • sequence – The 4-byte LE encoded sequence number of the input. Can be used to set relative timelocks.

outpoint

The Outpoint object pointing to the prevout being consumed by this input

stack_script

The Script program that sets the initial stack, if any. Legacy inputs are unsigned without this. Segwit inputs never have this.

redeem_script

The Script program that controls spending, if any. Only present when spending a Legacy or Compatibility SH UTXO. Segwit inputs never have this.

script_sig

The combined stack_script and redeem_script. For Legacy and Compatibility PKH transactions this will be equal to the stack script.

sequence

The 4-byte LE encoded sequence number of the input. Can be used to set relative timelocks.

copy(outpoint: Optional[riemann.tx.tx.Outpoint] = None, stack_script: Optional[bytes] = None, redeem_script: Optional[bytes] = None, sequence: Optional[bytes] = None) → riemann.tx.tx.TxIn

Make a new copy of the object with optional modifications.

classmethod from_bytes(byte_string: bytes) → riemann.tx.tx.TxIn

Parse a TxIn from a bytestring. Also available as from_hex

is_p2sh() → bool

Return True if the TxIn has a non-empty redeem_script