Skip to main content

Module batch_verify

Module batch_verify 

Source
Expand description

Event signatures checked many at a time.

One BIP-340 batch equation (nostr-verify) accepts a whole slice of signatures for much less than one libsecp256k1 verification each: 1.7x at 16 signatures, 2.2x at 64 on an M4. Parsed keys are cached per thread, so a sender seen before skips its square root. A slice that fails is narrowed down and its signatures checked one at a time by libsecp256k1, so every false is the individual verifier’s verdict.

Only signatures: callers check the event id first, as Event::verify does.

Functions§

signature
Whether one event’s signature is valid for its id and author: Event::verify_signature, with the author’s parsed key from this thread’s cache.
signatures
Whether each event’s signature is valid for its id and author, in order.
stats
This thread’s counters: batches and how many held, key-cache hits and misses.