Serialization and txids
Terms used in this lesson
- Transaction ID
- The identifier produced by hashing a Bitcoin transaction’s non-witness serialization.
- Witness
- Signatures, scripts, or other data supplied to satisfy a Bitcoin output’s spending condition.
- Witness transaction ID
- An identifier that commits to a transaction including its witness data.
- SegWit
- Segregated Witness: a Bitcoin upgrade that separates authorization data from the transaction identifier and introduces versioned witness programs.
- SHA-256
- A cryptographic hash function used throughout Bitcoin to produce fixed-size 256-bit digests.
Version, vectors, scripts, sequence, witness, and locktime serialize deterministically; txid and wtxid commit to different data.
Loading lesson visuals...
Learn the idea
Serialization turns transaction fields into one exact byte sequence. A compact-size integer prefixes variable-length vectors. The txid is the displayed byte-reversed double-SHA-256 digest of the legacy serialization, which excludes SegWit witness data. The wtxid applies the same digest convention to the serialization that includes marker, flag, and witness.
Write fixed fields
A transaction starts with a four-byte little-endian version and ends with a four-byte little-endian locktime.
Inspect every idea above to open it.
For SegWit transactions, txid excludes witness data while wtxid includes it. Legacy scriptSig data remains part of txid serialization.
The questions unlock after every required learning activity
Inspect every guided idea, open the worked example, rebuild its mechanism, and complete the deterministic lesson tool. Your progress is saved automatically.