transactions – How do I decide whether or not an enter or output is segwit? – revisited

on

|

views

and

comments


The way in which the BIP141 segwit guidelines think about transactions is solely that each transaction enter (even non-segwit ones) have a witness stack. Non-segwit inputs are required to have an empty witness stack nevertheless.

If each transaction enter has an empty witness stack, the previous pre-segwit transaction serialization is used for the transaction. If no less than one inout has a non-empty witness stack, the BIP144 transaction serialization format (together with marker & flag) is used. The non-segwit inputs then merely have an empty witness.

Now, there’s a consensus rule that claims that until a transaction enter is a segwit spend, its witness stack should be empty. An enter is a segwit spend if the UTXO it spends is a witness program (OP_n + push of 2-40 bytes), or if it’s a P2SH UTXO, whose redeemScript is such a witness program. If an enter is a segwit spend, the scriptSig should be precisely empty or precisely the P2SH redeemScript and nothing else. If an enter is not a segwit spend, the witness stack have to be empty. However all of that is guidelines that govern whether or not a transaction is legitimate w.r.t. its witnesses and scriptSigs; it’s unrelated as to whether the transaction has witnesses.

Share this
Tags

Must-read

Waymo raises $16bn to gas international robotaxi enlargement | Know-how

Self-driving automobile firm Waymo on Monday stated it raised $16bn in a funding spherical that valued the Alphabet subsidiary at $126bn.Waymo co-chief executives...

Self-driving taxis are coming to London – ought to we be anxious? | Jack Stilgoe

At the top of the nineteenth century, the world’s main cities had an issue. The streets had been flooded with manure, the unintended...

US regulators open inquiry into Waymo self-driving automobile that struck youngster in California | Expertise

The US’s federal transportation regulator stated Thursday it had opened an investigation after a Waymo self-driving car struck a toddler close to an...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here