|
| 1 | +# 18.1: Understanding Schnorr Signatures |
| 2 | + |
| 3 | +Schnorr signatures are a gamechanger for Bitcoin. Here's a bit about what makes them uniquely useful. |
| 4 | + |
| 5 | +## Understand the Foundation of Schnorr Signatures |
| 6 | + |
| 7 | +Mathematically, Schnorr signatures take advantage of finite fields |
| 8 | +(originally, Schnorr groups, but in Bitcoin, an elliptic curve) to |
| 9 | +empower the discrete logarithm problem. It's easy to get from a |
| 10 | +private key to a public key, but all but impossible to go the opposite |
| 11 | +direction, with is obviously the characteristic required for |
| 12 | +public-key cryptography (and so signature systems) to work. |
| 13 | + |
| 14 | +But the math doesn't really matter to your understanding of why |
| 15 | +Schnorr signatures are a big upgrade for Bitcoin. That largely comes |
| 16 | +done to another singular characteristic of Schnorr signatures: because |
| 17 | +of their linearity, they're simply aggregatable. |
| 18 | + |
| 19 | +### Understand Aggregatable Multisig |
| 20 | + |
| 21 | +If you have two public keys, pA and pB, and you use the corresponding |
| 22 | +private keys to make two signatures, SA and sB, the two signatures can |
| 23 | +be added together (sA+sB) and they can be validated by adding together |
| 24 | +the two public keys (pA+pB). The summed-up signature is the same size |
| 25 | +as a singular signature, and the summed-up public key is the same size |
| 26 | +as a singular public key. There's also no way to distinguish a |
| 27 | +summed-up key or signature from a singular key or |
| 28 | +signature. Advantages of this include: |
| 29 | + |
| 30 | +* **Static Size.** ECDSA multisigs got bigger the more signatures you |
| 31 | +added, but a Schnorr signature always stays the same size, even if you |
| 32 | +have hundreds or thousands of signers. |
| 33 | +* **Privacy.** No one can see that you're using a multisig rather than |
| 34 | +a single signature. |
| 35 | + |
| 36 | +There are some challenges to using Schnorr for multisigs. In |
| 37 | +particular, simplistic ("naive") aggregation of signatures leads to |
| 38 | +the key cancellation attack, where a key can be removed from an |
| 39 | +aggregate if an attacker knows certain information. This has resulted |
| 40 | +in more complex signing systems such as FROST (discussed in |
| 41 | +[§18.3](18_3_Using_Bitcoin_With_FROST.md)), MuSig2 (discussed in |
| 42 | +[§18.4](18_4_Using_Bitcoin_With_MuSig2.md)), and use of a Merkle tree |
| 43 | +(discussed in [§19.3](19_3_Creating_a_Schnorr_Multisig.md)) being |
| 44 | +required to access Schnorr's advantages. |
| 45 | + |
| 46 | +### Understand Tweaked Signatures |
| 47 | + |
| 48 | +Because a Schnorr signature's equation is linear it can modified in |
| 49 | +other ways than just adding Schnorr signatures together. In |
| 50 | +particular, you can add a "tweak" to it, which is a static value. You |
| 51 | +tweak the public key (and so the address) with a specific value. You |
| 52 | +then tweak the private key with the same value before signing, and the |
| 53 | +tweaked signature matches the tweaked public key. |
| 54 | + |
| 55 | +This is how Taproot addresses are constructed: the public key is |
| 56 | +tweaked with the Merkle root hash to commit to the script path; or if |
| 57 | +there is no Merkle tree, it's instead tweaked with an unspendable |
| 58 | +opcode. |
| 59 | + |
| 60 | +### Understand Adaptor Signatures |
| 61 | + |
| 62 | +Finally, Schnorr signature's aggregatability also supports the creator |
| 63 | +of adaptor signatures. These allow multiple parties to commit to |
| 64 | +"tweaks" that are revealed simultaneously, allowing for the creation |
| 65 | +of CoinJoin protocols, atomic swaps, and other trustless exchanges. |
| 66 | + |
| 67 | +(They also go beyond the scope of this course currently, as they're |
| 68 | +less well-used to date than aggregated multisigs or tweaked |
| 69 | +signatures.) |
| 70 | + |
| 71 | +## Know the Advantages of Schnorr |
| 72 | + |
| 73 | +Besides aggregatability (and the efficiency and privacy that it brings), |
| 74 | +Schnorr signatures have a number of different advantages over |
| 75 | +ECDSA. These include: |
| 76 | + |
| 77 | +* **Smaller.** 64 bytes instead of 70-72. |
| 78 | +* **Batch Verification.** Multiple signatures can be verified at once. |
| 79 | +* **Not Malleable.** ECDSA signatures could be changed, Schnorr cannot. |
| 80 | + |
| 81 | +## Summary: Understanding Schnorr Signatures |
| 82 | + |
| 83 | +Schnorr signatures are a big improvement over ECDSA in large part |
| 84 | +because of their linearity, which makes them trivially |
| 85 | +aggregatable. This allows for the creation of static-sized, private |
| 86 | +multisigs and also is used to support the creation of Taproot addresses. |
| 87 | + |
| 88 | +> 🔥 ***What is the power of Schnorr?*** In large part, it's |
| 89 | +aggregatability. Any two signatures look the same, whether they're |
| 90 | +actually singular sigs, a bunch signatures added together, or a |
| 91 | +signature with a tweak to define something else (such as a script |
| 92 | +path). |
| 93 | + |
| 94 | +## What's Next? |
| 95 | + |
| 96 | +Continue "Using Schnorr" with [§18.2: Creating Taproot Addresses] |
| 97 | +(18_2_Creating_Taproot_Addresses.md). |
| 98 | + |
0 commit comments