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
@@ -60,27 +61,27 @@ However, BIP-0039 has no error-correcting ability, cannot sensibly be extended t
60
61
61
62
===codex32===
62
63
63
-
A codex32 string is similar to a Bech32 string defined in [https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki BIP-0173].
64
-
It reuses the base32 character set from BIP-0173, and consists of:
64
+
A codex32 string is similar to a bech32 string defined in [https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki BIP-0173].
65
+
It reuses the base-32 character set from BIP-0173, and consists of:
65
66
66
67
* A human-readable part, which is the string "ms" (or "MS").
67
68
* A separator, which is always "1".
68
69
* A data part which is in turn subdivided into:
69
70
** A threshold parameter, which MUST be a single digit between "2" and "9", or the digit "0".
70
71
*** If the threshold parameter is "0" then the share index, defined below, MUST have a value of "s" (or "S").
71
-
** An identifier consisting of 4 Bech32 characters.
72
-
** A share index, which is any Bech32 character. Note that a share index value of "s" (or "S") is special and denotes the unshared secret (see section "Unshared Secret").
73
-
** A payload which is a sequence of up to 74 Bech32 characters. (However, see '''Long codex32 Strings''' below for an exception to this limit.)
74
-
** A checksum which consists of 13 Bech32 characters as described below.
72
+
** An identifier consisting of 4 bech32 characters.
73
+
** A share index, which is any bech32 character. Note that a share index value of "s" (or "S") is special and denotes the unshared secret (see section "Unshared Secret").
74
+
** A payload which is a sequence of up to 74 bech32 characters. (However, see '''Long codex32 Strings''' below for an exception to this limit.)
75
+
** A checksum which consists of 13 bech32 characters as described below.
75
76
76
-
As with Bech32 strings, a codex32 string MUST be entirely uppercase or entirely lowercase.
77
+
As with bech32 strings, a codex32 string MUST be entirely uppercase or entirely lowercase.
77
78
For presentation, lowercase is usually preferable, but uppercase SHOULD be used for handwritten codex32 strings.
78
79
If a codex32 string is encoded in a QR code, it SHOULD use the uppercase form, as this is encoded more compactly.
79
80
80
81
===Checksum===
81
82
82
83
The last thirteen characters of the data part form a checksum and contain no information.
83
-
Valid strings MUST pass the criteria for validity specified by the Python3 code snippet below.
84
+
Valid strings MUST pass the criteria for validity specified by the Python 3 code snippet below.
84
85
The function <code>ms32_verify_checksum</code> must return true when its argument is the data part as a list of integers representing the characters converted using the bech32 character table from BIP-0173.
85
86
86
87
To construct a valid checksum given the data-part characters (excluding the checksum), the <code>ms32_create_checksum</code> function can be used.
@@ -131,7 +132,7 @@ We do not specify how an implementation should implement error correction. Howev
131
132
* Implementations interpret "?" as an erasure.
132
133
* Implementations optionally interpret other non-bech32 characters, or characters with incorrect case, as erasures.
133
134
* If a string with 8 or fewer erasures can have those erasures filled in to make a valid codex32 string, then the implementation suggests such a string as a correction.
134
-
* If a string consisting of valid Bech32 characters in the proper case can be made valid by substituting 4 or fewer characters, then the implementation suggests such a string as a correction.
135
+
* If a string consisting of valid bech32 characters in the proper case can be made valid by substituting 4 or fewer characters, then the implementation suggests such a string as a correction.
135
136
136
137
===Unshared Secret===
137
138
@@ -226,7 +227,7 @@ In the case that the user wishes to generate a fresh master seed, the user gener
226
227
#* We do not define how to choose the identifier, beyond noting that it SHOULD be distinct for every master seed the user may need to disambiguate.
227
228
# ''t'' many times, generate a random share by:
228
229
## Take the next available letter from the bech32 alphabet, in alphabetical order, as <code>a</code>, <code>c</code>, <code>d</code>, ..., to be the share index
229
-
## Set the first nine characters to be the prefix <code>ms1</code>, the threshold vaue''t'', the 4-character identifier, and then the share index
230
+
## Set the first nine characters to be the prefix <code>ms1</code>, the threshold value''t'', the 4-character identifier, and then the share index
230
231
## Choose the next ceil(''bitlength / 5'') characters uniformly at random
231
232
## Generate a valid checksum in accordance with the Checksum section, and append this to the resulting shares
232
233
@@ -243,7 +244,7 @@ The conversion process consists of:
243
244
# Choose a 4 bech32 character identifier
244
245
#* We do not define how to choose the identifier, beyond noting that it SHOULD be distinct for every master seed the user may need to disambiguate.
245
246
# Set the share index to <code>s</code>
246
-
# Set the payload to a Bech32 encoding of the master seed, padded with arbitrary bits
247
+
# Set the payload to a bech32 encoding of the master seed, padded with arbitrary bits
247
248
# Generating a valid checksum in accordance with the Checksum section
248
249
249
250
Along with the codex32 secret, the user must generate ''t''-1 other codex32 shares, each with the same threshold value, the same identifier, and a distinct share index.
A long codex32 string follows the same specification as a regular codex32 string with the following changes.
290
291
291
-
* The payload is a sequence of between 75 and 103 Bech32 characters.
292
-
* The checksum consists of 15 Bech32 characters as defined above.
292
+
* The payload is a sequence of between 75 and 103 bech32 characters.
293
+
* The checksum consists of 15 bech32 characters as defined above.
293
294
294
295
A codex32 string with a data part of 94 or 95 characters is never legal as a regular codex32 string is limited to 93 data characters and a long codex32 string is at least 96 characters.
295
296
@@ -334,32 +335,32 @@ However this alternative approach is fraught with difficulties.
334
335
335
336
On approach would be to encode the BIP-0039 entropy along with the BIP-0039 checksum data.
336
337
This data can directly be recovered from the BIP-0039 mnemonic, and the process can be reversed if one knows the target language.
337
-
However, for a 128-bit seed, there is a 4 bit checksum yeilding 132 bits of data that needs to be encoded.
338
+
However, for a 128-bit seed, there is a 4 bit checksum yielding 132 bits of data that needs to be encoded.
338
339
This exceeds the 130-bits of room that we have for storing 128 bit seeds.
339
340
We would have to compromise on the 48 character size, or the size of the headers, or the size of the checksum in order to add room for an additional character of data.
340
341
341
342
This approach would also eliminate our short cut generation of a fresh master secret from generating random shares.
342
343
One would be required to first generate BIP-0039 entropy, and then add a BIP-0039 checksum, before adding a Codex32 checksum and then generate other shares.
343
-
In particular, this process could no longer be perfored by hand since it is effecitvely impossible to hand compute a BIP-0039 checksum.
344
+
In particular, this process could no longer be performed by hand since it is effectively impossible to hand compute a BIP-0039 checksum.
344
345
345
-
An alternative approach is to discard the BIP-0039 checksum, since it is inadqueate for error correction anyways, and rely on the Codex32 checksum.
346
+
An alternative approach is to discard the BIP-0039 checksum, since it is inadequate for error correction anyways, and rely on the Codex32 checksum.
346
347
However, this approach ends up eliminating the benefits of BIP-0039 compatibility.
347
348
While it is now possible to hand generate fresh shares, it is impossible to recover compatible BIP-0039 words by hand because, again, the BIP-0039 checksum is not hand computable.
348
349
The only way of generating the compatible BIP-0039 mnemonic is to use wallet software.
349
-
But if the wallet software is need to support this approach to decoding entropy, we may as well bypasss all of the overhead of BIP-0039 and directly encode the entropy of a BIP-0032 master seed, which is what we do in our Codex32 proposal.
350
+
But if the wallet software is need to support this approach to decoding entropy, we may as well bypass all of the overhead of BIP-0039 and directly encode the entropy of a BIP-0032 master seed, which is what we do in our Codex32 proposal.
350
351
351
352
Beyond the problems above, BIP-0039 does not define a single transformation from entropy to BIP-0032 master seed.
352
-
Instead every different language has it own word list (or word lists) and each choice of word list yeilds a different transformation from entropy to master seed.
353
-
We would need to encode the choice of word list in our share's meta-data, which takes up even more room, and is difficult to specify due to the the everevolving choice of word lists.
353
+
Instead every different language has it own word list (or word lists) and each choice of word list yields a different transformation from entropy to master seed.
354
+
We would need to encode the choice of word list in our share's meta-data, which takes up even more room, and is difficult to specify due to the ever-evolving choice of word lists.
354
355
355
-
Alternatively we could standardize on the choice of the English word list, something that is nearly a defacto standard, and simply be incompatible with BIP-0039 wallets of other langauges.
356
-
Such a choice also risks users of BIP-0039 recovering their entropy from their language, encoding it in in Codex32 and then failing to recover thier wallet because the English word lists has replaced their language's word list.
356
+
Alternatively we could standardize on the choice of the English word list, something that is nearly a de facto standard, and simply be incompatible with BIP-0039 wallets of other languages.
357
+
Such a choice also risks users of BIP-0039 recovering their entropy from their language, encoding it in in Codex32 and then failing to recover their wallet because the English word lists has replaced their language's word list.
357
358
358
359
The main advantage of this alternative approach would be that wallets could give users an option switch between backing up their entropy as a BIP-0039 mnemonic and in Codex32 format, but again, only if their language choice happens to be the English word list.
359
360
In practice, we do not expect users in switch back and forth between backup formats, and instead just generate a fresh master seed using Codex32.
360
361
361
-
Seeing little value with BIP-0039 compatiabilty (English-only), all the difficulties with BIP-0039 langauge choice, not to mention the PBKDF2 overhead of using BIP-0039, we think it is best to abandon BIP-0039 and encode BIP-0032 master seeds directly.
362
-
Our aproach is semi-convertable with BIP-0039's 512-bit master seeds (in all languages, see Backwards Compatibility) and fully interconvertable with SLIP-39 encoded master seeds or any other encoding of BIP-0032 master seeds.
362
+
Seeing little value with BIP-0039 compatibility (English-only), all the difficulties with BIP-0039 language choice, not to mention the PBKDF2 overhead of using BIP-0039, we think it is best to abandon BIP-0039 and encode BIP-0032 master seeds directly.
363
+
Our approach is semi-convertible with BIP-0039's 512-bit master seeds (in all languages, see Backwards Compatibility) and fully interconvertible with SLIP-39 encoded master seeds or any other encoding of BIP-0032 master seeds.
363
364
364
365
==Backwards Compatibility==
365
366
@@ -376,17 +377,17 @@ Instead, users who wish to switch to codex32 should generate a fresh seed and sw
376
377
377
378
==Reference Implementation==
378
379
379
-
Our [https://github.com/BlockstreamResearch/codex32](reference implementation repository) contains implementations in Rust and PostScript.
380
+
Our [https://github.com/BlockstreamResearch/codex32reference implementation repository] contains implementations in Rust and PostScript.
380
381
The inline code in this BIP text can be used as a Python reference.
381
382
382
383
==Test Vectors==
383
384
384
385
===Test vector 1===
385
386
386
387
This example shows the codex32 format, when used without splitting the secret into any shares.
387
-
The payload contains 26 Bech32 characters, which corresponds to 130 bits. We truncate the last two bits in order to obtain a 128-bit master seed.
388
+
The payload contains 26 bech32 characters, which corresponds to 130 bits. We truncate the last two bits in order to obtain a 128-bit master seed.
0 commit comments