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
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
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
@@ -256,6 +257,30 @@ Note how the first key is an xprv private key with a specific derivation path,
256
257
while the other two are public keys.
257
258
258
259
260
+
### Specifying receiving and change descriptors in one descriptor
261
+
262
+
Since receiving and change addresses are frequently derived from the same
263
+
extended key(s) but with a single derivation index changed, it is convenient
264
+
to be able to specify a descriptor that can derive at the two different
265
+
indexes. Thus a single tuple of indexes is allowed in each derivation path
266
+
following the extended key. When this descriptor is parsed, multiple descriptors
267
+
will be produced, the first one will use the first index in the tuple for all
268
+
key expressions, the second will use the second index, the third will use the
269
+
third index, and so on..
270
+
271
+
For example, a descriptor of the form:
272
+
273
+
multi(2,xpub.../<0;1;2>/0/*,xpub.../<2;3;4>/*)
274
+
275
+
will expand to the two descriptors
276
+
277
+
multi(2,xpub.../0/0/*,xpub.../2/*)
278
+
multi(2,xpub.../1/0/*,xpub.../3/*)
279
+
multi(2,xpub.../2/0/*,xpub.../4*)
280
+
281
+
When this tuple contains only two elements, wallet implementations can use the
282
+
first descriptor for receiving addresses and the second descriptor for change addresses.
283
+
259
284
### Compatibility with old wallets
260
285
261
286
In order to easily represent the sets of scripts currently supported by
0 commit comments