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
A number, its encoding, its digest, and its display text are different objects.
258 = 0x0102 → little-endian bytes 02 01.
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.
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.
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.
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.