<p>Segwit changes the definition of a maximum block size to be something called block weight. The maximum block weight is 4000000 weight units. We use the following formula to calculate the block weight:</p>

<pre><code>3 * (size of non-witness data) + (size of everything including witness data)
</code></pre>

<p>So we can do some math here to figure out if the size of non-witness data will ever be more than 1 MB.</p>

<pre><code>Let x = size of non-witness data
Let y = size of just witnesses
4000000 &gt;= 3x + (x + y)
4000000 &gt;= 4x + y
4000000 - 4x &gt;= y
</code></pre>

<p>Since this is just a downwards sloping line, the point at which <code>y = 0</code> is where <code>x</code> will be the greatest. So setting y to 0:</p>

<pre><code>4000000 - 4x &gt;= 0
-4x &gt;= -4000000
 x &lt;= 1000000
</code></pre>

<p>Thus the largest the non-witness data can be is 1 MB, which is exactly the maximum block size for non-segwit nodes. Since non-segwit nodes will only see the non-witness data, segwit is backwards compatible as blocks would still be within the size limit.</p>

CC BY-SA 3.0
2017-08-14T07:42:55.693Z
2017-08-14T07:42:55.693Z
Ava Chow
<p>If SegWit results in production of blocks that are larger than 1MB, how do old nodes see them as valid, instead of rejecting them due to exceeding the maximal allowed size of 1MB?</p>

CC BY-SA 3.0
2017-08-13T18:02:18.267Z
there are some very genius people (aka sipa), who designed the blocks, which contain transactions in a way that particular parts of this transaction goes into a separate (segregated) area. This does not violate the validity of a tx. With the given space in a block, one can "bring in" more transactions in a block, which is roughly 1.8 tx more on average (a specific block reached up to 4 times more). So effectivly blocksize remains the same, it can just hold more tx, than before.
pebwindkraft
CC BY-SA 3.0
2017-08-13T20:08:28.613Z
@pebwindcraft Maybe I misunderstand you (comments are so short...), but Segwit absolutely increases the size of blocks - it's not just using the same space more efficiently. Old nodes however don't see part of the blocks, and as a result, it does not violate their consensus rules.
Pieter Wuille
CC BY-SA 3.0
2017-08-15T15:17:36.450Z
@pebwindkraft: Please do not answer questions in the comments. Instead post an answer. Comments are only meant to provide constructive feedback to the post, to request clarification, or to provide minor transient additional information.
Murch
<segregated-witness>
How does Segwit achieve backwards compatibility in terms of the block size?
user1633011
# How does Segwit achieve backwards compatibility in terms of the block size?

(Asked by: username_0 on 2017-08-13)

If SegWit results in production of blocks that are larger than 1MB, how do old nodes see them as valid, instead of rejecting them due to exceeding the maximal allowed size of 1MB?

**Tags:** segregated-witness

> **Comments:**
> **username_1**: there are some very genius people (aka sipa), who designed the blocks, which contain transactions in a way that particular parts of this transaction goes into a separate (segregated) area. This does not violate the validity of a tx. With the given space in a block, one can "bring in" more transactions in a block, which is roughly 1.8 tx more on average (a specific block reached up to 4 times more). So effectivly blocksize remains the same, it can just hold more tx, than before.  
> **username_2**: @pebwindcraft Maybe I misunderstand you (comments are so short...), but Segwit absolutely increases the size of blocks - it's not just using the same space more efficiently. Old nodes however don't see part of the blocks, and as a result, it does not violate their consensus rules.  
> **username_3**: @username_1: Please do not answer questions in the comments. Instead post an answer. Comments are only meant to provide constructive feedback to the post, to request clarification, or to provide minor transient additional information.  

---

## 1 answers

### Answer by username_4 on 2017-08-14. Score: 3

Segwit changes the definition of a maximum block size to be something called block weight. The maximum block weight is 4000000 weight units. We use the following formula to calculate the block weight:

```
3 * (size of non-witness data) + (size of everything including witness data)

```

So we can do some math here to figure out if the size of non-witness data will ever be more than 1 MB.

```
Let x = size of non-witness data
Let y = size of just witnesses
4000000 >= 3x + (x + y)
4000000 >= 4x + y
4000000 - 4x >= y

```

Since this is just a downwards sloping line, the point at which `y = 0` is where `x` will be the greatest. So setting y to 0:

```
4000000 - 4x >= 0
-4x >= -4000000
 x <= 1000000

```

Thus the largest the non-witness data can be is 1 MB, which is exactly the maximum block size for non-segwit nodes. Since non-segwit nodes will only see the non-witness data, segwit is backwards compatible as blocks would still be within the size limit.


---

