InputWitness

An InputWitness is the SegWit datastructure containing spend authorization for a specific input. It consists of a tuple (the stack) of WitnessStackItem objects.

Within a Tx the list of InputWitness objects is called tx_witnesses. Each witness and each item in its stack can be indexed by its position, e.g. my_tx.tx_witnesses[0].stack[4]. In the case of p2wsh inputs, the last stack item my_input_witness.stack[-1] is called the Witness Script, and contains a serialized Script program.

class riemann.tx.InputWitness(stack: Sequence[riemann.tx.tx.WitnessStackItem])

The witness for a Compatibility or Segwit TxIn. It consists of a stack that will be evaluated by the witness program, represented as an ordered list of WitnessStackItem objects.

Parameters

stack – the ordered sequence of WitnessStackItems

stack

the ordered sequence of WitnessStackItems

copy(stack: Optional[List[riemann.tx.tx.WitnessStackItem]] = None) → riemann.tx.tx.InputWitness

Make a new copy of the object with optional modifications.

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

Parse an InputWitness from a bytestring. Also available as from_hex