Transaction Size and Weight Overview
Transaction Size and Weight
In the early days of Bitcoin, transactions were measured purely in Raw Bytes, and blocks had a hard limit of 1 Megabyte. With the introduction of SegWit in 2017, the protocol moved to a more complex measurement system called Weight Units.
1. Raw Bytes (The Legacy Metric)
Raw bytes refer to the actual physical size of the transaction data as it travels across the network.
-
Every byte of data in a legacy transaction costs the same.
-
Before 2017, the 1MB limit was a strict "physical" limit on the
blk.datfiles.
2. Weight Units (The Modern Metric)
To fix transaction malleability and increase capacity, Bitcoin now uses Weight Units (WU).
-
A block is now limited to 4,000,000 Weight Units, rather than 1,000,000 bytes.
-
Data is classified into two categories: Non-Witness and Witness.
3. The Weight Calculation
The weight of a transaction is calculated as:
Weight = (Non-Witness Bytes * 4) + (Witness Bytes * 1)
This formula effectively creates a "discount" for signature data, which we will explore in the next section.
4. Why Use Weight?
By using weight instead of raw bytes, Bitcoin achieved several goals:
-
Soft Fork Compatibility: Older nodes still see a "stripped" transaction that fits within the 1MB limit.
-
Capacity Increase: By discounting signatures, blocks can now hold up to ~2MB to 4MB of actual data while staying within the 4M WU limit.
-
Incentivizing Best Practices: It makes using SegWit cheaper for users, encouraging adoption of more secure and scalable address formats.
| Metric | Limit Type | Value |
|---|---|---|
| Legacy Limit | Max Bytes | 1,000,000 |
| SegWit Limit | Max Weight Units | 4,000,000 |
| Max Theoretical Size | Max Raw Bytes | ~4,000,000 |
In the next section, we will deep dive into the 4:1 Witness Discount.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: