<p>That is not something specific to version 2 transactions.</p>

<p>What you are looking at are the marker and flag bytes for a segwit transaction. Segwit transactions have a slightly different transaction format which is specified in <a href="https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki" rel="noreferrer">BIP 144</a>.</p>

CC BY-SA 4.0
2019-02-09T17:05:47.357Z
2019-02-09T17:05:47.357Z
Ava Chow
<p>You might be interested in my article <a href="https://betterprogramming.pub/the-bitcoin-script-language-e4379908448f" rel="nofollow noreferrer">The Bitcoin Script Language</a>. A part of that is to go into details of the transaction format. Especially helpful is this graphic I've created:</p>
<p><a href="https://i.sstatic.net/BWNBc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BWNBc.png" alt="enter image description here" /></a></p>
<p>To answer the question directly: The first one is called &quot;marker&quot;, the second one is called &quot;flag&quot;. <a href="https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki" rel="nofollow noreferrer">BIP 144</a> gives more details:</p>
<ul>
<li>Rationale for not using just a single 0x00 byte as marker: that would lead to empty transactions (no inputs, no outputs, which are used in some tests) to be interpreted as new serialized data.</li>
<li>Rationale for the 0x01 flag byte in between: this will allow us to easily add more extra non-committed data to transactions (like txouts being spent, ...). It can be interpreted as a bitvector.</li>
</ul>
<p>See <a href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki" rel="nofollow noreferrer">BIP 141</a></p>

CC BY-SA 4.0
2021-04-15T06:38:29.473Z
2021-04-15T12:27:09.680Z
2021-04-15T12:27:09.680Z
Martin Thoma
<p>In the bitcoin transaction version 2, there are additional two bytes (hex: "0001") between transaction version (hex: "02000000"), and number of inputs (hex: "01"). What it is?</p>

<p>Here's an example <a href="https://btc-explorer.com/tx/4f692e7fb63256e4e741b952935e929ad545838d3697c5ee3f044a250c45fb4a" rel="nofollow noreferrer">https://btc-explorer.com/tx/4f692e7fb63256e4e741b952935e929ad545838d3697c5ee3f044a250c45fb4a</a></p>

<p>transaction hex: "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff4b031a0608048187145b622f4254432e434f4d2ffabe6d6dec50b9ca7f0e6731e89a2516f3df5fd7d65462ed2e68df7bf8e375232b7b28c701000000000000006200de217cb2aaea00000000ffffffff0212b0bf4a000000001976a91478ce48f88c94df3762da89dc8498205373a8ce6f88ac0000000000000000266a24aa21a9ed89dbbf72d51df862d19e0baa551d87e69b65a452496ec9d8203de66c754c30330120000000000000000000000000000000000000000000000000000000000000000000000000"</p>

<transactions><segregated-witness>
Transaction version 2 - bytes between tx version and number of inputs
Jan Siebert
# Transaction version 2 - bytes between tx version and number of inputs

(Asked by: username_0 on 2019-02-09)

In the bitcoin transaction version 2, there are additional two bytes (hex: "0001") between transaction version (hex: "02000000"), and number of inputs (hex: "01"). What it is?

Here's an example <https://btc-explorer.com/tx/4f692e7fb63256e4e741b952935e929ad545838d3697c5ee3f044a250c45fb4a>

transaction hex: "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff4b031a0608048187145b622f4254432e434f4d2ffabe6d6dec50b9ca7f0e6731e89a2516f3df5fd7d65462ed2e68df7bf8e375232b7b28c701000000000000006200de217cb2aaea00000000ffffffff0212b0bf4a000000001976a91478ce48f88c94df3762da89dc8498205373a8ce6f88ac0000000000000000266a24aa21a9ed89dbbf72d51df862d19e0baa551d87e69b65a452496ec9d8203de66c754c30330120000000000000000000000000000000000000000000000000000000000000000000000000"

**Tags:** transactions, segregated-witness


---

## 2 answers

### Answer by username_1 on 2019-02-09. Score: 5

That is not something specific to version 2 transactions.

What you are looking at are the marker and flag bytes for a segwit transaction. Segwit transactions have a slightly different transaction format which is specified in [BIP 144](https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki).


---

### Answer by username_2 on 2021-04-15. Score: 2

You might be interested in my article [The Bitcoin Script Language](https://betterprogramming.pub/the-bitcoin-script-language-e4379908448f). A part of that is to go into details of the transaction format. Especially helpful is this graphic I've created:

[![enter image description here](https://i.sstatic.net/BWNBc.png)](https://i.sstatic.net/BWNBc.png)

To answer the question directly: The first one is called "marker", the second one is called "flag". [BIP 144](https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki) gives more details:

* Rationale for not using just a single 0x00 byte as marker: that would lead to empty transactions (no inputs, no outputs, which are used in some tests) to be interpreted as new serialized data.
* Rationale for the 0x01 flag byte in between: this will allow us to easily add more extra non-committed data to transactions (like txouts being spent, ...). It can be interpreted as a bitvector.

See [BIP 141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)


---

