Bytes Before Blocks

A number, its encoding, its digest, and its display text are different objects. 258 = 0x0102 → little-endian bytes 02 01.

1 / 5

Canonical CompactSize

300 → fd 2c 01 → value 300, consumed 3. fd fc 00 is complete but noncanonical: 252 must use fc. fd 2c is truncated. Distinguish these failure causes.

2 / 5

Leave the next field alone

Decode fe 00 00 01 00 aa. What value is returned? How many bytes are consumed? Who owns aa? A field decoder leaves the rest; a full transaction parser rejects final leftovers.

3 / 5

Preserve leading zeros

Base58-only bytes 00 00 3a represent 58. The integer gives 21; two leading zero bytes add 11: result 1121. Base58Check additionally includes a version and four-byte checksum.

4 / 5

Diagnose a failed round trip

Version 00, payload 00 01 → body 00 00 01. Checksum ab fb 08 44; Base58Check 11BwW2qR. A valid checksum verifies byte consistency, not sender authority.

Implement both codecs; test explicit vectors, boundaries, truncation, invalid characters, and leading zeros before taking the checkpoint.

5 / 5
←/→ or click edges to navigate · ? help · N notes · F fullscreen