You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2667366 tests: check derivation of P2TR (Pieter Wuille)
7cedafc Add tr() descriptor (derivation only, no signing) (Pieter Wuille)
90fcac3 Add TaprootBuilder class (Pieter Wuille)
5f6cc8d Add XOnlyPubKey::CreateTapTweak (Pieter Wuille)
2fbfb1b Make consensus checking of tweaks in pubkey.* Taproot-specific (Pieter Wuille)
a4bf840 Separate WitnessV1Taproot variant in CTxDestination (Pieter Wuille)
41839bd Avoid dependence on CTxDestination index order (Pieter Wuille)
31df02a Change Solver() output for WITNESS_V1_TAPROOT (Pieter Wuille)
4b1cc08 Make XOnlyPubKey act like byte container (Pieter Wuille)
Pull request description:
This is a subset of #21365, to aide review.
This adds support `tr(KEY)` or `tr(KEY,SCRIPT)` or `tr(KEY,{{S1,{{S2,S3},...}},...})` descriptors, describing Taproot outputs with specified internal key, and optionally any number of scripts, in nested groups of 2 inside `{`/`}` if there are more than one. While it permits importing `tr(KEY)`, anything beyond that is just laying foundations for more features later.
Missing:
* Signing support (see #21365)
* Support for more interesting scripts inside the tree (only `pk(KEY)` is supported for now). In particular, a multisig policy based on the new `OP_CHECKSIGADD` opcode would be very useful.
* Inferring `tr()` descriptors from outputs (given sufficient information).
* `getaddressinfo` support.
* MuSig support. Standardizing that is still an ongoing effort, and is generally kind of useless without corresponding PSBT support.
* Convenient ways of constructing descriptors without spendable internal key (especially ones that arent't trivially recognizable as such).
ACKs for top commit:
Sjors:
utACK 2667366 (based on bitcoin/bitcoin#21365 (comment) review, plus the new functional test)
achow101:
Code Review ACK 2667366
lsilva01:
Tested ACK bitcoin/bitcoin@2667366
meshcollider:
utACK 2667366
Tree-SHA512: 61046fef22c561228338cb178422f0b782ef6587ec8208d3ce2bd07afcff29a664b54b35c6b01226eb70b6540b43f6dd245043d09aa6cb6db1381b6042667e75
Copy file name to clipboardExpand all lines: doc/descriptors.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,7 @@ Output descriptors currently support:
30
30
- Pay-to-witness-pubkey-hash scripts (P2WPKH), through the `wpkh` function.
31
31
- Pay-to-script-hash scripts (P2SH), through the `sh` function.
32
32
- Pay-to-witness-script-hash scripts (P2WSH), through the `wsh` function.
33
+
- Pay-to-taproot outputs (P2TR), through the `tr` function.
33
34
- Multisig scripts, through the `multi` function.
34
35
- Multisig scripts where the public keys are sorted lexicographically, through the `sortedmulti` function.
35
36
- Any type of supported address through the `addr` function.
@@ -54,20 +55,22 @@ Output descriptors currently support:
54
55
-`pkh([d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/1/*)` describes a set of P2PKH outputs, but additionally specifies that the specified xpub is a child of a master with fingerprint `d34db33f`, and derived using path `44'/0'/0'`.
55
56
-`wsh(multi(1,xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/1/0/*,xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/0/0/*))` describes a set of *1-of-2* P2WSH multisig outputs where the first multisig key is the *1/0/`i`* child of the first specified xpub and the second multisig key is the *0/0/`i`* child of the second specified xpub, and `i` is any number in a configurable range (`0-1000` by default).
56
57
-`wsh(sortedmulti(1,xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/1/0/*,xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/0/0/*))` describes a set of *1-of-2* P2WSH multisig outputs where one multisig key is the *1/0/`i`* child of the first specified xpub and the other multisig key is the *0/0/`i`* child of the second specified xpub, and `i` is any number in a configurable range (`0-1000` by default). The order of public keys in the resulting witnessScripts is determined by the lexicographic order of the public keys at that index.
58
+
-`tr(c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5,{pk(fff97bd5755eeea420453a14355235d382f6472f8568a18b2f057a1460297556),pk(e493dbf1c10d80f3581e4904930b1404cc6c13900ee0758474fa94abe8c4cd13)})` describes a P2TR output with the `c6...` x-only pubkey as internal key, and two script paths.
57
59
58
60
## Reference
59
61
60
62
Descriptors consist of several types of expressions. The top level expression is either a `SCRIPT`, or `SCRIPT#CHECKSUM` where `CHECKSUM` is an 8-character alphanumeric descriptor checksum.
61
63
62
64
`SCRIPT` expressions:
63
65
-`sh(SCRIPT)` (top level only): P2SH embed the argument.
64
-
-`wsh(SCRIPT)` (not inside another 'wsh'): P2WSH embed the argument.
66
+
-`wsh(SCRIPT)` (top level or inside `sh` only): P2WSH embed the argument.
65
67
-`pk(KEY)` (anywhere): P2PK output for the given public key.
66
-
-`pkh(KEY)` (anywhere): P2PKH output for the given public key (use `addr` if you only know the pubkey hash).
67
-
-`wpkh(KEY)` (not inside `wsh`): P2WPKH output for the given compressed pubkey.
68
+
-`pkh(KEY)` (not inside `tr`): P2PKH output for the given public key (use `addr` if you only know the pubkey hash).
69
+
-`wpkh(KEY)` (top level or inside `sh` only): P2WPKH output for the given compressed pubkey.
68
70
-`combo(KEY)` (top level only): an alias for the collection of `pk(KEY)` and `pkh(KEY)`. If the key is compressed, it also includes `wpkh(KEY)` and `sh(wpkh(KEY))`.
-`sortedmulti(k,KEY_1,KEY_2,...,KEY_n)` (not inside `tr`): k-of-n multisig script with keys sorted lexicographically in the resulting script.
73
+
-`tr(KEY)` or `tr(KEY,TREE)` (top level only): P2TR output with the specified key as internal key, and optionally a tree of script paths.
71
74
-`addr(ADDR)` (top level only): the script which ADDR expands to.
72
75
-`raw(HEX)` (top level only): the script whose hex encoding is HEX.
73
76
@@ -80,12 +83,17 @@ Descriptors consist of several types of expressions. The top level expression is
80
83
- Followed by the actual key, which is either:
81
84
- Hex encoded public keys (either 66 characters starting with `02` or `03` for a compressed pubkey, or 130 characters starting with `04` for an uncompressed pubkey).
82
85
- Inside `wpkh` and `wsh`, only compressed public keys are permitted.
86
+
- Inside `tr`, x-only pubkeys are also permitted (64 hex characters).
83
87
-[WIF](https://en.bitcoin.it/wiki/Wallet_import_format) encoded private keys may be specified instead of the corresponding public key, with the same meaning.
84
88
-`xpub` encoded extended public key or `xprv` encoded extended private key (as defined in [BIP 32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)).
85
89
- Followed by zero or more `/NUM` unhardened and `/NUM'` hardened BIP32 derivation steps.
86
90
- Optionally followed by a single `/*` or `/*'` final step to denote all (direct) unhardened or hardened children.
87
91
- The usage of hardened derivation steps requires providing the private key.
88
92
93
+
`TREE` expressions:
94
+
- any `SCRIPT` expression
95
+
- An open brace `{`, a `TREE` expression, a comma `,`, a `TREE` expression, and a closing brace `}`
96
+
89
97
(Anywhere a `'` suffix is permitted to denote hardened derivation, the suffix `h` can be used instead.)
90
98
91
99
`ADDR` expressions are any type of supported address:
0 commit comments