MuSig2 (BIP327)
Quick refs: protocol.md, key-agg.md, attacks.md
MuSig2 is the standard Schnorr key-aggregation protocol for Bitcoin.
n parties hold separate private keys, jointly produce a single public
key Q and a single signature (R, s) indistinguishable from a
single-key Schnorr signature.
Replaces MuSig1 (3-round) and MuSig-DN with simpler 2-round + better
security proofs.
Properties
- Indistinguishable — observers cannot tell
Q was aggregated.
- Off-chain coordination — n-of-n in 2 rounds with no on-chain
multisig.
- Provably secure in the Algorithmic One-More-Discrete-Log (AOMDL)
- Fits Taproot key-path — cheapest spend; no script-path needed
for cooperative case.
Two-round protocol summary
Round 1 — Nonce exchange
Each signer i:
- Generates two ephemeral nonces
(k_{i,1}, k_{i,2}).
- Computes
(R_{i,1}, R_{i,2}) = (k_{i,1}*G, k_{i,2}*G).
- Broadcasts
R_{i,1}, R_{i,2} to all other signers (66 bytes total).
Aggregator computes:
R_1 = sum(R_{i,1}), R_2 = sum(R_{i,2}).
b = TaggedHash("MuSig/noncecoef", R_1 || R_2 || agg_pubkey || msg).
R = R_1 + b*R_2.
Round 2 — Partial sig exchange
Each signer i:
- Computes their partial sig
s_i using R, message, key-agg
coefficient a_i, etc.
- Broadcasts
s_i.
Aggregator: s = sum(s_i) mod n.
Final sig: (R.x, s) — 64 bytes, valid BIP340 sig under Q.
Key aggregation
Inputs: pubkeys P_1, ..., P_n (in agreed-upon order)
1. L = sorted(P_i) (canonical order, byte-lex)
2. a_i = TaggedHash("KeyAgg coefficient", L || P_i.x)
3. Q = sum(a_i * P_i)
If Q.y is odd, parity bit g_q = -1, otherwise g_q = +1. This
parity is tracked through signing.
The coefficients a_i defeat the rogue-key attack that MuSig1
patched but earlier schemes had: an attacker who could pick their
public key after seeing others' would otherwise control the sum.
Tweaks (Taproot integration)
After key aggregation, Taproot tweak applies:
Q_tweaked = Q + t*G where t = TaggedHash("TapTweak", Q.x || merkle_root)
Signing for Q_tweaked requires an extra adjustment in the partial
sig phase. BIP327 specifies "tweak context" maintaining the
accumulated tweak.
Pre-shared nonces (NonceGen variants)
NonceGen deterministic from secret + msg + extra_in.
- "MuSig2 with non-determinism" requires careful aux entropy.
- Critical: nonces must NOT be reused across different signing
sessions, even with different messages. State must be persisted
carefully (e.g., in encrypted nonce wallet).
Use cases in Bitcoin
- Joint custody — 2 partners co-spend with single-sig appearance.
- Lightning — Taproot channels (BOLT update) replace OP_2 pubkey
with MuSig2-aggregated key for channel funding output.
- DAO multisig with privacy — n directors sign as one.
- Vault hot/cold cooperative spend — cold key + hot key
aggregated for everyday use.
- Coinjoin servers with k-anonymity → users + service jointly
sign.
Security caveats
- Concurrent sessions — naive per-signer parallel sessions enable
"Wagner-style" forge attacks. Solution in BIP327: nonce binding to
message (the
b coefficient).
- State persistence — nonces must be wiped after one use. Power
loss between round 1 and round 2 → must restart with fresh nonces.
- Hardware wallet support — limited as of 2024. Coldcard Mk4 has
experimental support; most others lag.
Implementations
libsecp256k1 (secp256k1_musig2_*).
rust-secp256k1 (musig2 module).
- BDK has
BdkSigner integration for MuSig2 (experimental).
ZkVM/bdk-sgx-style HSMs.
Common bugs
- Forgetting to apply parity flips during partial-sig phase
(
g_q and g_b must propagate).
- Reusing nonces across two attempts of the same session → key leak.
- Missing key-aggregation coefficient
a_i → produces a sig under a
different aggregated pubkey.
See also
1---2name: bitcoin-musig23description: |4 MuSig2 (BIP327): two-round Schnorr key aggregation for n-of-n5 multisig. Aggregates n public keys into a single 32-byte x-only6 pubkey indistinguishable from a single-sig. Used in Taproot7 cooperative spends.8 Quick refs: protocol round-trip, key aggregation math, common attacks.9 USE WHEN: implementing n-of-n cooperative Taproot signing, designing10 Lightning Taproot channels, joint custody.11allowed-tools: Read, Grep, Glob12metadata:13 source: https://skillmd.com/skills/claude-dev-suite/bitcoin-musig214---1516# MuSig2 (BIP327)1718> **Quick refs**: [protocol.md](quick-ref/protocol.md), [key-agg.md](quick-ref/key-agg.md), [attacks.md](quick-ref/attacks.md)1920MuSig2 is the **standard** Schnorr key-aggregation protocol for Bitcoin.21n parties hold separate private keys, jointly produce a single public22key `Q` and a single signature `(R, s)` indistinguishable from a23single-key Schnorr signature.2425Replaces MuSig1 (3-round) and MuSig-DN with simpler 2-round + better26security proofs.2728## Properties2930- **Indistinguishable** — observers cannot tell `Q` was aggregated.31- **Off-chain coordination** — n-of-n in 2 rounds with no on-chain32 multisig.33- **Provably secure** in the Algorithmic One-More-Discrete-Log (AOMDL)34 + Random Oracle Model.35- **Fits Taproot key-path** — cheapest spend; no script-path needed36 for cooperative case.3738## Two-round protocol summary3940### Round 1 — Nonce exchange4142Each signer i:431. Generates two ephemeral nonces `(k_{i,1}, k_{i,2})`.442. Computes `(R_{i,1}, R_{i,2}) = (k_{i,1}*G, k_{i,2}*G)`.453. Broadcasts `R_{i,1}, R_{i,2}` to all other signers (66 bytes total).4647Aggregator computes:48- `R_1 = sum(R_{i,1})`, `R_2 = sum(R_{i,2})`.49- `b = TaggedHash("MuSig/noncecoef", R_1 || R_2 || agg_pubkey || msg)`.50- `R = R_1 + b*R_2`.5152### Round 2 — Partial sig exchange5354Each signer i:551. Computes their partial sig `s_i` using `R`, message, key-agg56 coefficient `a_i`, etc.572. Broadcasts `s_i`.5859Aggregator: `s = sum(s_i) mod n`.6061Final sig: `(R.x, s)` — 64 bytes, valid BIP340 sig under `Q`.6263## Key aggregation6465```66Inputs: pubkeys P_1, ..., P_n (in agreed-upon order)671. L = sorted(P_i) (canonical order, byte-lex)682. a_i = TaggedHash("KeyAgg coefficient", L || P_i.x)693. Q = sum(a_i * P_i)70```7172If `Q.y` is odd, parity bit `g_q = -1`, otherwise `g_q = +1`. This73parity is tracked through signing.7475The coefficients `a_i` defeat the **rogue-key attack** that MuSig176patched but earlier schemes had: an attacker who could pick their77public key after seeing others' would otherwise control the sum.7879## Tweaks (Taproot integration)8081After key aggregation, Taproot tweak applies:82```83Q_tweaked = Q + t*G where t = TaggedHash("TapTweak", Q.x || merkle_root)84```8586Signing for `Q_tweaked` requires an extra adjustment in the partial87sig phase. BIP327 specifies "tweak context" maintaining the88accumulated tweak.8990## Pre-shared nonces (NonceGen variants)9192- `NonceGen` deterministic from secret + msg + extra_in.93- "MuSig2 with non-determinism" requires careful aux entropy.94- **Critical**: nonces must NOT be reused across different signing95 sessions, even with different messages. State must be persisted96 carefully (e.g., in encrypted nonce wallet).9798## Use cases in Bitcoin991001. **Joint custody** — 2 partners co-spend with single-sig appearance.1012. **Lightning** — Taproot channels (BOLT update) replace OP_2 pubkey102 with MuSig2-aggregated key for channel funding output.1033. **DAO multisig with privacy** — n directors sign as one.1044. **Vault hot/cold cooperative spend** — cold key + hot key105 aggregated for everyday use.1065. **Coinjoin servers** with k-anonymity → users + service jointly107 sign.108109## Security caveats110111- **Concurrent sessions** — naive per-signer parallel sessions enable112 "Wagner-style" forge attacks. Solution in BIP327: nonce binding to113 message (the `b` coefficient).114- **State persistence** — nonces must be wiped after one use. Power115 loss between round 1 and round 2 → must restart with fresh nonces.116- **Hardware wallet support** — limited as of 2024. Coldcard Mk4 has117 experimental support; most others lag.118119## Implementations120121- `libsecp256k1` (`secp256k1_musig2_*`).122- `rust-secp256k1` (musig2 module).123- BDK has `BdkSigner` integration for MuSig2 (experimental).124- `ZkVM`/`bdk-sgx`-style HSMs.125126## Common bugs127128- Forgetting to apply parity flips during partial-sig phase129 (`g_q` and `g_b` must propagate).130- Reusing nonces across two attempts of the same session → key leak.131- Missing key-aggregation coefficient `a_i` → produces a sig under a132 different aggregated pubkey.133134## See also135136- [schnorr/SKILL.md](../schnorr/SKILL.md)137- [frost/SKILL.md](../frost/SKILL.md)138- [adaptor-sigs/SKILL.md](../adaptor-sigs/SKILL.md)139- [../../protocol/taproot/SKILL.md](../../protocol/taproot/SKILL.md)