CompactSize and Bitcoin byte fields
Terms used in this lesson
- Outpoint
- A transaction ID plus output number that identifies one exact prior output.
Parse variable-length counts, fixed-width integers, hashes, scripts, and length-prefixed vectors without confusing display order with serialized order.
Loading lesson visuals...
Learn the idea
Bitcoin serialization combines fixed-width fields with CompactSize-prefixed vectors. CompactSize is a variable-length unsigned-integer encoding used for counts and lengths. It is not a general-purpose compressed number and it is not Bitcoin Script's signed-number encoding. A correct parser knows the field type before reading bytes.
Read the field specification
Determine whether the next field is a fixed-width integer, 32-byte hash, CompactSize count, length-prefixed byte vector, Script number, or raw byte sequence. The surrounding structure supplies meaning.
Inspect every idea above to open it.
CompactSize is a specific unsigned count and length encoding. Other fields keep their own fixed width or Script-number rules.
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.