<p>The extended serialization format introduced in <a href="https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki" rel="nofollow noreferrer">BIP144</a>, which is used for serializing witnesses, specifies:</p>
<blockquote>
<p>If the witness is empty, the old serialization format must be used.</p>
</blockquote>
<p>So, no, using the extended serialization format for a transaction with all empty witnesses would be incorrect.</p>
<p>Note that this is not a consensus or policy rule, but just a serialization rule. Violating it doesn't mean the transaction is invalid or non-standard, only that it was conveyed in an incorrect manner. It's a property of the protocol used between nodes, but in theory, two nodes could privately agree on a different protocol which has different serialization rules, as long as they use the normal protocol with normal nodes.</p>
<p>That said, the <code>wtxid</code> introduced in <a href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki" rel="nofollow noreferrer">BIP141</a> is defined as the double-SHA256 hash of the BIP144 serialization of the transaction. This aspect <em>is</em> a concensus rule, as the hash value is normative. Even hypothetical nodes that use a different serialization format must use the BIP144 serialization for <code>wtxid</code> computation. In particular, the combination implies that for non-segwit transactions the <code>txid</code> and <code>wtxid</code> are equal.</p>
<p>It is also the case that Bitcoin Core versions <a href="https://github.com/bitcoin/bitcoin/pull/8589" rel="nofollow noreferrer">0.14.x</a> through <a href="https://github.com/bitcoin/bitcoin/pull/14039" rel="nofollow noreferrer">0.18.x</a> unintentionally permitted using the extended format even for transactions without witnesses. This was just on deserialization; even if a transaction would be received this way, it would be serialized correctly on relay.</p>

CC BY-SA 4.0
2023-11-03T17:33:28.463Z
2023-11-03T17:40:43.737Z
2023-11-03T17:40:43.737Z
Pieter Wuille
<p>What would happen if a node sent a non-segwit transaction with flag and marker bytes announcing a witness section, but then put <code>0x00</code> for each input’s witness stack? Would this “waste of extra bytes” be acceptable to other nodes?</p>

<segregated-witness><serialization>
Can a non-segwit transaction be serialized in the segwit format?
Murch
# Can a non-segwit transaction be serialized in the segwit format?

(Asked by: username_0 on 2023-11-03)

What would happen if a node sent a non-segwit transaction with flag and marker bytes announcing a witness section, but then put `0x00` for each input’s witness stack? Would this “waste of extra bytes” be acceptable to other nodes?

**Tags:** segregated-witness, serialization


---

## 1 answers

### Answer by username_1 on 2023-11-03. Score: 2 | Accepted answer

The extended serialization format introduced in [BIP144](https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki), which is used for serializing witnesses, specifies:

> If the witness is empty, the old serialization format must be used.

So, no, using the extended serialization format for a transaction with all empty witnesses would be incorrect.

Note that this is not a consensus or policy rule, but just a serialization rule. Violating it doesn't mean the transaction is invalid or non-standard, only that it was conveyed in an incorrect manner. It's a property of the protocol used between nodes, but in theory, two nodes could privately agree on a different protocol which has different serialization rules, as long as they use the normal protocol with normal nodes.

That said, the `wtxid` introduced in [BIP141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki) is defined as the double-SHA256 hash of the BIP144 serialization of the transaction. This aspect *is* a concensus rule, as the hash value is normative. Even hypothetical nodes that use a different serialization format must use the BIP144 serialization for `wtxid` computation. In particular, the combination implies that for non-segwit transactions the `txid` and `wtxid` are equal.

It is also the case that Bitcoin Core versions [0.14.x](https://github.com/bitcoin/bitcoin/pull/8589) through [0.18.x](https://github.com/bitcoin/bitcoin/pull/14039) unintentionally permitted using the extended format even for transactions without witnesses. This was just on deserialization; even if a transaction would be received this way, it would be serialized correctly on relay.


---

