<p>The maximum block size is 4,000,000 bytes (4 MB). This is because the block weight calculation is <code>base size (in MB) * 3 + total size (in MB) = block weight</code> (<a href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#block-size" rel="nofollow noreferrer">see BIP 141</a>). 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.</p>

<p>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 <code>4000000 - 240 * 3 - 240 = 3999040</code>. So there is 3999040 bytes in the witness. The total block size is then <code>3999040 + 240 = 3999280 bytes</code>.</p>

CC BY-SA 3.0
2017-06-27T08:16:18.943Z
Coinbase transactions can't spend anything.
Pieter Wuille
CC BY-SA 3.0
2017-06-27T08:24:13.860Z
All. I thought there has been a coinbase in the past that spent coins. I guess I'm mistaken.
Ava Chow
CC BY-SA 3.0
2017-06-27T16:17:51.263Z
Is the 80-byte block header included in the calculation?
Jimmy Song
CC BY-SA 3.0
2017-06-27T16:21:33.243Z
I'm pretty sure it is.
Ava Chow
CC BY-SA 3.0
2017-07-28T21:49:34.143Z
Total Size and Base Size both include nonwitness data? So some bytes are being counted twice? That means a 4MB block would be impossible
pinhead
CC BY-SA 3.0
2017-08-10T01:41:25.673Z
@PieterWuille is the 4MB answer correct? Wouldn't it be smaller because "total size" and "base size" BOTH include the same non-witness data? In calculating a block weight (with Max 400000) some bytes are counted twice, a 4MB block is impossible.
pinhead
CC BY-SA 3.0
2017-08-10T02:35:09.933Z
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
CC BY-SA 3.0
2017-08-23T21:46:22.960Z
@PieterWuille is it a mistake to measure weight in bytes? (Or MB)
pinhead
CC BY-SA 3.0
2017-06-27T07:28:08.497Z
2017-06-27T08:23:09.977Z
2017-06-27T08:23:09.977Z
Ava Chow
<p>The code says <code>MAX_BLOCK_SERIALIZED_SIZE = 4000000</code>, but that is actually not a actually consensus rule as stated here:</p>

<p><a href="https://github.com/bitcoin/bitcoin/issues/10289" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/issues/10289</a></p>

<p>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? </p>

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

<block><segregated-witness><blocksize><block-weight>
After Segwit Activation, what is the largest block size possible?
Jimmy Song
# After Segwit Activation, what is the largest block size possible?

(Asked by: username_0 on 2017-06-27)

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.

**Tags:** block, segregated-witness, blocksize, block-weight


---

## 1 answers

### Answer by username_1 on 2017-06-27. Score: 3 | Accepted answer

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](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#block-size)). 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`.

> **Comments:**
> **username_2**: Coinbase transactions can't spend anything.  
> **username_1**: All. I thought there has been a coinbase in the past that spent coins. I guess I'm mistaken.  
> **username_0**: Is the 80-byte block header included in the calculation?  
> **username_1**: I'm pretty sure it is.  
> **username_3**: Total Size and Base Size both include nonwitness data? So some bytes are being counted twice? That means a 4MB block would be impossible  
> **username_3**: @PieterWuille is the 4MB answer correct? Wouldn't it be smaller because "total size" and "base size" BOTH include the same non-witness data? In calculating a block weight (with Max 400000) some bytes are counted twice, a 4MB block is impossible.  
> **username_2**: 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.  
> **username_3**: @PieterWuille is it a mistake to measure weight in bytes? (Or MB)  

---

