BIP-340 (Schnorr Signatures for Bitcoin)

The Schnorr signature specification for Bitcoin, using x-only public keys on secp256k1.

Basically

BIP-340 sets the rules for Schnorr signatures in Bitcoin. It uses shorter public keys and signatures, and lets several signers combine their signatures into one.

Key Takeaways

  • BIP-340 defines Schnorr signatures for Bitcoin's secp256k1 curve. It produces compact 64-byte signatures with x-only 32-byte public keys. It activated alongside Taproot at block 709,632 in November 2021.
  • Schnorr signatures are linear, so you can combine keys and signatures. Protocols like MuSig2 and FROST use this to make multisig transactions indistinguishable from single-key spends on-chain.
  • BIP-340 introduces tagged hashes and batch verification. Tagged hashes improve security through domain separation, which prevents cross-protocol attacks. Batch verification improves performance by verifying many signatures in a single operation.

What Is BIP-340?

BIP-340 is a Bitcoin Improvement Proposal authored by Pieter Wuille, Jonas Nick, and Tim Ruffing, published in January 2020. It specifies how Schnorr signatures operate on Bitcoin's secp256k1 elliptic curve, replacing the variable-length DER-encoded ECDSA signatures that Bitcoin used since its inception. The proposal forms the cryptographic foundation for the Taproot upgrade (BIP-341) and Tapscript (BIP-342).

Bitcoin relied exclusively on ECDSA for transaction signing before BIP-340. ECDSA is secure, but it lacks a property that cryptographers call linearity: the ability to combine multiple signatures into one. Schnorr signatures have this property, which unlocks advanced constructions including multi-signature aggregation, threshold signatures, and adaptor signatures, improving privacy, reducing transaction sizes, and lowering fees.

The scheme uses deliberate simplicity. It has fixed-size 64-byte signatures, 32-byte x-only public keys, and a straightforward verification equation. This simplicity makes formal security proofs more tractable: BIP-340 Schnorr is provably secure under the random oracle model assuming the hardness of the elliptic curve discrete logarithm problem (ECDLP).

How It Works

BIP-340 defines three core operations: key generation, signing, and verification. Each operation includes specific design choices that optimise for Bitcoin's needs.

X-Only Public Keys

Every point on secp256k1 has two possible Y coordinates for a given X coordinate, one even and one odd. Traditional compressed public keys use a 33-byte encoding: one prefix byte (0x02 or 0x03) to indicate the Y parity, plus the 32-byte X coordinate.

BIP-340 removes the prefix byte through a convention: the public key always corresponds to the point with an even Y coordinate. The signer negates the private key before signing if it produces an odd-Y public key. This saves 1 byte per public key and simplifies key aggregation schemes, since there is no parity ambiguity when summing keys.

The 32-byte x-only format is used in Taproot outputs (P2TR addresses), in witness data, and throughout Tapscript. It is fully compatible with existing key generation. Any valid secp256k1 private key works with BIP-340.

Tagged Hashes

BIP-340 introduces tagged hashes to prevent cross-protocol hash collisions. A tagged hash is computed as:

The tag is a UTF-8 string that identifies the context. BIP-340 uses three tags: "BIP0340/aux" for auxiliary randomness, "BIP0340/nonce" for nonce derivation, and "BIP0340/challenge" for the signature challenge. The double-hashed tag produces a unique 64-byte prefix for each context, so a hash output from one tag can never collide with a different tag's output, even if the input data is identical.

Domain separation provides a security property: it prevents an attacker from taking a hash value computed in one protocol and reinterpreting it in another. The 64-byte tag prefix also aligns with SHA-256's block size. Implementations can therefore precompute the initial hash state for each tag and reuse it across many operations.

Signing

You sign a message m with private key d. The process is:

The public key in the challenge hash provides key prefixing, which prevents related-key attacks where a signature valid for one key could be repurposed for a different key. The auxiliary randomness protects against side-channel attacks on the nonce generation without relying solely on deterministic derivation.

Verification

You verify a signature (r, s) against public key P and message m. The process is:

The signature is valid if all checks pass. The verification equation follows directly from the signing formula: s = k + e * d, so s * G = k * G + e * d * G = R + e * P, which rearranges to R = s * G - e * P.

Batch Verification

A node may need to verify many signatures at once, for example all transactions in a new block, and BIP-340 enables batch verification for this. The verifier combines the signatures into a single multi-scalar multiplication instead of checking each one individually:

The coefficients a2...au are random values that prevent a cancellation attack where invalid signatures could mask each other. Batch verification is significantly faster than individual verification because it replaces multiple independent elliptic curve multiplications with a single combined operation. The check fails with overwhelming probability if any signature in the batch is invalid.

The Linearity Property

Linearity is the most consequential feature of Schnorr signatures: given signatures from multiple signers on the same message, they can be algebraically combined into a single valid signature for the sum of their public keys. In concrete terms, if Alice signs with key dA and Bob signs with key dB, their individual signatures can be aggregated into one signature that verifies against PA + PB.

Linearity directly enables several advanced protocols. These protocols include:

ECDSA lacks this linearity, which is why pre-Taproot multisig required listing all public keys and signatures individually in the transaction. That approach consumed more block space and revealed the spending policy to the network.

Relationship to Taproot and Tapscript

BIP-340 was designed as part of a three-BIP package that activated together as the Taproot soft fork. It does not exist in isolation:

A Taproot output looks like a single public key on-chain in the key-path spend case. BIP-340's aggregation properties allow this single key to represent an n-of-n multisig group, a threshold signing quorum, or complex spending conditions: all hidden behind one 32-byte key and one 64-byte signature. For a comprehensive overview, see the Taproot and Schnorr signatures explained research article.

Privacy-Preserving Multisig

A 3-of-5 multisig transaction before Taproot required encoding all five public keys and three signatures in the witness. Anyone inspecting the blockchain could see the multisig policy. BIP-340 and MuSig2 allow the same 3-of-5 setup to produce a single key and signature via key-path spending, making it indistinguishable from an ordinary single-signer transaction.

Layer 2 Protocols

Layer 2 systems like Spark benefit from BIP-340's properties. FROST threshold signatures, built on Schnorr linearity, allow groups of operators to co-sign transactions without revealing the signing structure. Adaptor signatures enable trustless atomic operations between on-chain and off-chain state, and these building blocks make off-chain protocols more compact and private.

Efficient Block Validation

Batch verification allows Bitcoin nodes to validate an entire block's worth of Schnorr signatures faster than checking each one individually. Taproot adoption and wider use of BIP-340 signatures make this performance gain increasingly significant for node operators.

Cross-Input Signature Aggregation

BIP-340 lays the groundwork for cross-input signature aggregation, although it is not yet implemented in Bitcoin. A future upgrade could let all inputs in a transaction share a single aggregate signature. This would dramatically reduce transaction sizes for UTXO consolidation, CoinJoin transactions, and other multi-input spending patterns.

Nonce Generation

Schnorr signing is extremely sensitive to nonce quality. Reusing a nonce across two different messages leaks the private key entirely. BIP-340 mitigates this by combining deterministic nonce derivation from the private key and message with auxiliary randomness, which protects against differential fault attacks on hardware signing devices while the deterministic component ensures nonces are never accidentally repeated even if the random number generator fails.

Multi-Party Signing Complexity

BIP-340's linearity enables elegant multi-signature schemes, but the protocols built on top, MuSig2 and FROST, introduce their own complexity. Participants must coordinate nonce exchanges, handle abort cases, and avoid rogue-key attacks. These are solved problems at the protocol level, but incorrect implementations can compromise security.

Adoption and Compatibility

BIP-340 signatures are only valid within Taproot (P2TR) outputs. Legacy and SegWit v0 outputs continue to use ECDSA. Wallet software and signing devices must explicitly support Taproot key paths to benefit from Schnorr signatures, and while adoption has grown since activation, many wallets and services still default to SegWit v0 addresses.

No Signature Malleability

BIP-340 Schnorr signatures are non-malleable: for a given key and message, exactly one valid signature exists. This improves on ECDSA, where each signature has an inherent counterpart due to the negation of the s value. Non-malleability simplifies transaction tracking and eliminates an entire class of potential attacks, but it also means that any system relying on ECDSA malleability behaviour must be redesigned for Schnorr.

This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.

0

← All 1876 glossary terms