LearnBitcoin

Bitcoin Dev Archive 2022

BIP Proposal: Receiving and Change Derivation Paths in a Single Descriptor

9 messages, 26 Jul to 4 Aug 2022. Started by Andrew Chow.

Andrew Chow (3), Pavol Rusnak (2), Dmitry Petukhov (2), Craig Raw, Billy Tetrud

Permalink Original thread on gnusha.org

Andrew Chow permalink original

Hi All,

I would like to propose a BIP that de-duplicates and simplifies how we represent descriptors for receiving and change addresses. Under the existing BIPs, this requires two descriptors, where the vast majority of the descriptors are the same, except for a single derivation path element. This proposal allows descriptors to have a single derivation path element that can specify a pair of indexes. Parsers would then expand these into two almost identical descriptors with the difference being that the first uses the first of the pair of indexes, and the second uses the second.

The proposed notation is `<a;b>`. As an example, `wpkh(xpub.../0/<0;1>/*)` would be expanded into `wpkh(xpub.../0/0/*)` and `wpkh(xpub.../0/1/*)`.

This also works for descriptors involving multiple keys - the first element in every pair is used for the first descriptor, and the second element of each pair in the second descriptor.

The full text of the BIP can be found at https://github.com/achow101/bips/blob/bip-multipath-descs/bip-multipath-descs.mediawiki and also copied below. An implementation of it to Bitcoin Core is available at https://github.com/bitcoin/bitcoin/pull/22838.

Any feedback on this would be appreciated.

Thanks, Andrew Chow

---

<pre>
   BIP: multipath-descs
   Layer: Applications
   Title: Multipath Descriptor Key Expressions
   Author: Andrew Chow <andrew@achow101•com>
   Comments-Summary: No comments yet.
   Comments-URI:
https://github.com/bitcoin/bips/wiki/Comments:BIP-multipath-descs
   Status: Draft
   Type: Informational
   Created: 2022-07-26
   License: BSD-2-Clause
</pre>

==Abstract==

This document specifies a modification to Key Expressions of Descriptors that are described in BIP 380. This modification allows Key Expressions to indicate BIP 32 derivation path steps that can have multiple values.

==Copyright==

This BIP is licensed under the BSD 2-clause license.

==Motivation==

Descriptors can describe the scripts that are used in a wallet, but wallets often require at least two descriptors for all of the scripts that they watch for. Wallets typically have one descriptor for producing receiving addresses, and the other for change addresses. These descriptors are often extremely similar - they produce the same types of scripts, derive keys from the same master key, and use derivation paths that are almost identical. The only differences are in the derivation path where one of the steps will be different between the descriptors. Thus it is useful to have a notation to represent both descriptors as a single descriptor where one of the derivation steps is a pair of values.

==Specification==

For extended keys and their derivations paths in a Key Expression, BIP 380 states:

* <tt>xpub</tt> encoded extended public key or <tt>xprv</tt> encoded extended private key (as defined in BIP 32) ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path elements indicating BIP 32 derivation steps to be taken after the given extended key. ** Optionally followed by a single <tt>/*</tt> or <tt>/*h</tt> final step to denote all direct unhardened or hardened children.

This is modifed to state:

* <tt>xpub</tt> encoded extended public key or <tt>xprv</tt> encoded extended private key (as defined in BIP 32) ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path elements indicating BIP 32 derivation steps to be taken after the given extended key. ** Followed by zero or one <tt>/<NUM;NUM></tt> (<tt>NUM</tt> may be followed by <tt>h</tt> to indicated a hardened step)  path element indicating a pair of BIP 32 derivation steps to be taken after the given extended key. ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path elements indicating BIP 32 derivation steps to be taken after the given extended key. ** Optionally followed by a single <tt>/*</tt> or <tt>/*h</tt> final step to denote all direct unhardened or hardened children.

When a <tt>/<NUM;NUM></tt> is encountered, parsers should produce two descriptors where the first descriptor uses the first <tt>NUM</tt>, and a second descriptor uses the second <tt>NUM</tt>.

The common use case for this is to represent descriptors for producing receiving and change addresses. When interpreting for this use case, wallets should use the first descriptor for producing receiving addresses, and the second descriptor for producing change addresses. For this use case, the element will commonly be the value <tt>/<0;1></tt>

==Test Vectors==

TBD

==Backwards Compatibility==

This is an addition to the Key Expressions defined in BIP 380. Key Expressions using the format described in BIP 380 are compatible with this modification and parsers that implement this will still be able to parse such descriptors. However as this is an addition to Key Expressions, older parsers will not be able to understand such descriptors.

This modification to Key Expressions uses two new characters: <tt><</tt> and <tt>;</tt>. These are part of the descriptor character set and so are covered by the checksum algorithm. As these are previously unused characters, old parsers will not accidentally mistake them for indicating something else.

==Reference Implementation==

https://github.com/bitcoin/bitcoin/pull/22838

Pavol Rusnak in reply to Andrew Chow permalink original

Thanks Andrew for this BIP. We've been already using this for quite some time for Trezor in production.

Just one clarification: Should <NUM;NUM;NUM>, <NUM;NUM;NUM;NUM>, ... also work or we only aim to support only tuples of exactly two values?

On Tue, 26 Jul 2022 at 23:51, Andrew Chow via bitcoin-dev < bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (144 lines)
> Hi All,
>
> I would like to propose a BIP that de-duplicates and simplifies how we
> represent descriptors for receiving and change addresses. Under the
> existing BIPs, this requires two descriptors, where the vast majority of
> the descriptors are the same, except for a single derivation path
> element. This proposal allows descriptors to have a single derivation
> path element that can specify a pair of indexes. Parsers would then
> expand these into two almost identical descriptors with the difference
> being that the first uses the first of the pair of indexes, and the
> second uses the second.
>
> The proposed notation is `<a;b>`. As an example,
> `wpkh(xpub.../0/<0;1>/*)` would be expanded into `wpkh(xpub.../0/0/*)`
> and `wpkh(xpub.../0/1/*)`.
>
> This also works for descriptors involving multiple keys - the first
> element in every pair is used for the first descriptor, and the second
> element of each pair in the second descriptor.
>
> The full text of the BIP can be found at
>
> https://github.com/achow101/bips/blob/bip-multipath-descs/bip-multipath-descs.mediawiki
> and also copied below. An implementation of it to Bitcoin Core is
> available at https://github.com/bitcoin/bitcoin/pull/22838.
>
> Any feedback on this would be appreciated.
>
> Thanks,
> Andrew Chow
>
> ---
>
> <pre>
>    BIP: multipath-descs
>    Layer: Applications
>    Title: Multipath Descriptor Key Expressions
>    Author: Andrew Chow <andrew@achow101•com>
>    Comments-Summary: No comments yet.
>    Comments-URI:
> https://github.com/bitcoin/bips/wiki/Comments:BIP-multipath-descs
>    Status: Draft
>    Type: Informational
>    Created: 2022-07-26
>    License: BSD-2-Clause
> </pre>
>
> ==Abstract==
>
> This document specifies a modification to Key Expressions of Descriptors
> that are described in BIP 380.
> This modification allows Key Expressions to indicate BIP 32 derivation
> path steps that can have multiple values.
>
> ==Copyright==
>
> This BIP is licensed under the BSD 2-clause license.
>
> ==Motivation==
>
> Descriptors can describe the scripts that are used in a wallet, but
> wallets often require at least two descriptors for all of the scripts
> that they watch for.
> Wallets typically have one descriptor for producing receiving addresses,
> and the other for change addresses.
> These descriptors are often extremely similar - they produce the same
> types of scripts, derive keys from the same master key, and use
> derivation paths that are almost identical.
> The only differences are in the derivation path where one of the steps
> will be different between the descriptors.
> Thus it is useful to have a notation to represent both descriptors as a
> single descriptor where one of the derivation steps is a pair of values.
>
> ==Specification==
>
> For extended keys and their derivations paths in a Key Expression, BIP
> 380 states:
>
> * <tt>xpub</tt> encoded extended public key or <tt>xprv</tt> encoded
> extended private key (as defined in BIP 32)
> ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path
> elements indicating BIP 32 derivation steps to be taken after the given
> extended key.
> ** Optionally followed by a single <tt>/*</tt> or <tt>/*h</tt> final
> step to denote all direct unhardened or hardened children.
>
> This is modifed to state:
>
> * <tt>xpub</tt> encoded extended public key or <tt>xprv</tt> encoded
> extended private key (as defined in BIP 32)
> ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path
> elements indicating BIP 32 derivation steps to be taken after the given
> extended key.
> ** Followed by zero or one <tt>/<NUM;NUM></tt> (<tt>NUM</tt> may be
> followed by <tt>h</tt> to indicated a hardened step)  path element
> indicating a pair of BIP 32 derivation steps to be taken after the given
> extended key.
> ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path
> elements indicating BIP 32 derivation steps to be taken after the given
> extended key.
> ** Optionally followed by a single <tt>/*</tt> or <tt>/*h</tt> final
> step to denote all direct unhardened or hardened children.
>
> When a <tt>/<NUM;NUM></tt> is encountered, parsers should produce two
> descriptors where the first descriptor uses the first <tt>NUM</tt>, and
> a second descriptor uses the second <tt>NUM</tt>.
>
> The common use case for this is to represent descriptors for producing
> receiving and change addresses.
> When interpreting for this use case, wallets should use the first
> descriptor for producing receiving addresses, and the second descriptor
> for producing change addresses.
> For this use case, the element will commonly be the value <tt>/<0;1></tt>
>
> ==Test Vectors==
>
> TBD
>
> ==Backwards Compatibility==
>
> This is an addition to the Key Expressions defined in BIP 380.
> Key Expressions using the format described in BIP 380 are compatible
> with this modification and parsers that implement this will still be
> able to parse such descriptors.
> However as this is an addition to Key Expressions, older parsers will
> not be able to understand such descriptors.
>
> This modification to Key Expressions uses two new characters: <tt><</tt>
> and <tt>;</tt>.
> These are part of the descriptor character set and so are covered by the
> checksum algorithm.
> As these are previously unused characters, old parsers will not
> accidentally mistake them for indicating something else.
>
> ==Reference Implementation==
>
> https://github.com/bitcoin/bitcoin/pull/22838
>
>
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation•org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
Andrew Chow in reply to Andrew Chow permalink original

I went with just tuples of two values because that's easier to implement and targets exactly what people were asking for. However I don't see why this couldn't generalize to any sized tuples. As long as the tuples are all the same length, and the limit is one tuple per key expression, then we don't get any combinatorial blowup issues.

Are there any use cases for variable length tuples?

Andrew

On 07/26/2022 05:56 PM, Pavol Rusnak wrote:

Quoted text (154 lines)
> Thanks Andrew for this BIP. We've been already using this for quite some time for Trezor in production.
>
> Just one clarification: Should <NUM;NUM;NUM>, <NUM;NUM;NUM;NUM>, ... also work or we only aim to support only tuples of exactly two values?
>
> On Tue, 26 Jul 2022 at 23:51, Andrew Chow via bitcoin-dev <bitcoin-dev@lists•linuxfoundation•org> wrote:
>
>> Hi All,
>>
>> I would like to propose a BIP that de-duplicates and simplifies how we
>> represent descriptors for receiving and change addresses. Under the
>> existing BIPs, this requires two descriptors, where the vast majority of
>> the descriptors are the same, except for a single derivation path
>> element. This proposal allows descriptors to have a single derivation
>> path element that can specify a pair of indexes. Parsers would then
>> expand these into two almost identical descriptors with the difference
>> being that the first uses the first of the pair of indexes, and the
>> second uses the second.
>>
>> The proposed notation is `<a;b>`. As an example,
>> `wpkh(xpub.../0/<0;1>/*)` would be expanded into `wpkh(xpub.../0/0/*)`
>> and `wpkh(xpub.../0/1/*)`.
>>
>> This also works for descriptors involving multiple keys - the first
>> element in every pair is used for the first descriptor, and the second
>> element of each pair in the second descriptor.
>>
>> The full text of the BIP can be found at
>> https://github.com/achow101/bips/blob/bip-multipath-descs/bip-multipath-descs.mediawiki
>> and also copied below. An implementation of it to Bitcoin Core is
>> available at https://github.com/bitcoin/bitcoin/pull/22838.
>>
>> Any feedback on this would be appreciated.
>>
>> Thanks,
>> Andrew Chow
>>
>> ---
>>
>> <pre>
>> BIP: multipath-descs
>> Layer: Applications
>> Title: Multipath Descriptor Key Expressions
>> Author: Andrew Chow <andrew@achow101•com>
>> Comments-Summary: No comments yet.
>> Comments-URI:
>> https://github.com/bitcoin/bips/wiki/Comments:BIP-multipath-descs
>> Status: Draft
>> Type: Informational
>> Created: 2022-07-26
>> License: BSD-2-Clause
>> </pre>
>>
>> ==Abstract==
>>
>> This document specifies a modification to Key Expressions of Descriptors
>> that are described in BIP 380.
>> This modification allows Key Expressions to indicate BIP 32 derivation
>> path steps that can have multiple values.
>>
>> ==Copyright==
>>
>> This BIP is licensed under the BSD 2-clause license.
>>
>> ==Motivation==
>>
>> Descriptors can describe the scripts that are used in a wallet, but
>> wallets often require at least two descriptors for all of the scripts
>> that they watch for.
>> Wallets typically have one descriptor for producing receiving addresses,
>> and the other for change addresses.
>> These descriptors are often extremely similar - they produce the same
>> types of scripts, derive keys from the same master key, and use
>> derivation paths that are almost identical.
>> The only differences are in the derivation path where one of the steps
>> will be different between the descriptors.
>> Thus it is useful to have a notation to represent both descriptors as a
>> single descriptor where one of the derivation steps is a pair of values.
>>
>> ==Specification==
>>
>> For extended keys and their derivations paths in a Key Expression, BIP
>> 380 states:
>>
>> * <tt>xpub</tt> encoded extended public key or <tt>xprv</tt> encoded
>> extended private key (as defined in BIP 32)
>> ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path
>> elements indicating BIP 32 derivation steps to be taken after the given
>> extended key.
>> ** Optionally followed by a single <tt>/*</tt> or <tt>/*h</tt> final
>> step to denote all direct unhardened or hardened children.
>>
>> This is modifed to state:
>>
>> * <tt>xpub</tt> encoded extended public key or <tt>xprv</tt> encoded
>> extended private key (as defined in BIP 32)
>> ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path
>> elements indicating BIP 32 derivation steps to be taken after the given
>> extended key.
>> ** Followed by zero or one <tt>/<NUM;NUM></tt> (<tt>NUM</tt> may be
>> followed by <tt>h</tt> to indicated a hardened step) path element
>> indicating a pair of BIP 32 derivation steps to be taken after the given
>> extended key.
>> ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path
>> elements indicating BIP 32 derivation steps to be taken after the given
>> extended key.
>> ** Optionally followed by a single <tt>/*</tt> or <tt>/*h</tt> final
>> step to denote all direct unhardened or hardened children.
>>
>> When a <tt>/<NUM;NUM></tt> is encountered, parsers should produce two
>> descriptors where the first descriptor uses the first <tt>NUM</tt>, and
>> a second descriptor uses the second <tt>NUM</tt>.
>>
>> The common use case for this is to represent descriptors for producing
>> receiving and change addresses.
>> When interpreting for this use case, wallets should use the first
>> descriptor for producing receiving addresses, and the second descriptor
>> for producing change addresses.
>> For this use case, the element will commonly be the value <tt>/<0;1></tt>
>>
>> ==Test Vectors==
>>
>> TBD
>>
>> ==Backwards Compatibility==
>>
>> This is an addition to the Key Expressions defined in BIP 380.
>> Key Expressions using the format described in BIP 380 are compatible
>> with this modification and parsers that implement this will still be
>> able to parse such descriptors.
>> However as this is an addition to Key Expressions, older parsers will
>> not be able to understand such descriptors.
>>
>> This modification to Key Expressions uses two new characters: <tt><</tt>
>> and <tt>;</tt>.
>> These are part of the descriptor character set and so are covered by the
>> checksum algorithm.
>> As these are previously unused characters, old parsers will not
>> accidentally mistake them for indicating something else.
>>
>> ==Reference Implementation==
>>
>> https://github.com/bitcoin/bitcoin/pull/22838
>>
>> _______________________________________________
>> bitcoin-dev mailing list
>> bitcoin-dev@lists•linuxfoundation•org
>> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
> --
>
> Best Regards / S pozdravom,
>
> Pavol "stick" Rusnak
> Co-Founder, SatoshiLabs
Craig Raw in reply to Andrew Chow permalink original

Thanks Andrew for proposing the BIP, I have used this syntax in Sparrow for some time now.

I find a single, compact descriptor for a wallet is important when copying out as a backup, particularly onto durable media. More so when it is a multisig wallet that ideally requires a backup of all the xpubs. Multipath descriptors as proposed in this BIP address this need well.

Craig

On Tue, Jul 26, 2022 at 11:51 PM Andrew Chow via bitcoin-dev < bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (144 lines)
> Hi All,
>
> I would like to propose a BIP that de-duplicates and simplifies how we
> represent descriptors for receiving and change addresses. Under the
> existing BIPs, this requires two descriptors, where the vast majority of
> the descriptors are the same, except for a single derivation path
> element. This proposal allows descriptors to have a single derivation
> path element that can specify a pair of indexes. Parsers would then
> expand these into two almost identical descriptors with the difference
> being that the first uses the first of the pair of indexes, and the
> second uses the second.
>
> The proposed notation is `<a;b>`. As an example,
> `wpkh(xpub.../0/<0;1>/*)` would be expanded into `wpkh(xpub.../0/0/*)`
> and `wpkh(xpub.../0/1/*)`.
>
> This also works for descriptors involving multiple keys - the first
> element in every pair is used for the first descriptor, and the second
> element of each pair in the second descriptor.
>
> The full text of the BIP can be found at
>
> https://github.com/achow101/bips/blob/bip-multipath-descs/bip-multipath-descs.mediawiki
> and also copied below. An implementation of it to Bitcoin Core is
> available at https://github.com/bitcoin/bitcoin/pull/22838.
>
> Any feedback on this would be appreciated.
>
> Thanks,
> Andrew Chow
>
> ---
>
> <pre>
>    BIP: multipath-descs
>    Layer: Applications
>    Title: Multipath Descriptor Key Expressions
>    Author: Andrew Chow <andrew@achow101•com>
>    Comments-Summary: No comments yet.
>    Comments-URI:
> https://github.com/bitcoin/bips/wiki/Comments:BIP-multipath-descs
>    Status: Draft
>    Type: Informational
>    Created: 2022-07-26
>    License: BSD-2-Clause
> </pre>
>
> ==Abstract==
>
> This document specifies a modification to Key Expressions of Descriptors
> that are described in BIP 380.
> This modification allows Key Expressions to indicate BIP 32 derivation
> path steps that can have multiple values.
>
> ==Copyright==
>
> This BIP is licensed under the BSD 2-clause license.
>
> ==Motivation==
>
> Descriptors can describe the scripts that are used in a wallet, but
> wallets often require at least two descriptors for all of the scripts
> that they watch for.
> Wallets typically have one descriptor for producing receiving addresses,
> and the other for change addresses.
> These descriptors are often extremely similar - they produce the same
> types of scripts, derive keys from the same master key, and use
> derivation paths that are almost identical.
> The only differences are in the derivation path where one of the steps
> will be different between the descriptors.
> Thus it is useful to have a notation to represent both descriptors as a
> single descriptor where one of the derivation steps is a pair of values.
>
> ==Specification==
>
> For extended keys and their derivations paths in a Key Expression, BIP
> 380 states:
>
> * <tt>xpub</tt> encoded extended public key or <tt>xprv</tt> encoded
> extended private key (as defined in BIP 32)
> ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path
> elements indicating BIP 32 derivation steps to be taken after the given
> extended key.
> ** Optionally followed by a single <tt>/*</tt> or <tt>/*h</tt> final
> step to denote all direct unhardened or hardened children.
>
> This is modifed to state:
>
> * <tt>xpub</tt> encoded extended public key or <tt>xprv</tt> encoded
> extended private key (as defined in BIP 32)
> ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path
> elements indicating BIP 32 derivation steps to be taken after the given
> extended key.
> ** Followed by zero or one <tt>/<NUM;NUM></tt> (<tt>NUM</tt> may be
> followed by <tt>h</tt> to indicated a hardened step)  path element
> indicating a pair of BIP 32 derivation steps to be taken after the given
> extended key.
> ** Followed by zero or more <tt>/NUM</tt> or <tt>/NUMh</tt> path
> elements indicating BIP 32 derivation steps to be taken after the given
> extended key.
> ** Optionally followed by a single <tt>/*</tt> or <tt>/*h</tt> final
> step to denote all direct unhardened or hardened children.
>
> When a <tt>/<NUM;NUM></tt> is encountered, parsers should produce two
> descriptors where the first descriptor uses the first <tt>NUM</tt>, and
> a second descriptor uses the second <tt>NUM</tt>.
>
> The common use case for this is to represent descriptors for producing
> receiving and change addresses.
> When interpreting for this use case, wallets should use the first
> descriptor for producing receiving addresses, and the second descriptor
> for producing change addresses.
> For this use case, the element will commonly be the value <tt>/<0;1></tt>
>
> ==Test Vectors==
>
> TBD
>
> ==Backwards Compatibility==
>
> This is an addition to the Key Expressions defined in BIP 380.
> Key Expressions using the format described in BIP 380 are compatible
> with this modification and parsers that implement this will still be
> able to parse such descriptors.
> However as this is an addition to Key Expressions, older parsers will
> not be able to understand such descriptors.
>
> This modification to Key Expressions uses two new characters: <tt><</tt>
> and <tt>;</tt>.
> These are part of the descriptor character set and so are covered by the
> checksum algorithm.
> As these are previously unused characters, old parsers will not
> accidentally mistake them for indicating something else.
>
> ==Reference Implementation==
>
> https://github.com/bitcoin/bitcoin/pull/22838
>
>
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation•org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
Pavol Rusnak in reply to Andrew Chow permalink original

On Wed, 27 Jul 2022 at 00:28, Andrew Chow <achow101-lists@achow101•com> wrote:

Quoted text (4 lines)
> However I don't see why this couldn't generalize to any sized tuples. As
> long as the tuples are all the same length, and the limit is one tuple per
> key expression, then we don't get any combinatorial blowup issues.
>

I think it's worthwhile to generalize for any sized tuples. I don't have any existing particular use case in mind, because BIP-44, BIP-84, etc. are fine with just using <0;1>, but there might be some upcoming standards in the future that will want to introduce more sub-paths.

Andrew Chow in reply to Andrew Chow permalink original

I've updated the BIP text to allow arbitrary length tuples.

On 07/27/2022 04:44 AM, Pavol Rusnak wrote:

Quoted text (12 lines)
> On Wed, 27 Jul 2022 at 00:28, Andrew Chow <achow101-lists@achow101•com> wrote:
>
>> However I don't see why this couldn't generalize to any sized tuples. As long as the tuples are all the same length, and the limit is one tuple per key expression, then we don't get any combinatorial blowup issues.
>
> I think it's worthwhile to generalize for any sized tuples. I don't have any existing particular use case in mind, because BIP-44, BIP-84, etc. are fine with just using <0;1>, but there might be some upcoming standards in the future that will want to introduce more sub-paths.
>
> --
>
> Best Regards / S pozdravom,
>
> Pavol "stick" Rusnak
> Co-Founder, SatoshiLabs
Dmitry Petukhov in reply to Andrew Chow permalink original

The issue with tuples of lenth more than two is that the purpose for indexes beyond 'receive' and 'change' are not established, and therefore various software might start to use extra indexes in a tuple for their own non-standard purposes. This is bound to create incompatibilities where different wallet software that import the same descriptor would use those addresses for different purposes.

Even if some auxiliary standard emerges for the meanings of extra indexes, since the indexes in the tuple are listed without omissions (no "<0;1;;;3>" allowed), all software will need to be aware of the existence of these purposes and define indexes for them: if one wishes to utilize position 3 in such a tuple, they will need to define an index for position 2 as well.

I'd expect that emergence of new widely-used purposes for indexes would be a very rare event, and a separate BIP for each purpose wouldn't be excessive.

I'd say that bip-multipath-descs should say that extra indexes are OK for address discovery (for scanning of the addresses of a wallet), but it should say that any interpretation of the purpose of such indexes and deriving new addresses at these indexes are strongly discouraged.

Wallet software that wishes to utilize non-standard extra indexes beyond 'receive' and 'change' should use separate descriptors instead for these extra indexes.

And when a new established purpose emerges for the next position in the index tuple, a new BIP should be made that defines such position.

The BIP for position 3 would naturally come after the BIP for position 2, and thus software that implemnents BIP for position 3 would be aware of the previous BIP and will at least know to choose some index for position 2.

В Wed, 27 Jul 2022 14:58:28 +0000 Andrew Chow via bitcoin-dev <bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (23 lines)
> I've updated the BIP text to allow arbitrary length tuples.
>
> On 07/27/2022 04:44 AM, Pavol Rusnak wrote:
>
> > On Wed, 27 Jul 2022 at 00:28, Andrew Chow
> > <achow101-lists@achow101•com> wrote:
> >> However I don't see why this couldn't generalize to any sized
> >> tuples. As long as the tuples are all the same length, and the
> >> limit is one tuple per key expression, then we don't get any
> >> combinatorial blowup issues.
> >
> > I think it's worthwhile to generalize for any sized tuples. I don't
> > have any existing particular use case in mind, because BIP-44,
> > BIP-84, etc. are fine with just using <0;1>, but there might be
> > some upcoming standards in the future that will want to introduce
> > more sub-paths.
> >
> > --
> >
> > Best Regards / S pozdravom,
> >
> > Pavol "stick" Rusnak
> > Co-Founder, SatoshiLab
Billy Tetrud in reply to Dmitry Petukhov permalink original

@Dmitry

Quoted text (1 line)
>  various software might start to use extra indexes in a tuple for their

own non-standard purposes

This will be true regardless of whether the spec allows or doesn't allow tuples of length more than 2. In fact, any other tuple other than <1;2> will be nonstandard. We can't prevent people from using standards in use-case-specific ways, and we can't prevent people from creating non-standard extensions of standards.

Quoted text (1 line)
> Wallet software that wishes to utilize non-standard extra indexes beyond

'receive' and 'change' should use separate descriptors instead for these extra indexes.

What benefit would that gain? The wallets would still be doing something non-standard and interpreting those indexes however they want. A descriptor format is simply defining a space of address derivation paths. It is not describing in any way what each path is intended for - those are conventions outside the scope of this BIP IMO. Defining the conventions of derivation path indexes should be a separate BIP. Single responsibility principle.

On Thu, Jul 28, 2022 at 5:15 AM Dmitry Petukhov via bitcoin-dev < bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (68 lines)
> The issue with tuples of lenth more than two is that the purpose for
> indexes beyond 'receive' and 'change' are not established, and
> therefore various software might start to use extra indexes in a tuple
> for their own non-standard purposes. This is bound to create
> incompatibilities where different wallet software that import the same
> descriptor would use those addresses for different purposes.
>
> Even if some auxiliary standard emerges for the meanings of extra
> indexes, since the indexes in the tuple are listed without omissions (no
> "<0;1;;;3>" allowed), all software will need to be aware of the
> existence of these purposes and define indexes for them: if one wishes
> to utilize position 3 in such a tuple, they will need to define an index
> for position 2 as well.
>
> I'd expect that emergence of new widely-used purposes for indexes would
> be a very rare event, and a separate BIP for each purpose wouldn't be
> excessive.
>
> I'd say that bip-multipath-descs should say that extra indexes are OK
> for address discovery (for scanning of the addresses of a wallet), but
> it should say that any interpretation of the purpose of such indexes
> and deriving new addresses at these indexes are strongly discouraged.
>
> Wallet software that wishes to utilize non-standard extra indexes beyond
> 'receive' and 'change' should use separate descriptors instead for
> these extra indexes.
>
> And when a new established purpose emerges for the next position in the
> index tuple, a new BIP should be made that defines such position.
>
> The BIP for position 3 would naturally come after the BIP for position
> 2, and thus software that implemnents BIP for position 3 would be aware
> of the previous BIP and will at least know to choose some index for
> position 2.
>
> В Wed, 27 Jul 2022 14:58:28 +0000
> Andrew Chow via bitcoin-dev <bitcoin-dev@lists•linuxfoundation•org>
> wrote:
>
> > I've updated the BIP text to allow arbitrary length tuples.
> >
> > On 07/27/2022 04:44 AM, Pavol Rusnak wrote:
> >
> > > On Wed, 27 Jul 2022 at 00:28, Andrew Chow
> > > <achow101-lists@achow101•com> wrote:
> > >> However I don't see why this couldn't generalize to any sized
> > >> tuples. As long as the tuples are all the same length, and the
> > >> limit is one tuple per key expression, then we don't get any
> > >> combinatorial blowup issues.
> > >
> > > I think it's worthwhile to generalize for any sized tuples. I don't
> > > have any existing particular use case in mind, because BIP-44,
> > > BIP-84, etc. are fine with just using <0;1>, but there might be
> > > some upcoming standards in the future that will want to introduce
> > > more sub-paths.
> > >
> > > --
> > >
> > > Best Regards / S pozdravom,
> > >
> > > Pavol "stick" Rusnak
> > > Co-Founder, SatoshiLab
>
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation•org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
Dmitry Petukhov in reply to Billy Tetrud permalink original

В Wed, 3 Aug 2022 20:16:52 -0500 Billy Tetrud <billy.tetrud@gmail•com> wrote:

Quoted text (5 lines)
> A descriptor format is simply defining a space of address
> derivation paths. It is not describing in any way what each path is
> intended for - those are conventions outside the scope of this BIP
> IMO. Defining the conventions of derivation path indexes should be a
> separate BIP. Single responsibility principle.

I see, you're right. I misread the BIP proposal text and missed that it describes 'receive' and 'change' only as 'common usecase', not as definitive designations for indexes. Considering this, I too see no need to include such conventions in this BIP.