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?
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?
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.
Virtual transaction size is merely provided as a convenient way of comparing segwit's effective transaction size to current 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 serialised 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.
vsize
- virtual size - from RPC, not weight.
– Karel Bílek
May 22 '17 at 22:39