Reviewed Aug 2026
DE
BA-05 · LESSON 03

Serialization and txids

KEY DEFINITIONS

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.

55 min Difficulty 2/5 Not started

Loading lesson visuals...

01

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.

GUIDED EXPLANATION1/5 ideas inspected
1

Write fixed fields

A transaction starts with a four-byte little-endian version and ends with a four-byte little-endian locktime.

Inspect each idea before the worked example.
The worked example follows the explanation

Inspect every idea above to open it.

Important distinctionThe txid always commits to every signature and witness byte.

For SegWit transactions, txid excludes witness data while wtxid includes it. Legacy scriptSig data remains part of txid serialization.

02
FINISH LEARNING FIRST

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.