Skip to content

Commit a0abcbd

Browse files
committed
doc: Mention multipath specifier
1 parent 0019f61 commit a0abcbd

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

doc/descriptors.md

Lines changed: 25 additions & 0 deletions
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

@@ -256,6 +257,30 @@ Note how the first key is an xprv private key with a specific derivation path,
256257
while the other two are public keys.
257258

258259

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+
259284
### Compatibility with old wallets
260285

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

0 commit comments

Comments
 (0)