Repository navigation
v9.13.0 — verifying an anchor with a header alone now says what that proves
Verifying an anchor with a header alone now says what that actually proves.
9.12.0 stopped a free forgery. It does not stop a cheap one:
| work | cost to forge | |
|---|---|---|
| the default limit (difficulty 1) | 4,295,032,833 | ~4.3e9 hashes — seconds on one GPU, under a second on an ASIC |
| a real mainnet header (block 954784) | 109,822,554,288,093,618,317 | ~1.1e20, a factor of 2.6e10 more |
So NotaryHash.verify(certificate, { header }) with nothing else proves inclusion in a header that cost very little — unless that header came from a source you trust, which the library cannot know.
It now warns once when neither minWork nor blockHashAtHeight is given, and 10.0.0 will require one of them. Nothing throws today, the verdict is unchanged, and requirePow: false is silent. There is no universally right default to pick instead: minWork depends on the chain and the application, and a mainnet-shaped floor would break testnet.
// states where the header came from — your own chain source
NotaryHash.verify(cert, { header, blockHashAtHeight: myNode.hashAt(cert.spv.blockHeight) })
// or states the work you require
NotaryHash.verify(cert, { header, minWork: '100000000000000000000' })Also fixed: a powLimit or minWork passed as a BN was not range-checked, so powLimit: BN(2^256) admitted the very forgery the cap exists to refuse, and a negative BN minWork passed anything. Compact bits and decimal strings were already strict.
Both were found by an independent verification of the published 9.12.0 and of smartledger-bsv-core, which agreed on all 35 checks.
Full notes: CHANGELOG.md