<p>Have a look: <a href="https://blockchair.com/bitcoin/block/0000000000000000000cbbceb342e07071f9621607e044ec909aa86fcdf88e8a" rel="noreferrer">https://blockchair.com/bitcoin/block/0000000000000000000cbbceb342e07071f9621607e044ec909aa86fcdf88e8a</a></p>

<pre><code>Size = 1,158,038 bytes
Weight units = 3,992,825 WU
</code></pre>

<p>Now what does it mean? So the size is what you probably understand well – when you have a file on disk, its size is measured in bytes and this is exactly what the size means here. It is the number of bytes you would need to store such a block in memory or on disk. This is the sum of non-witness data (nWD) and witness data (WD). Let's call this the absolute size for clarity (AS).</p>

<p>There is also something called virtual size (VS). This is a new concept, which measures the block in new units, called vBytes. It is calculated as (absolute size of non-witness data) + (absolute size of witness data)/4.</p>

<p>Weight of the block (BW) is calculated in weight units and is calculated as (absolute size of non-witness data) * 4 + (absolute size of witness data). This actually equals what you have mentioned in your post: <code>(tx size with witness data stripped) * 3 + (tx size)</code> because the transaction itself contains both witness and non-witness data.</p>

<p>So, now we know that:</p>

<pre><code>AS = 1,158,038 bytes = nWD bytes + WD bytes
BW = 3,992,825 WU = nWD * 4 weight units + WD weight units
</code></pre>

<p>What are the limits in the protocol? Currently there is no block size limit any more. There is just one limit for block weight. This limit is set to 4,000,000 WU. It follows that in case of a block without Segwit txs, each byte's weight is 4 WU, therefore, such a block without Segwit txs is limited by absolute size of 1 MB. </p>

<p>Blocks that contain Segwit txs can be bigger than that and there are some theoretical calculations that say you can go to something like 3.7 MB of absolute size of a block. But this theoretical limit is just that – theoretical. In practice, even if the block was full of Segwit txs, its absolute size would not reach this limit. </p>

<p>Currently, most blocks contain both txs - Segwit and legacy, so we see the block sizes of full blocks usually in the range between 1 - 2.2 MB. The block is full if it's weight is very close to the protocol limit of 4,000,000 WU.</p>

<p>This implies that it is not correct to think that a block of size 1.1 MB is composed of 1,000,000 bytes of nWD and the rest is WD. That wouldn't work because the weight of 1,000,000 nWD bytes would already be 4,000,000 WU and therefore if we added the weight of WD to it, we would be over the limit. That is not possible.</p>

<p>So, if we know AS = 1,158,038 KB then it is rather that there are 944,929 bytes of nWD with weight of 3,779,716 WU and the rest is 213,109 bytes of WD with weight 213,109. This makes the total weight of the block 3,779,716 + 213,109 = 3,992,825 WU.</p>

<p>We can now calculate VS:</p>

<pre><code>VS = nWD vBytes + WD/4 vBytes = 944,929 + 213,109 / 4 = 998,206.25 vBytes
</code></pre>

<p>Virtual size (VS) thus cannot be greater than 1,000,000 vBytes, so this is what is meant if someone says that the new block size is still limited by 1 MB - they actually mean 1 million of vBytes.</p>

CC BY-SA 4.0
2019-05-27T07:53:34.210Z
wow.. really really clear. Thank a lot! but **"Currently, most blocks contain both txs - Segwit and legacy"** This sentence means even the latest block is still including a legacy transaction which has script inside?
HSKim
CC BY-SA 4.0
2019-05-27T15:53:00.123Z
Even the latest blocks contain non-Segwit transactions. But because they also contain Segwit transactions, the whole block is Segwit. I'm not sure what you mean by "script inside". Script is used in both Segwit and non-Segwit transactions. Because this topic is very wide, consider asking multiple questions with limited scope.
Wapac
CC BY-SA 4.0
2019-05-28T02:37:02.287Z
Thank you a lot very helpful. Have a nice week:)
HSKim
CC BY-SA 4.0
2019-05-25T10:31:38.170Z
2019-05-25T11:45:36.747Z
2019-05-25T11:45:36.747Z
Wapac
<p>It seems like duplicated question, but i read many articles and posts to undestand about segwit.</p>

<p>Below links are something i read</p>

<p><a href="https://bitcoin.stackexchange.com/questions/54726/what-is-block-weight-and-how-is-it-different-from-block-size">What is block weight and how is it different from block size?</a></p>

<p><a href="https://bitcoin.stackexchange.com/questions/54948/after-segwit-activation-what-is-the-largest-block-size-possible/54949#54949">After Segwit Activation, what is the largest block size possible?</a></p>

<p><a href="https://medium.com/@jimmysong/understanding-segwit-block-size-fd901b87c9d4" rel="nofollow noreferrer">Understanding Segwit Block Size</a></p>

<p><a href="https://en.bitcoinwiki.org/wiki/Block_weight" rel="nofollow noreferrer">Block weight</a></p>

<p>But i need example to clearfy about block weight T_T</p>

<p>In 
<a href="https://medium.com/@jimmysong/understanding-segwit-block-size-fd901b87c9d4" rel="nofollow noreferrer">Understanding Segwit Block Size</a> article, writer said that</p>

<blockquote>
  <p>The Segwit blocks are restricted by something called Block Weight.
  Block Weight is a new concept introduced in Segwit, and it’s calculated on a per-transaction basis. Each transaction has a “weight” which is defined this way: </p>
</blockquote>

<pre><code>(tx size with witness data stripped) * 3 + (tx size)
</code></pre>

<p>I think tx size is </p>

<pre><code>tx = transactions + witness data
</code></pre>

<p>Then i stuck in recursion... I cannot undetstand.</p>

<p>To me, it seems like contradictory.</p>

<p>Because to define a tx size, needs Block weight to restrict witness data size. But to get a weight, need a tx size.</p>

<p>I understood that if there is no witness data, then maximum block size is 1mb(Before segwit). Yes It is clear. But some people are using weight same with byte.</p>

<p>For example, some people said(especially bitcoin wiki - <a href="https://en.bitcoinwiki.org/wiki/Block_weight" rel="nofollow noreferrer">Block weight</a>)</p>

<pre><code>weight = 1mb * 3 + 1mb = 4mb
</code></pre>

<p>And others said(<a href="https://bitcoin.stackexchange.com/questions/54726/what-is-block-weight-and-how-is-it-different-from-block-size">What is block weight and how is it different from block size?</a>)</p>

<p>Even in this post, Sam Jone said 4,000,000 WU but block is still 1mb</p>

<pre><code>weight = 1mb * 3 + 1mb = 4,000,000 Weight unit(WU) Or 4mWU
</code></pre>

<p>what is the exact expression?</p>

<p>and If there is no witness data then what is left 3mb or 3mWU filled? is it empty?</p>

<p>In <a href="https://www.blockchain.com/ko/btc/block/0000000000000000000cbbceb342e07071f9621607e044ec909aa86fcdf88e8a" rel="nofollow noreferrer">Block #577639</a>, Block size is 1158.038 kB</p>

<p>How witness data is sotred?</p>

<p>1mb transaction + witness data right...?</p>

<p>or</p>

<p>1mb block is shared by transactions and witness data?</p>

<p>Basic concept of segwit is keep a block size as 1mb for transactions and add witness data right...?</p>

<p>It means size of transactions(witness data is excluded) is 1158.038kB?
or transactions + witness data is 1158.038kb?</p>

<p>As we know, maximum block weight is 4mWU or 4mb. Therefore, if transactions without witness data is about 1.1mb, then it seems like weird</p>

<pre><code>block weight = 1.1mb * 3 + (1.1mb + witnessdata)
</code></pre>

<p>Because it is larger than possible maximum size.</p>

<p>If transactions + witness data is about 1.1mb</p>

<pre><code>block weight = (1.1mb - witnessdata) * 3 + 1.1mb
</code></pre>

<p>this calculation seems more reasonable. But if witness data is less than 0.1mb then block weight is more than 4mb. Is it possible that so little witness data?</p>

<p>And If There is only transaction data and no witness data like 1mb transaction data and 0 witness data(block weight is 4mb or 4mWU which is theoritical maximum size)
Then how <em>Transaction Malleability</em> problem is solved?</p>

<p>I am so sorry. Questions are quite long, but i hope it can be helpful not only me but also person who are studying about blockchain.</p>

<p>Thank you for reading</p>

<blockchain><segregated-witness><blocksize><block-weight><witness-data>
Concept of Block weight and segwit are still unclear
HSKim
# Concept of Block weight and segwit are still unclear

(Asked by: username_0 on 2019-05-25)

It seems like duplicated question, but i read many articles and posts to undestand about segwit.

Below links are something i read

[What is block weight and how is it different from block size?](https://bitcoin.stackexchange.com/questions/54726/what-is-block-weight-and-how-is-it-different-from-block-size)

[After Segwit Activation, what is the largest block size possible?](https://bitcoin.stackexchange.com/questions/54948/after-segwit-activation-what-is-the-largest-block-size-possible/54949#54949)

[Understanding Segwit Block Size](https://medium.com/@jimmysong/understanding-segwit-block-size-fd901b87c9d4)

[Block weight](https://en.bitcoinwiki.org/wiki/Block_weight)

But i need example to clearfy about block weight T\_T

In
[Understanding Segwit Block Size](https://medium.com/@jimmysong/understanding-segwit-block-size-fd901b87c9d4) article, writer said that

> The Segwit blocks are restricted by something called Block Weight.
> Block Weight is a new concept introduced in Segwit, and it’s calculated on a per-transaction basis. Each transaction has a “weight” which is defined this way:

```
(tx size with witness data stripped) * 3 + (tx size)

```

I think tx size is

```
tx = transactions + witness data

```

Then i stuck in recursion... I cannot undetstand.

To me, it seems like contradictory.

Because to define a tx size, needs Block weight to restrict witness data size. But to get a weight, need a tx size.

I understood that if there is no witness data, then maximum block size is 1mb(Before segwit). Yes It is clear. But some people are using weight same with byte.

For example, some people said(especially bitcoin wiki - [Block weight](https://en.bitcoinwiki.org/wiki/Block_weight))

```
weight = 1mb * 3 + 1mb = 4mb

```

And others said([What is block weight and how is it different from block size?](https://bitcoin.stackexchange.com/questions/54726/what-is-block-weight-and-how-is-it-different-from-block-size))

Even in this post, Sam Jone said 4,000,000 WU but block is still 1mb

```
weight = 1mb * 3 + 1mb = 4,000,000 Weight unit(WU) Or 4mWU

```

what is the exact expression?

and If there is no witness data then what is left 3mb or 3mWU filled? is it empty?

In [Block #577639](https://www.blockchain.com/ko/btc/block/0000000000000000000cbbceb342e07071f9621607e044ec909aa86fcdf88e8a), Block size is 1158.038 kB

How witness data is sotred?

1mb transaction + witness data right...?

or

1mb block is shared by transactions and witness data?

Basic concept of segwit is keep a block size as 1mb for transactions and add witness data right...?

It means size of transactions(witness data is excluded) is 1158.038kB?
or transactions + witness data is 1158.038kb?

As we know, maximum block weight is 4mWU or 4mb. Therefore, if transactions without witness data is about 1.1mb, then it seems like weird

```
block weight = 1.1mb * 3 + (1.1mb + witnessdata)

```

Because it is larger than possible maximum size.

If transactions + witness data is about 1.1mb

```
block weight = (1.1mb - witnessdata) * 3 + 1.1mb

```

this calculation seems more reasonable. But if witness data is less than 0.1mb then block weight is more than 4mb. Is it possible that so little witness data?

And If There is only transaction data and no witness data like 1mb transaction data and 0 witness data(block weight is 4mb or 4mWU which is theoritical maximum size)
Then how *Transaction Malleability* problem is solved?

I am so sorry. Questions are quite long, but i hope it can be helpful not only me but also person who are studying about blockchain.

Thank you for reading

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


---

## 1 answers

### Answer by username_1 on 2019-05-25. Score: 7 | Accepted answer

Have a look: <https://blockchair.com/bitcoin/block/0000000000000000000cbbceb342e07071f9621607e044ec909aa86fcdf88e8a>

```
Size = 1,158,038 bytes
Weight units = 3,992,825 WU

```

Now what does it mean? So the size is what you probably understand well – when you have a file on disk, its size is measured in bytes and this is exactly what the size means here. It is the number of bytes you would need to store such a block in memory or on disk. This is the sum of non-witness data (nWD) and witness data (WD). Let's call this the absolute size for clarity (AS).

There is also something called virtual size (VS). This is a new concept, which measures the block in new units, called vBytes. It is calculated as (absolute size of non-witness data) + (absolute size of witness data)/4.

Weight of the block (BW) is calculated in weight units and is calculated as (absolute size of non-witness data) \* 4 + (absolute size of witness data). This actually equals what you have mentioned in your post: `(tx size with witness data stripped) * 3 + (tx size)` because the transaction itself contains both witness and non-witness data.

So, now we know that:

```
AS = 1,158,038 bytes = nWD bytes + WD bytes
BW = 3,992,825 WU = nWD * 4 weight units + WD weight units

```

What are the limits in the protocol? Currently there is no block size limit any more. There is just one limit for block weight. This limit is set to 4,000,000 WU. It follows that in case of a block without Segwit txs, each byte's weight is 4 WU, therefore, such a block without Segwit txs is limited by absolute size of 1 MB.

Blocks that contain Segwit txs can be bigger than that and there are some theoretical calculations that say you can go to something like 3.7 MB of absolute size of a block. But this theoretical limit is just that – theoretical. In practice, even if the block was full of Segwit txs, its absolute size would not reach this limit.

Currently, most blocks contain both txs - Segwit and legacy, so we see the block sizes of full blocks usually in the range between 1 - 2.2 MB. The block is full if it's weight is very close to the protocol limit of 4,000,000 WU.

This implies that it is not correct to think that a block of size 1.1 MB is composed of 1,000,000 bytes of nWD and the rest is WD. That wouldn't work because the weight of 1,000,000 nWD bytes would already be 4,000,000 WU and therefore if we added the weight of WD to it, we would be over the limit. That is not possible.

So, if we know AS = 1,158,038 KB then it is rather that there are 944,929 bytes of nWD with weight of 3,779,716 WU and the rest is 213,109 bytes of WD with weight 213,109. This makes the total weight of the block 3,779,716 + 213,109 = 3,992,825 WU.

We can now calculate VS:

```
VS = nWD vBytes + WD/4 vBytes = 944,929 + 213,109 / 4 = 998,206.25 vBytes

```

Virtual size (VS) thus cannot be greater than 1,000,000 vBytes, so this is what is meant if someone says that the new block size is still limited by 1 MB - they actually mean 1 million of vBytes.

> **Comments:**
> **username_0**: wow.. really really clear. Thank a lot! but **"Currently, most blocks contain both txs - Segwit and legacy"** This sentence means even the latest block is still including a legacy transaction which has script inside?  
> **username_1**: Even the latest blocks contain non-Segwit transactions. But because they also contain Segwit transactions, the whole block is Segwit. I'm not sure what you mean by "script inside". Script is used in both Segwit and non-Segwit transactions. Because this topic is very wide, consider asking multiple questions with limited scope.  
> **username_0**: Thank you a lot very helpful. Have a nice week:)  

---

