What is bitcoin v3 weights
Weight units are a measurement used to compare the size of different Bitcoin transactions to each other in proportion to the consensus -enforced maximum block size limit. Weight units are also what is bitcoin v3 weights to measure the size of other block chain data, such as block headers. As of Bitcoin Core 0. Virtual size vsizealso called virtual bytes vbytesare an alternative measurement, with one vbyte being equal to four weight units.
That means the maximum block size measured in vsize is 1 million vbytes. Bitcoin was released with an implicit maximum block size limit of 32 mibibytes 32 MiBwhich was the maximum allowed size of a P2P protocol block message. In both cases, to calculate how much a transaction or other data counted towards these maximum block size limits, you simply put the data in the format used by the P2P protocol's block message and counted the bytes.
The introduction of a soft-fork segregated witness segwit idea in late [4] meant that the transaction format could be extended what is bitcoin v3 weights new fields that would be excluded from the historic block size limits—allowing an increase in the maximum what is bitcoin v3 weights size.
But that increase was only possible in a soft fork if the new fields contributed less towards the maximum block size than the fields in the original transaction format. Although some people complained about that being unfair [5]many Bitcoin Protocol developers considered discounting the new fields to be advantageous. Witnesses do not need to be stored by all full nodes after they are processed, unlike other parts of a transaction, so they have less effect on the cost of node operation and arguably warrant a discount.
This introduction of a discount for certain fields in certain transactions lead to the development of the weight unit which allows easy comparison between transactions that contain the discounted fields and those that don't.
Weight units were designed to be fully backwards compatible with all previous versions of Bitcoin Core even though blocks created after segwit activated may include up to what is bitcoin v3 weights four times as much data as they what is bitcoin v3 weights previously.
For backwards compatibility with software using the earlier bytes metric [8]virtual size vsize was introduced. A unit of vsize is equal to four weight units. Some developers call a unit of vsize by the name of vbyte [9] because the number of bytes and vbytes in a transaction are identical for legacy transactions.
Transactions that don't use segregated witness segwit are currently called legacy transactions. For these what is bitcoin v3 weights, calculating the number of weight units in a transaction is as easy as putting the transaction into the format used in a P2P protocol block message, counting the number of bytes, and multiplying by four. For example, at the time of writing Januarythe most commonly seen transaction template in the block chain is a legacy transaction with one input using P2PKH with a compressed pubkey and two P2PKH outputs, or about bytes.
Here's a byte map what is bitcoin v3 weights that transaction template:. At weight, to include the above transaction in a block consumes 0. To convert from weight units to vbytes, divide the total by four. For legacy transactions, this means that vbytes are equal to bytes. Transactions that use segregated witnesses are called segwit transactions. For these transactions, calculating the number of weight units in a transaction is more complicated.
Here's a byte map of that transaction template with the segwit-specific fields highlighted in blue:. To change from bytes to weight units, we use the method described above where the what is bitcoin v3 weights fields stay the same size but the other fields are multiplied by four.
When displayed at the same scale, this makes it appear that the segwit fields have shrunk:. At weight units, to include the above transaction in a block consumes 0. The exact amount of space saved by converting from legacy transactions to segwit transactions will vary depending on various transaction details.
To convert from weight units to vbytes, divide by four. For the example transaction above, this makes the transaction Note that fractional vbytes are possible, but they may not be compatible with legacy applications that expect only integer values, so it is recommended [10] to round up. For example, Bitcoin Core reports this transaction as having a vsize of vbytes. Possibly because of the vbytes metric, it is a common misconception that segwit somehow makes transactions much smaller—but this is incorrect.
A byte transaction is bytes on-disk and over-the-wire. Segwit just what is bitcoin v3 weights those what is bitcoin v3 weights differently toward the maximum block size of 4M weight units. The maximum size of a block in bytes is nearly equal in number to the maximum amount of block weight units, so 4M weight units allows a block of almost 4M bytes 4MB. This is not a somehow "made-up" size; the maximum block size is really almost 4MB on-disk and over-the-wire.
However, this maximum can only be reached if the block is full of very weirdly-formatted transactions, so it should not usually be seen. The typical size of a block depends on the make-up of transactions in that block.
As ofthe average transaction make-up would lead to blocks with 4M weight units being about 2. The transaction's real size on disk and over the network is bytes, which is the size in bytes of the whole transaction expressed above in hexadecimal.
The weight is always greater than the real size, in this case weight units. The size in vbytes would be Retrieved from " https: Navigation menu Personal tools Create account Log in. Views Read View source View history.
Sister projects Essays Source. This page was last edited on 17 Januaryat Content is available under Creative Commons Attribution 3. Privacy policy About Bitcoin Wiki Disclaimers.