Schnorr-BIP340
Bitcoin's x-only Schnorr signatures on secp256k1, introduced with Taproot
About Schnorr-BIP340
Schnorr-BIP340 is a digital signature scheme from the Schnorr signatures (BIP 340) family. It uses a 32-byte public key, a 32-byte secret key, a 64-byte signature and a 32-byte seed. Its registry entry cites BIP 340. It is also known as bip340 and schnorr. NextSSL lists it in the standard tier and exposes it through the safe API.
Overview
BIP 340 specifies Schnorr signatures over the secp256k1 curve for Bitcoin. Schnorr signatures have a simple security proof and are linear, which enables efficient multisignatures and batch verification.
The Schnorr scheme, published by Claus-Peter Schnorr in 1989, signs by committing to a random point R, hashing it with the public key and message into a challenge e, and responding with s = k + e*x. Its security reduces cleanly to the discrete logarithm problem in the random oracle model, and its linearity allows signatures and keys to be aggregated, which is the basis of protocols such as MuSig2 and FROST.
BIP 340 makes several Bitcoin-specific choices: public keys are 32-byte x-only coordinates with implicit even y, signatures are 64 bytes, hashes are tagged with a domain-specific prefix to prevent cross-protocol reuse, and nonces are derived from the secret key, message and auxiliary randomness. These signatures became usable on Bitcoin with the Taproot soft fork activated in 2021. One variant is present: schnorr-bip340.
History
2020–2020Schnorr signatures published
How it works
- KeyGen picks a scalar x and publishes the x-coordinate of P = xG, negating x if needed so P has even y.
- Sign derives nonce k from x, auxiliary randomness and the message, and computes R = kG with even y.
- The challenge e is a tagged SHA-256 hash of R, P and the message; s = k + e*x.
- Verify checks that sG - eP equals R.
Security notes
Not post-quantum. As with all Schnorr-type schemes, nonce reuse or bias leaks the private key; follow the BIP 340 nonce derivation. Multi-party protocols built on it need their own carefully analysed nonce handling.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| pk | 32 | Public key |
| sk | 32 | Secret key |
| sig | 64 | Signature |
| seed | 32 | Seed |
| ctx | 0 | Context string |
Use it
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
pk, sk = ns.call("sign_keygen", "schnorr-bip340", None, outs=2)
sig = ns.call("sign_detached", "schnorr-bip340", None, sk, b"message", b"")[0]
ok = ns.check("verify_detached", "schnorr-bip340", None, pk, b"message", b"", sig)
nextssl_sign_keygen("schnorr-bip340", NULL, pk, sk);
nextssl_sign_detached("schnorr-bip340", NULL, sk, msg, ctx, sig);
nextssl_verify_detached("schnorr-bip340", NULL, pk, msg, ctx, sig);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_sign_in(reg::all(), Policy::Safe, "schnorr-bip340", &Params::new())?;
let (pk, sk) = alg.keygen(&mut *rng)?;
let sig = alg.sign(&sk, b"message")?;
let ok = alg.verify(&pk, b"message", &sig)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
More digital signatures
All 503Frequently asked questions
What is Schnorr-BIP340?
Schnorr-BIP340 is a signature in the Schnorr signatures (BIP 340) family. BIP 340 specifies Schnorr signatures over the secp256k1 curve for Bitcoin. It is also known as bip340, schnorr.
What are the Schnorr-BIP340 sizes?
In NextSSL, Schnorr-BIP340 uses: public key 32 bytes, signature 64 bytes.
Is Schnorr-BIP340 post-quantum?
No. Schnorr-BIP340 is a classical signature based on elliptic curves or discrete logarithms, which a large quantum computer running Shor's algorithm could break. For post-quantum use, look at ML-DSA or SLH-DSA.
Who designed Schnorr-BIP340 and when?
Schnorr-BIP340 belongs to the Schnorr signatures (BIP 340) family, first published in 2020 by Pieter Wuille, Jonas Nick, Tim Ruffing (BIP 340); Claus-Peter Schnorr (original scheme). Its origin: Bitcoin Improvement Proposal 340.
Which standards define Schnorr-BIP340?
Schnorr-BIP340 is referenced by BIP 340.
Is Schnorr-BIP340 safe to use?
Schnorr-BIP340 is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.
Related families
Deterministic hashing of byte strings to elliptic curve points with the SSWU map
SHA-2The NIST Merkle–Damgård hash family behind most of today's TLS, signatures and software
ECDSAElliptic Curve Digital Signature Algorithm on NIST curves and secp256k1
EdDSADeterministic Edwards-curve signatures: Ed25519 and Ed448