wTXID Overview
wTXID (Witness Transaction ID)
In a SegWit-enabled world, every Bitcoin transaction actually has two different identities. The first is the standard TXID, and the second is the wTXID (Witness Transaction ID). Understanding the difference between them is key to understanding how SegWit fixed transaction malleability.
1. The Need for a Second ID
Before SegWit, if you changed a single byte in a transaction's signature (which is easy to do without invalidating it), the TXID would change. This "Malleability" made it difficult to build complex protocols like Lightning.
- The Solution: SegWit moved the signatures to a separate area and created a new identifier—the wTXID—that includes those signatures.
2. What is a wTXID?
The wTXID is the double-SHA256 hash of the entire transaction serialization, including:
-
The Marker and Flag bytes (00 01).
-
The transaction headers (Version, Inputs, Outputs, Locktime).
-
The Witness stack (Signatures and Scripts).
3. The Identity Split
-
TXID: Used for referencing coins in the UTXO Set. It does not change if the signature is modified.
-
wTXID: Used for block commitment. It does change if the signature is modified.
4. wTXID for Legacy Transactions
For older, non-SegWit transactions, the wTXID is defined to be identical to the TXID. This ensures that the block-building logic remains consistent regardless of which transaction types are included.
| Feature | TXID | wTXID |
|---|---|---|
| Includes Signatures? | No | Yes |
| Changes if Sig changes? | No (Safe) | Yes (Malleable) |
| Primary Use | UTXO Referencing | Block Commitment |
| Serialization | Base Data Only | Full SegWit Data |
In the next section, we will compare the Calculations of TXID vs. wTXID.
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: