3

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 and 2).

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.

Vojtěch Strnad
  • 5,623
  • 1
  • 8
  • 31
WebOrCode
  • 323
  • 7

1 Answers1

4

This is defined in BIP141, 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..

Vojtěch Strnad
  • 5,623
  • 1
  • 8
  • 31