|
| 1 | +# 18.3: Using Bitcoin with FROST |
| 2 | + |
| 3 | +As demonstrated in the previous section, signing with Schnorr is |
| 4 | +easy. But what abouting signing Schnorr multisigs? There are at the |
| 5 | +moment three main ways to do so: FROST and MuSig2 can be seamlessly |
| 6 | +integrated into a Bitcoin transaction (but aren't seamlessly |
| 7 | +integrated into Bitcoin Core). Instead, Bitcoin Core depends on its |
| 8 | +Merkle trees for multisigs. This section and the next cover FROST and |
| 9 | +MuSig2 (in limited ways), while the next chapter includes discusison |
| 10 | +of MAST multisigs. |
| 11 | + |
| 12 | +## Understand FROST |
| 13 | + |
| 14 | +Bitcoin multisigs can't be naively created using Schnorr. If you just |
| 15 | +aggregate two keys, it's possible to cancel out one of the keys |
| 16 | +(provided you *know* the public key you're cancelling) and then sign |
| 17 | +with the other key. To resolve this requires a more complex |
| 18 | +protocols. One of these is FROST. |
| 19 | + |
| 20 | +FROST, which stands for Flexible Round-Optimized Schnorr Threshold |
| 21 | +Signatures is a threshold signature that allows for m-of-n Schnorr |
| 22 | +multisigs without succumbation to the cancellation attack. It does |
| 23 | +this through "signing shares" that can either be generated on a single |
| 24 | +machine and sent out or (more securely) generated using secure |
| 25 | +multi-party computation (SMPC) so that the full key never exists in a |
| 26 | +single place. |
| 27 | + |
| 28 | +## Use FROST |
| 29 | + |
| 30 | +Any Bitcoin wallet can create a Taproot address that is built on a |
| 31 | +FROST-generated key rather than a singular Schnorr key. That's the |
| 32 | +beauty of Schnorr: a multisig FROST key looks exactly the same as a |
| 33 | +singular Schnorr key. They're indistinguishable, and so they look just |
| 34 | +the same to a wallet. |
| 35 | + |
| 36 | +The trick comes in signing so that you can unlock the puzzle box of |
| 37 | +the FROST lock. A wallet _could_ support this functionality, but |
| 38 | +Bitcoin Core does not. In order to unlock funds locked into an address |
| 39 | +defined by a FROST public key, you therefore have to generate the |
| 40 | +appropriate signature _outside_ of Bitcoin Core and then sneak it into |
| 41 | +a Bitcoin transaction. This _is_ possible, but only with quite a few |
| 42 | +additional tools. |
| 43 | + |
| 44 | +Our [Learning FROST from the Command |
| 45 | +Line](https://learningfrost.blockchaincommons.com/) course is a |
| 46 | +four-chapter course that's largely focused on that end product: |
| 47 | +signing a transaction. Early chapters demonstrate how to install the |
| 48 | +ZF FROST tools, which are some of the best tools to date to do this |
| 49 | +work from the command line, and how to create signature shares among |
| 50 | +the members of a "FROST group". [Learning FROST |
| 51 | +§4.2](https://learningfrost.blockchaincommons.com/04_2_Signing_PSBTs_with_FROST/) |
| 52 | +then shows the precise methodology for signing with FROST, once you |
| 53 | +have everything installed and built. |
| 54 | + |
| 55 | +What follows are just previous outlines to explain the methodology; |
| 56 | +consulting [Learning FROST from the Command |
| 57 | +Line](https://learningfrost.blockchaincommons.com/) for all the |
| 58 | +specifics. |
| 59 | + |
| 60 | +### Create a FROST Address |
| 61 | + |
| 62 | +Creating a FROST address is a simple creation of a FROST group |
| 63 | +followed by implementation of the techniques that you've previously |
| 64 | +used to work with descriptor-based content. |
| 65 | + |
| 66 | +1. Choose the "n" members of a FROST group. |
| 67 | +2. Choose what the "m" threshold will be. |
| 68 | +3. Use the FROST protocol to generate individual signing shares and an aggregate public key. |
| 69 | +4. Generate a descriptor by pairing "tr(aggregate public key)" with a generated checksum, per the technique in [§4.2](04_2_Integrating_Addresses_Descriptors/). |
| 70 | +5. Use `deriveaddresses` to generate one or more addresses for the descriptor. |
| 71 | + |
| 72 | +### Spend a FROST Address |
| 73 | + |
| 74 | +Spending from a FROST address is the part that's not currently |
| 75 | +well-supported by Bitcoin Core. |
| 76 | + |
| 77 | +1. Import the tr(...) descriptor you created into a new watch-only wallet. |
| 78 | +2. Generate a PSBT to spend funds. |
| 79 | +3. Extract the sighash from PSBT using a special tool. |
| 80 | +4. Use a FROST tool such as ZF FROST to create a threshold signature of the sighash. |
| 81 | +5. Use a special tool to place the signature on the UTXO for the FROST address with the proper `sighash` flag. |
| 82 | +6. Finalize and send th EPSBT. |
| 83 | + |
| 84 | +Again, [Learning FROST from the Command |
| 85 | +Line](https://learningfrost.blockchaincommons.com/) contains all the |
| 86 | +tools you'll need for this process. |
| 87 | + |
| 88 | +> 📖 ***What is a Sighash?*** When Bitcoin signs a transaction, it |
| 89 | +actually signs a hash of the transaction: the sighash. Each |
| 90 | +transaction has multiple inputs (where funds are coming from) and |
| 91 | +multiple outputs (where funds are going to). Whether a sighash |
| 92 | +contains all, some, or none of the inputs and all, some, or none of |
| 93 | +the outputs is determined by a specific sighash flag, which is applied |
| 94 | +to each signature. |
| 95 | + |
| 96 | +## Summary: Using Bitcoin with FROST |
| 97 | + |
| 98 | +Bitcoin Core doesn't directly support FROST signatures. But, the |
| 99 | +aggregatable nature of FROST signatures, which results in all of them |
| 100 | +looking the same, means that it will correctly process a FROST |
| 101 | +signature if you give it one. You can create a FROST address with |
| 102 | +"tr(public-key)", where the public key is a FROST aggregated key; you |
| 103 | +can generate an address from that descriptor as usual; and then you |
| 104 | +can spend funds by signing with the appropriate signing shares and |
| 105 | +inserting that signature into a transaction. |
| 106 | + |
| 107 | +## What's Next? |
| 108 | + |
| 109 | +Continue "Using Schnorr" with [§18.4: Using Bitcoin With MuSig2](18_4_Using_Bitcoin_With_MuSig2.md). |
| 110 | + |
0 commit comments