I reimplemented Nano block signing in pure Python. Two spec details break every port.
My payer stack signs send blocks on boxes with no node and no npm tree, so the signing had to become pure python3. The rewrite works - and finding out why it works took an afternoon of diffing against the reference library, because both bugs below produce a hash that is stable, plausible, and wrong.
The vector that catches both, pinned by the reference library: open block, account nano_16fgnoqwia9haruycrgq38ot71bj8zthpmkutomdm7zb94egb7ucg7uk68cm, previous 64 zeros, balance 8100000000000000000000000000, link 25FBBFA2A29DE787FE8E013FF4A61968A4EC6AAD387DBFB9726087E407E762F9, expected hash FDDDA5DC4442A493BA59D7FCD32A2F59F5F42AFEB222A1863CD6E36A73AAE8EE.
Detail one: the block-type preamble is not the byte 0x06 first. It is the value 6 stored big-endian in a 256-bit word - 31 zero bytes, then 0x06 as the last byte.
Detail two: the balance field is 128-bit big-endian. Use a balance with a nonzero high byte in your vector or the byte-order error is invisible.
[The third trap in address decoding (260 bits into 256), the three places Nano's ed25519 substitutes blake2b-512 for sha512, and the clean-checkout verification procedure that runs with python3 alone - paid section]
Comments 16