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
Copy file name to clipboardexpand all lines: doc/descriptors.md
+25
Original file line number
Diff line number
Diff line change
@@ -97,6 +97,7 @@ Descriptors consist of several types of expressions. The top level expression is
97
97
-[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.
98
98
-`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)).
99
99
- Followed by zero or more `/NUM` unhardened and `/NUM'` hardened BIP32 derivation steps.
100
+
- No more than one of these derivation steps may be of the form `<NUM;NUM;...;NUM>` (including hardened indicators with either or both `NUM`). If such specifiers are included, the descriptor will be parsed as multiple descriptors where the first descriptor uses all of the first `NUM` in the pair, and the second descriptor uses the second `NUM` in the pair for all `KEY` expressions, and so on.
100
101
- Optionally followed by a single `/*` or `/*'` final step to denote all (direct) unhardened or hardened children.
101
102
- The usage of hardened derivation steps requires providing the private key.
102
103
@@ -245,6 +246,30 @@ supported, a private key in WIF format or xprv may be provided instead.
245
246
This is useful when private keys are necessary for hardened derivation
246
247
steps, or for dumping wallet descriptors including private key material.
247
248
249
+
### Specifying receiving and change descriptors in one descriptor
250
+
251
+
Since receiving and change addresses are frequently derived from the same
252
+
extended key(s) but with a single derivation index changed, it is convenient
253
+
to be able to specify a descriptor that can derive at the two different
254
+
indexes. Thus a single tuple of indexes is allowed in each derivation path
255
+
following the extended key. When this descriptor is parsed, multiple descriptors
256
+
will be produced, the first one will use the first index in the tuple for all
257
+
key expressions, the second will use the second index, the third will use the
258
+
third index, and so on..
259
+
260
+
For example, a descriptor of the form:
261
+
262
+
multi(2,xpub.../<0;1;2>/0/*,xpub.../<2;3;4>/*)
263
+
264
+
will expand to the two descriptors
265
+
266
+
multi(2,xpub.../0/0/*,xpub.../2/*)
267
+
multi(2,xpub.../1/0/*,xpub.../3/*)
268
+
multi(2,xpub.../2/0/*,xpub.../4*)
269
+
270
+
When this tuple contains only two elements, wallet implementations can use the
271
+
first descriptor for receiving addresses and the second descriptor for change addresses.
272
+
248
273
### Compatibility with old wallets
249
274
250
275
In order to easily represent the sets of scripts currently supported by
0 commit comments