1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
Return-Path: <achow101-lists@achow101.com>
Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])
by lists.linuxfoundation.org (Postfix) with ESMTP id 1AF7BC002D
for <bitcoin-dev@lists.linuxfoundation.org>;
Tue, 26 Jul 2022 21:50:54 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp4.osuosl.org (Postfix) with ESMTP id 2E7174032C
for <bitcoin-dev@lists.linuxfoundation.org>;
Tue, 26 Jul 2022 21:50:53 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2E7174032C
Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key,
unprotected) header.d=achow101.com header.i=@achow101.com header.a=rsa-sha256
header.s=protonmail3 header.b=PbJsv8XM
X-Virus-Scanned: amavisd-new at osuosl.org
X-Spam-Flag: NO
X-Spam-Score: -2.102
X-Spam-Level:
X-Spam-Status: No, score=-2.102 tagged_above=-999 required=5
tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from smtp4.osuosl.org ([127.0.0.1])
by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id V6m1NIXwuyXW
for <bitcoin-dev@lists.linuxfoundation.org>;
Tue, 26 Jul 2022 21:50:51 +0000 (UTC)
X-Greylist: delayed 00:09:15 by SQLgrey-1.8.0
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0F6F040213
Received: from mail-41104.protonmail.ch (mail-41104.protonmail.ch
[185.70.41.104])
by smtp4.osuosl.org (Postfix) with ESMTPS id 0F6F040213
for <bitcoin-dev@lists.linuxfoundation.org>;
Tue, 26 Jul 2022 21:50:50 +0000 (UTC)
Date: Tue, 26 Jul 2022 21:41:12 +0000
Authentication-Results: mail-41104.protonmail.ch;
dkim=pass (2048-bit key) header.d=achow101.com header.i=@achow101.com
header.b="PbJsv8XM"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=achow101.com;
s=protonmail3; t=1658871683; x=1659130883;
bh=7uq+3v9UaTPccuwFTh7VB/f0k+hJl6rvspdTISz8NEo=;
h=Date:To:From:Reply-To:Subject:Message-ID:Feedback-ID:From:To:Cc:
Date:Subject:Reply-To:Feedback-ID:Message-ID;
b=PbJsv8XMFN6dOeoNFji3o0qUNoxtt6FxyPkgVTyfMHC1qS+ikE2dMpNFE2xmnlAvZ
LxRfzTLX3eqv4CcFFb8pVWDUgsTOJlWK/nadKikwAjReX9qiImv9jcYT4R2khuPI6Z
wOkzfnelBr2KBXWpMW0/SMIrLALK7tbWxR1FDT38C3/Acoa5sfQZrh1CQE7bfbspTK
8AqmLUGjePXeycBYRwpmFm0yvERuuBRmMHPt9ksHVNTKxCVLm97FafxVElZYJeNTAw
wBXG4fuAOg8vlRq2Z0L8Xl1ZI7KaHtIQDlzTG9lDjsYDj2RLGKjJSPUxXl8+0hy39n
Y/xL1TplOXCCA==
To: bitcoin-dev@lists.linuxfoundation.org
From: Andrew Chow <achow101-lists@achow101.com>
Reply-To: Andrew Chow <achow101-lists@achow101.com>
Message-ID: <d97c9d44-730e-cbb4-ce8b-19bdf1ea1e2d@achow101.com>
Feedback-ID: 6230017:user:proton
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Subject: [bitcoin-dev] BIP Proposal: Receiving and Change Derivation Paths
in a Single Descriptor
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Tue, 26 Jul 2022 21:50:54 -0000
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-des=
cs.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>
=C2=A0 BIP: multipath-descs
=C2=A0 Layer: Applications
=C2=A0 Title: Multipath Descriptor Key Expressions
=C2=A0 Author: Andrew Chow <andrew@achow101.com>
=C2=A0 Comments-Summary: No comments yet.
=C2=A0 Comments-URI:
https://github.com/bitcoin/bips/wiki/Comments:BIP-multipath-descs
=C2=A0 Status: Draft
=C2=A0 Type: Informational
=C2=A0 Created: 2022-07-26
=C2=A0 License: BSD-2-Clause
</pre>
=3D=3DAbstract=3D=3D
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.
=3D=3DCopyright=3D=3D
This BIP is licensed under the BSD 2-clause license.
=3D=3DMotivation=3D=3D
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.
=3D=3DSpecification=3D=3D
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)=C2=A0 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>
=3D=3DTest Vectors=3D=3D
TBD
=3D=3DBackwards Compatibility=3D=3D
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.
=3D=3DReference Implementation=3D=3D
https://github.com/bitcoin/bitcoin/pull/22838
|