0

I have seen similar questions without a clear answer. So, how does Segregated Witness make transactions smaller? I understand it removes data from the transaction hash and solves malleability ... But it adds a field called "witness", so, how does this save space?

Also (this is related and helps understand the question), how is block size calculated? Does it include the witness?

4

SegWit doesn't save space, per se.

What it does do is:

  1. From the perspective of a non-upgraded node, it makes transactions seem smaller. The witness part is not recognized or considered by pre-fork nodes, so more of them can fit in a block.

  2. From the perspective of an upgraded node, the block size is calculated differently. Less weight is assigned to witness data than to non-witness data. So for the purpose of the calculation, a SegWit transaction is considered lighter than a non-SegWit transaction. So more of them are allowed per block - but the physical data size of the block increases as a result.

SegWit was to be introduced anyway because it solves malleability etc. But it also offered an opportunity to increase the block size limit (to allow more transactions) without requiring a hard fork, and this opportunity was seized, resulting in the feature described above.

  • Hello. Thanks for the answer, you write "Less weight is assigned to witness data than to non-witness data", this is kind of confusing, can you elaborate? how is block size calculated? I will update the question to include this. – Alejandro Veintimilla Jul 30 at 0:12
  • 1
    Blocks are no longer limited by size in bytes, rather they are limited by the number of "weight units" which are an arbitrary unit based upon bytes. Each byte of a transaction that is not witness data (so everything that a non-segwit node would see) is worth 4 weight units. Every byte of witness data is worth 1 weight unit. Blocks are limited to 4000000 weight units, which, if full of non-segwit transactions, is 1 MB. – Andrew Chow Jul 30 at 3:00

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.