MASTERING-BITCOIN
| Formula | Name | Description |
|---|---|---|
| Response equation | Combines nonce , challenge , and secret | |
| Verification check | Verifier confirms signature using only public values | |
| BIP340 challenge hash | Fiat-Shamir non-interactive challenge | |
| Nonce-reuse recovery | If is reused, secret is exposed |
The heart of Schnorr is the equation . To make this concrete, we'll work with scalar coefficients of β Alice's public key is , her commitment is , and the verifier checks that the scalar coefficients balance.
Adjust the secret , nonce , and challenge below to see how the response is constructed and verified.
β interactive visualization β coming to this page format soon
Notice: Both bars always have the same length, regardless of how you set , , or . This is the algebraic identity at the heart of Schnorr β multiplying by gives exactly . The verifier checks this equation using only public values (, , ), never seeing the secret or the nonce .
The nonce is single-use. If Alice ever signs two different messages with the same , the secret is no longer secret β anyone can recover it with simple algebra.
Below, set Alice's secret , the reused nonce , and two different challenges . The plot shows how the attacker recovers from the two leaked signatures.
β interactive visualization β coming to this page format soon
Reflect: Real Bitcoin wallets have been emptied this way β most famously, the Sony PlayStation 3 used a constant nonce in its ECDSA signing routine. BIP340 mandates deterministic nonce generation: . This way the nonce is unpredictable to outsiders, but the same key + same message produces the same nonce β so two different messages produce two different nonces, and the attack is impossible.
A BIP340 Schnorr signature is just two scalars worth of bytes. Compare its compactness to the older ECDSA format used in Bitcoin before Taproot.
β interactive visualization β coming to this page format soon
Notice: BIP340 fixes the y-coordinate of to be even, so only the x-coordinate needs to be transmitted. ECDSA must DER-encode two scalars of variable length (because leading zero bytes can shift), bloating the format. Multiply that ~7-byte savings by every input on every transaction in every block, and the scaling impact is real.
Question 1
Alice's secret is . She picks nonce , and the challenge comes out to . What is her response ?
β Correct! .
β Not quite. That's . The formula is β you need to multiply by first.
β Not quite. That's (wrong order of operations). Compute first, then add .
β Not quite. Apply carefully.
Solution:
The Schnorr response equation is:
Substituting:
Verification check (in scalar coefficients of ):
The signature verifies correctly.
Question 2
True or False: If Alice signs two different messages using the same nonce , the resulting signatures still keep her private key secret, because never appears in the signature directly.
β Correct! Reusing across two messages exposes via .
β Not quite. Although is masked by in a single signature, two signatures sharing the same let an attacker subtract them to cancel and solve for .
β Not quite. Try again β the hints above can help.
Solution: False.
Reusing the nonce is catastrophic. Suppose Alice produces two signatures with the same :
Subtracting eliminates entirely:
So anyone who sees both signatures can recover the secret directly:
This is exactly why BIP340 mandates deterministic nonce generation, , which guarantees a fresh for every distinct message.
Question 3
BIP340 uses the challenge hash , which includes the public key as an input. What attack does including in the hash specifically prevent?
β Correct! Including in the hash makes the parent's challenge differ from any related child's, so the algebraic shift used in the forgery cannot succeed.
β Not quite. The specific role of in the hash is to defeat forgeries that exploit related-key algebra (e.g., BIP32 child keys ).
Solution: Key-shift forgeries.
Without in the hash, the challenge is β independent of which public key the verifier checks against. An attacker who knows a publicly derivable offset (as in BIP32 unhardened derivation, where the child key is ) can take Alice's signature on the parent key and forge:
Then , which verifies under the child key for free.
Putting inside the hash makes , so the algebraic shift no longer lines up and the forgery dies.
The other options are unrelated:
Question 4
In Schnorr's identity protocol, why must Alice send the commitment before seeing Bob's challenge ?
β Correct! Without committing first, an attacker can pick freely and back-compute , producing a signature that verifies without knowing .
β Not quite. The ordering is load-bearing for security, not for performance or convenience. Think about what an attacker could do if they saw before committing to .
Solution: Reversing the order enables a trivial forgery.
If a (cheating) prover sees first, they can:
Plug into the verifier:
The signature verifies β yet the attacker never knew .
Committing to first locks in a specific before is known, so must be computed honestly using the secret . This commit-challenge-respond ordering is the heart of every sigma protocol, and it's exactly what the Fiat-Shamir transform must preserve (by hashing together with to derive ).
Solved: 0 / 4