Bytes, Weight, and Virtual Bytes: A Comprehensive Guide to Bitcoin Transaction Sizing

·

Understanding how to measure the size of a Bitcoin transaction is crucial for optimizing fees and blockchain efficiency. This guide explores three key metrics: Bytes, Weight Units, and Virtual Bytes—each serving distinct purposes in the Bitcoin ecosystem.


1. Bytes (b): The Fundamental Unit

Bytes represent the raw size of a transaction on disk or across the network. Every 2 hexadecimal characters in a transaction equate to 1 byte.

Key Features:

Example Transaction:
01000000000101dd40a8d7f105055e781afa632207f5d3c4b4f4cad9f0fb320d0f0aa8e1ba904b0000000000ffffffff021027000000000000160014858e1f88ff6f383f45a75088e15a095f20fc663f841c0000000000001976a9142241a6c3d4cc3367efaa88b58d24748caef79a7288ac02483045022100d66341c3e6ce846b92bedcf9bc673ab8e47b770c616618eb91009e44816f4c2f0220622b5ebf6afabee3f4255bbcb84609e1185d4b6b1055602f5eed2541e26324620121022ed6c6d33a59cc16d37ad9ba54230696bd5424b8931c2a68ce76b0dbbc222f6500000000
Size: 226 bytes.

👉 Learn more about transaction structures


2. Weight Units (wu): SegWit’s Efficiency Metric

Introduced in BIP 141, Weight Units optimize block space by discounting witness data (signatures) to incentivize SegWit adoption.

Calculation Formula:

Transaction ComponentMultiplier
Version, Inputs, Outputs, Locktime×4
Witness Data (Marker, Flag, Signatures)×1

Example:
For the 226-byte transaction above:

Purpose:


3. Virtual Bytes (vB): Bridging Legacy and SegWit

Virtual Bytes normalize transaction sizing for feerate comparisons by converting weight units into a byte-equivalent metric.

Key Points:

Example:

👉 Compare transaction fees effectively


Why Two Metrics? Weight vs. Virtual Bytes

"Weight is an integer. We only use integers in consensus code."
— Pieter Wuille, Bitcoin Core Developer

FAQs

Q1: How does SegWit reduce transaction fees?

A: By discounting witness data (75% smaller in vB), transactions occupy less block space, lowering fees.

Q2: Can a transaction’s vSize exceed its byte size?

A: No. vSize is always ≤ byte size due to witness discounts.

Q3: Why was the block size limit changed from bytes to weight?

A: To enable SegWit’s scalability benefits while maintaining backward compatibility.

Q4: How do I calculate fees using vB?

A: Multiply your desired sat/vB rate by the transaction’s vSize (e.g., 143.5 vB × 10 sat/vB = 1,435 sats).

Q5: Are non-SegWit transactions penalized?

A: Indirectly—they lack witness discounts, making them costlier per byte of block space.


Key Takeaways

By mastering these concepts, you can optimize transaction costs and contribute to Bitcoin’s scalability.

👉 Explore advanced Bitcoin transaction strategies