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: bip-0088.mediawiki
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,17 +91,17 @@ installation of malicious or incorrect profiles, though.
91
91
92
92
The format for the template was choosen to make it easy to read, convenient and visually unambigous.
93
93
94
-
Template starts with optional prefix "m/", and then one or more sections delimited by the slash character (<code>/</code>).
94
+
Template starts with optional prefix <code>m/</code>, and then one or more sections delimited by the slash character (<code>/</code>).
95
95
96
96
Implementations MAY limit the maximum number of sections.
97
97
98
-
Each section consists of ''index template'', optionally followed by the hardened marker: either an apostrophe (<code>'</code>) or letter "h".
98
+
Each section consists of ''index template'', optionally followed by the hardened marker: either an apostrophe (<code>'</code>) or letter <code>h</code>.
99
99
100
100
Index template can be:
101
101
102
102
* An integer value from 0 to 2147483647 ("Unit index template")
103
-
* A single "*" character, which denotes any value from 0 to 2147483647 ("Wildcard index template")
104
-
* The <nowiki>"{"</nowiki> character, followed by a number of ''index ranges'' delimited by commas (<code>,</code>), followed by <nowiki>"}"</nowiki> character ("Ranged index template")
103
+
* A single <code>*</code> character, which denotes any value from 0 to 2147483647 ("Wildcard index template")
104
+
* The <code>{</code> character, followed by a number of ''index ranges'' delimited by commas (<code>,</code>), followed by <code>}</code> character ("Ranged index template")
105
105
106
106
Implementations MAY limit the maximum number of index ranges within the Ranged index template.
107
107
@@ -110,9 +110,9 @@ If an index template is immediately followed by hardened marker, this means that
110
110
Index range can be:
111
111
112
112
* An integer value from 0 to 2147483647 ("Unit range")
113
-
* An integer value from 0 to 2147483647, followed by the "-" character, followed by another integer value from 0 to 2147483647 ("Non-unit range")
113
+
* An integer value from 0 to 2147483647, followed by the <code>-</code> character, followed by another integer value from 0 to 2147483647 ("Non-unit range")
114
114
115
-
For Non-unit range, value on the left side of the "-" character is the range_start, and the value on the right side of the "-" character is the range_end.
115
+
For Non-unit range, value on the left side of the <code>-</code> character is the range_start, and the value on the right side of the <code>-</code> character is the range_end.
116
116
117
117
For Unit range, we say that range_start is equal to range_end, even though there is no start/end in the Unit range.
118
118
@@ -128,26 +128,26 @@ Constraints:
128
128
# To avoid ambiguity, an index range <code>0-2147483647</code> is not allowed, and MUST be specified as Wildcard index template instead
129
129
# For Non-unit range, range_end MUST be larger than range_start.
130
130
# If there is more than one index range within the Ranged index template, range_start of the second and any subsequent range MUST be larger than the range_end of the preceeding range.
131
-
# To avoid ambiguity, all representations of integer values larger than 0 MUST NOT start with character "0" (no leading zeroes allowed).
131
+
# To avoid ambiguity, all representations of integer values larger than 0 MUST NOT start with character <code>0</code> (no leading zeroes allowed).
132
132
# If hardened marker appears within any section in the path template, all preceding sections MUST also specify hardened matching.
133
133
# To avoid ambiguity, if a hardened marker appears within any section in the path template, all preceding sections MUST also use the same hardened marker (either <code>h</code> or <code>'</code>).
134
-
# To avoid ambiguity, trailing slashes (for example, "1/2/") and duplicate slashes (for example, "0//1") MUST NOT appear in the template.
134
+
# To avoid ambiguity, trailing slashes (for example, <code>1/2/</code>) and duplicate slashes (for example, <code>0//1</code>) MUST NOT appear in the template.
135
135
136
136
It may be desireable to have fully unambiguous encoding, where for each valid path template string, there is no other valid template string that matches the exact same set of paths. This would enable someone to compare templates for equality through a simple string equality check, without any parsing.
137
137
138
138
To achieve this, two extra rules are needed:
139
139
140
-
* Within Ranged index template, subsequent range MUST NOT start with the value that is equal to the end of the previous range plus one. Thus, <nowiki>"{1,2,3-5}"</nowiki> is not allowed, and should be specified as <nowiki>"{1-5}"</nowiki> instead. This rule might make templates less convenient for frequent edits, though.
140
+
* Within Ranged index template, subsequent range MUST NOT start with the value that is equal to the end of the previous range plus one. Thus, <code>{1,2,3-5}</code> is not allowed, and should be specified as <code>{1-5}</code> instead. This rule might make templates less convenient for frequent edits, though.
141
141
142
142
* Only one type of hardened marker should be allowed (either <code>h</code> or <code>'</code>).
143
143
144
144
Instead of requiring the second extra rule, implementations can simply replace one type of marker with another in the template strings before comparing them.
145
145
146
146
==Full and partial templates==
147
147
148
-
If the template starts with "m/", that means that this is the "full" template, that matches the whole path.
148
+
If the template starts with <code>m/</code>, that means that this is the "full" template, that matches the whole path.
149
149
150
-
If the template does not start with "m/", that means that this is a "partial" template, and it can be used to match a part of the path, in the contexts where this might be appropriate (for example, when constraints for the suffix of the path might be dynamic, while constraints for the prefix of the path are fixed).
150
+
If the template does not start with <code>m/</code>, that means that this is a "partial" template, and it can be used to match a part of the path, in the contexts where this might be appropriate (for example, when constraints for the suffix of the path might be dynamic, while constraints for the prefix of the path are fixed).
151
151
152
152
Full template can be combined with partial template, where partial template extends full template,
153
153
resulting in new, longer full template.
@@ -205,11 +205,11 @@ The full path template that only contains Unit index templates represents a full
205
205
206
206
There's no other path template standards that is known to the author currently.
207
207
208
-
There is a discussion on path templating for bitcoin script descriptors at https://github.com/bitcoin/bitcoin/issues/17190, which proposes the format '''"xpub...{0,1}/*"''', of which the '''"{0,1}/*"''' part would correspond to the partial path template in the format of this BIP.
208
+
There is a discussion on path templating for bitcoin script descriptors at https://github.com/bitcoin/bitcoin/issues/17190, which proposes the format <code>xpub...{0,1}/*</code>, of which the <code>{0,1}/*</code> part would correspond to the partial path template in the format of this BIP.
209
209
210
210
==Examples==
211
211
212
-
'''"m/{44,49,84}'/0'/0'/{0-1}/{0-50000}"''' specifies a full template that matches both external and internal chains of BIP44, BIP49 and BIP84 paths, with a constraint that the address index cannot be larger than 50000
212
+
<code>m/{44,49,84}'/0'/0'/{0-1}/{0-50000}</code> specifies a full template that matches both external and internal chains of BIP44, BIP49 and BIP84 paths, with a constraint that the address index cannot be larger than 50000
213
213
214
214
Its representation after parsing can be (using Python syntax, ignoring full/partial distinction):
@@ -218,12 +218,12 @@ Its representation after parsing can be (using Python syntax, ignoring full/part
218
218
[(0, 1)],
219
219
[(0, 50000)]]
220
220
221
-
'''"{0-2,33,123}/*"''' specifies a partial template that matches non-hardened values 0, 1, 2, 33, 123 as first index, and any non-hardened value at second index
221
+
<code>{0-2,33,123}/*</code> specifies a partial template that matches non-hardened values 0, 1, 2, 33, 123 as first index, and any non-hardened value at second index
0 commit comments