4

The code says MAX_BLOCK_SERIALIZED_SIZE = 4000000, but that is actually not a actually consensus rule as stated here:

https://github.com/bitcoin/bitcoin/issues/10289

The actual consensus rule is based on MAX_BLOCK_WEIGHT, which is also 4000000. It's unclear to me what the minimum weight a p2wpk or p2wsh transaction can have. Specifically, what's the best witness-serialized size/weight ratio that a transaction can have post-segwit activation?

That should answer the question of what is the largest block size possible post-segwit activation.

3

The maximum block size is 4,000,000 bytes (4 MB). This is because the block weight calculation is base size (in MB) * 3 + total size (in MB) = block weight (see BIP 141). Since the only units are MB, the block weight's only units are also MB, thus the maximum block size is the same as the block weight.

The best possible size to weight ratio I can think of is a transaction which also spends a P2WSH output that has a ridiculous redeemscript. And then there's also the coinbase transaction and block header. The witness would be 4000000 - 240 * 3 - 240 = 3999040. So there is 3999040 bytes in the witness. The total block size is then 3999040 + 240 = 3999280 bytes.

  • 1
    Coinbase transactions can't spend anything. – Pieter Wuille Jun 27 '17 at 8:16
  • All. I thought there has been a coinbase in the past that spent coins. I guess I'm mistaken. – Andrew Chow Jun 27 '17 at 8:24
  • Is the 80-byte block header included in the calculation? – Jimmy Song Jun 27 '17 at 16:17
  • 1
    In theory, you can get pretty close to 4M, by having transactions that consist almost entirely of witness data. In practice, that won't happen for normal financial transactions, closer to 2M. – Pieter Wuille Aug 10 '17 at 2:35
  • 1
    @PieterWuille is it a mistake to measure weight in bytes? (Or MB) – pinhead Aug 23 '17 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.