7

Why does BIP 141 (segwit) define both virtual transaction size and weight?

Weight seems to be just four times virtual transaction size (or vice versa, depending on what you define first). Why are both needed?

1 Answer 1

7

The transaction limit under segwit is derived solely from the transaction weight and the block weight limit of 4,000,000 weight units.

Virtual transaction size was not used for the limit calculation because it is fractional when computed accurately. Bitcoin Core only uses integers in the consensus code and thus transitioned to transaction weight with the activation of segwit.

Virtual transaction size is merely provided as a convenient way of comparing segwit's effective transaction size to pre-segwit transaction sizes.


Adding a quote of the section to clarify: BIP141 specifies the following terms in regard to transaction size:

Transaction weight
is defined as Base transaction size * 3 + Total transaction size (ie. the same method as calculating Block weight from Base size and Total size).

Virtual transaction size
is defined as Transaction weight / 4 (rounded up to the next integer).

Base transaction size
is the size of the transaction serialized with the witness data stripped.

Total transaction size
is the transaction size in bytes serialized as described in BIP144, including base data and witness data.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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