<p>This is defined in <a href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#block-size" rel="nofollow noreferrer">BIP141</a>, section &quot;Block size&quot;:</p>
<blockquote>
<p>Blocks are currently limited to 1,000,000 bytes (1MB) total size. We
change this restriction as follows:</p>
<p><em>Block weight</em> is defined as <em>Base size</em> * 3 + <em>Total size</em>. (rationale[3])</p>
<p><em>Base size</em> is the block size in bytes with the original transaction
serialization without any witness-related data, as seen by a
non-upgraded node.</p>
<p><em>Total size</em> is the block size in bytes with transactions serialized as
described in BIP144, including base data and witness data.</p>
</blockquote>
<p>From this it follows that <code>marker</code>, <code>flag</code> and <code>witness</code> are all considered witness data for weight (and therefore fee) calculation, because these are exactly the fields not present in the original serialization.</p>

CC BY-SA 4.0
2023-04-25T18:26:31.420Z
2023-11-19T14:24:32.530Z
2023-11-19T14:24:32.530Z
Vojtěch Strnad
<p><strong>What fields in a transaction are considered witness data?</strong> I need this to calculate the <code>vsize</code> for fee.</p>
<p>My understanding is these are <code>marker</code>, <code>flag</code> and <code>witness</code> (from <a href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#user-content-Transaction_ID" rel="nofollow noreferrer">1</a> and <a href="https://bitcoincore.org/en/segwit_wallet_dev/#transaction-fee-estimation" rel="nofollow noreferrer">2</a>).</p>
<p>Or is it just <code>witness</code>, without <code>marker</code> and <code>flag</code>?</p>
<p>Did try to look in source code, but because still new was unsuccessful. Source code references appreciated.</p>

<transaction-fees><segregated-witness><transaction-weight><witness-data>
What is considered witness data in SegWit?
WebOrCode
# What is considered witness data in SegWit?

(Asked by: username_0 on 2023-04-25)

**What fields in a transaction are considered witness data?** I need this to calculate the `vsize` for fee.

My understanding is these are `marker`, `flag` and `witness` (from [1](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#user-content-Transaction_ID) and [2](https://bitcoincore.org/en/segwit_wallet_dev/#transaction-fee-estimation)).

Or is it just `witness`, without `marker` and `flag`?

Did try to look in source code, but because still new was unsuccessful. Source code references appreciated.

**Tags:** transaction-fees, segregated-witness, transaction-weight, witness-data


---

## 1 answers

### Answer by username_1 on 2023-04-25. Score: 5 | Accepted answer

This is defined in [BIP141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#block-size), section "Block size":

> Blocks are currently limited to 1,000,000 bytes (1MB) total size. We
> change this restriction as follows:
>
> *Block weight* is defined as *Base size* \* 3 + *Total size*. (rationale[3])
>
> *Base size* is the block size in bytes with the original transaction
> serialization without any witness-related data, as seen by a
> non-upgraded node.
>
> *Total size* is the block size in bytes with transactions serialized as
> described in BIP144, including base data and witness data.

From this it follows that `marker`, `flag` and `witness` are all considered witness data for weight (and therefore fee) calculation, because these are exactly the fields not present in the original serialization.


---

