Skip to content

Commit ba32818

Browse files
committed
doc: Mention multipath specifier
1 parent 91b2f0d commit ba32818

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

doc/descriptors.md

+25
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Descriptors consist of several types of expressions. The top level expression is
9797
- [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.
9898
- `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)).
9999
- 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.
100101
- Optionally followed by a single `/*` or `/*'` final step to denote all (direct) unhardened or hardened children.
101102
- The usage of hardened derivation steps requires providing the private key.
102103

@@ -245,6 +246,30 @@ supported, a private key in WIF format or xprv may be provided instead.
245246
This is useful when private keys are necessary for hardened derivation
246247
steps, or for dumping wallet descriptors including private key material.
247248

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+
248273
### Compatibility with old wallets
249274

250275
In order to easily represent the sets of scripts currently supported by

0 commit comments

Comments
 (0)