Transactions: Bytes and State
Parsing recognizes fields. Value validation checks available money. Script validation checks authorization. Keep their failure reports distinct.
1 / 5
Parsing recognizes fields. Value validation checks available money. Script validation checks authorization. Keep their failure reports distinct.
Version 2; one input, two-byte script; one output, one-byte script. Input count at 4; input script at 42; sequence at 44. Output count at 48; value at 49; output script at 58; LockTime at 59. A 253-byte input script changes both its length and its prefix width.
TxID is double-SHA256 of raw canonical bytes. Reject truncation, noncanonical CompactSize, and final trailing bytes. Round trips alone cannot detect a mistake shared by both codecs.
Start: A:0=7, A:1=5, B:0=9. T consumes both A outputs and creates T:0=8, T:1=3; fee=1. New map: B:0=9, T:0=8, T:1=3. A second spend of A:1 fails; rejection changes nothing.
Check all distinct inputs, checked sums, and funding first. Then remove inputs and add outputs under (transaction ID, index). Coinbase reward limits require block context; the isolated UTXO exercise lacks it.
Independently trace a follow-up spend and test rejection leaves the entire map unchanged. Explain why validating every block transaction against the initial map would admit conflicting spends.