Wednesday, October 16, 2024

segregated witness – Which worth is acceptable for the MARKER area of a segwit tx messages: 0x00 or nonzero?


the marker would have to be 0 for outdated nodes to deal with the transaction as legitimate. […] Is there one thing I am lacking?

What you might be lacking is that outdated (pre-segwit) nodes by no means see segwit knowledge, when segwit nodes ship knowledge to pre-segwit nodes they edit out all of the segwit fields.

A part of the protocol handshake identifies segwit nodes

Consequently the marker is at all times zero and the one at present outlined worth for the flag is 1 (so far as I do know). When parsing I depend on the marker being zero, to differentiate it from an enter depend, however I enable for any non zero worth of flag.


Rationale for not utilizing only a single 0x00 byte as marker: that will result in empty transactions (no inputs, no outputs, that are utilized in some checks) to be interpreted as new serialized knowledge

This says that the 0x00 marker is crucial however is not adequate to reliably distinguish pre-segwit transaction serialisation from segwit transaction serialisation.

I consider it claims you want the extra flag to differentiate a segwit transaction (with any variety of inputs) from a pre-segwit transaction that has no inputs (enter depend = 0).

I do not suppose that is truly true for mainnet†. I feel there aren’t any transactions utilizing the pre-segwit serialisation that haven’t any inputs. Maybe it’s true for one of many different Bitcoin networks (testnet and so on). I wrote a parser that will fail if fed a pre-segwit transaction with no inputs – It hasn’t failed however admittedly I have not examined it in opposition to each transaction in the entire mainnet blockchain.


Associated


Footnotes

† Minimal variety of inputs

  1. https://developer.bitcoin.org/devguide/transactions.html says

    Every transaction has no less than one enter

  2. Easy methods to create a bitcoin transaction with out inputs

    Solely the coinbase transaction is allowed to have a null, or non-existent enter […] Coinbase transactions have inputs. They simply reference null outpoints

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles