Saturday, December 2, 2023

segregated witness – Can a non-segwit transaction be serialized within the segwit format?

The prolonged serialization format launched in BIP144, which is used for serializing witnesses, specifies:

If the witness is empty, the previous serialization format have to be used.

So, no, utilizing the prolonged serialization format for a transaction with all empty witnesses can be incorrect.

Be aware that this isn’t a consensus or coverage rule, however only a serialization rule. Violating it doesn’t suggest the transaction is invalid or non-standard, solely that it was conveyed in an incorrect method. It is a property of the protocol used between nodes, however in principle, two nodes may privately agree on a distinct protocol which has completely different serialization guidelines, so long as they use the conventional protocol with regular nodes.

That mentioned, the wtxid launched in BIP141 is outlined because the double-SHA256 hash of the BIP144 serialization of the transaction. This facet is a concensus rule, because the hash worth is normative. Even hypothetical nodes that use a distinct serialization format should use the BIP144 serialization for wtxid computation. Particularly, the mix implies that for non-segwit transactions the txid and wtxid are equal.

It’s also the case that Bitcoin Core variations 0.14.x by means of 0.18.x unintentionally permitted utilizing the prolonged format even for transactions with out witnesses. This was simply on deserialization; even when a transaction can be acquired this fashion, it might be serialized appropriately on relay.

Related Articles


Please enter your comment!
Please enter your name here

Latest Articles