1

In pre-segwit, block header bytes were counted as "1 byte" and participated equally in the block size up to 1MB. Since the header is 80 bytes, we would actually have 999,917 bytes (1,000,000 - 80 header bytes - 3 tx counter bytes) for transactions.

However, what in the case of post-segwit when there is no more calculation at the level of the real byte, but at the level of the WU? Are these header bytes treated as non-segwit bytes, i.e. cost 4 WU, so we actually have 3,999,668 WU (4,000,000 - 320 WU for header - 12 WU for tx counter) for transactions?

Does this then mean that, for example, in this block (click on Technical details to see all the block properties I'm talking about) the weight (3,992,825 WU) also includes 320 WU of header bytes and 12 WU of tx counter bytes. Additionally, the size (1,159,038 bytes) and stripped size (944,929 bytes) also include 80 bytes of header and 3 bytes of tx counter?

0

1 Answer 1

3

Are these header bytes treated as non-segwit bytes, i.e. cost 4 WU, so we actually have 3,999,668 WU (4,000,000 - 320 WU for header - 12 WU for tx counter) for transactions?

Yes. The header weighs 320 weight units. The transaction count is also part of the block serialization, which typically means another 3 vbytes or 12 WU that can't be used for transaction data per se.

The weight of a block is defined as its normal, full, pre-segwit serialized size times 3 plus one time its post-segwit serialized size. The header is included in both of these, and thus counted 4 times overall.

Does this then mean that, for example, in this block (click on Technical details to see all the block properties I'm talking about) the weight (3,992,825 WU) also includes 320 WU of header bytes and 12 WU of tx counter bytes. Additionally, the size (1,159,038 bytes) and stripped size (944,929 bytes) also include 80 bytes of header and 3 bytes of tx counter?

Exactly right on both counts.

16
  • Transaction count is not a part of a block header?
    – user144491
    Sep 16 at 1:57
  • 1
    The tx length field is 1 for up to 252 transactions, 3 for up to 2^16-1, 5 for up to 2^32-1, and 9 for up to 2^64-1. You can't actually have more than ~16000 transactions in a block without exceeding the weight limit, so the tx count is always 1, 3, or exceptionally 5 bytes (4, 12, or 20 WU). Sep 16 at 11:29
  • 1
    @ByzantineNode Yes, indeed. The tx count is also part of the stripped size, the serialized size, and thus (with a factor 4) also part of the weight, and the tx count serialization is 3 bytes for the block you link above. BTW, weight units are commonly abbreviated to WU (I've never seen WUI). Sep 16 at 11:50
  • 1
    Me neither, I used WUI only because he used that term, so as not to confuse him (I assumed he meant WU). Also, @ByzantineNode, the field indicating the number of transactions is most often called tx counter instead of tx count or tx number like you used first.
    – dassd
    Sep 16 at 11:59
  • 1
    @PieterWuille I did the edit myself, hope that's ok?
    – dassd
    Sep 17 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.