-
Notifications
You must be signed in to change notification settings - Fork 5.8k
BIP93: correct threshold range #2023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lil-Duckling-22
wants to merge
4
commits into
bitcoin:master
Choose a base branch
from
Lil-Duckling-22:fix/threshold-description-consistency
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,8 +67,8 @@ It reuses the base-32 character set from BIP-0173, and consists of: | |
| * A human-readable part, which is the string "ms" (or "MS"). | ||
| * A separator, which is always "1". | ||
| * A data part which is in turn subdivided into: | ||
| ** A threshold parameter, which MUST be a single digit between "2" and "9", or the digit "0". | ||
| *** If the threshold parameter is "0" then the share index, defined below, MUST have a value of "s" (or "S"). | ||
| ** A threshold digit (also called ''k'' in the codex book), which MUST be a single digit between "2" and "9", or the digit "0". For shared secrets, this digit encodes the threshold (the number of shares required for recovery): thresholds 2-9 are encoded as digits "2"-"9" respectively. For unshared secrets, threshold 1 is denoted by the share index "s" (not by the threshold digit); the digit "0" is recommended for the threshold digit in this case, but any digit is allowed as it is ignored. | ||
| *** If the threshold digit is "0" then the share index, defined below, MUST have a value of "s" (or "S"). | ||
| ** An identifier consisting of 4 bech32 characters. | ||
| ** 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"). | ||
| ** A payload which is a sequence of up to 74 bech32 characters. (However, see '''Long codex32 Strings''' below for an exception to this limit.) | ||
|
|
@@ -146,14 +146,14 @@ The master seed is decoded by converting the payload to bytes: | |
|
|
||
| Note that unlike the decoding process in BIP-0173, we do NOT require that the incomplete group be all zeros. | ||
|
|
||
| For an unshared secret, the threshold parameter (the first character of the data part) is ignored (beyond the fact it must be a digit for the codex32 string to be valid). | ||
| We recommend using the digit "0" for the threshold parameter in this case. | ||
| For an unshared secret, the threshold digit (the first character of the data part) is ignored (beyond the fact it must be a digit for the codex32 string to be valid). | ||
| We recommend using the digit "0" for the threshold digit in this case. Note that threshold 1 is denoted by the share index "s", not by the threshold digit. | ||
| The 4 character identifier also has no effect beyond aiding users in distinguishing between multiple different master seeds in cases where they have more than one. | ||
|
|
||
| ===Recovering Master Seed=== | ||
|
|
||
| When the share index of a valid codex32 string (converted to lowercase) is not the letter "s", we call the string an codex32 share. | ||
| The first character of the data part indicates the threshold of the share, and it is required to be a non-"0" digit. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is correct. Read the line above: when the share index is not "s". The threshold parameter cannot be "0" in that case, so we know that for a codex32 share, the threshold parameter is required to be 2-9. |
||
| The first character of the data part is the threshold digit, which encodes the threshold (the number of shares required for recovery). For a codex32 share, the threshold digit is required to be a non-"0" digit (i.e., "2" through "9"), encoding thresholds 2 through 9 respectively. | ||
|
|
||
| In order to recover a master seed, one needs a set of valid codex32 shares such that: | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Digit vs parameter is probably bikeshedding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. And I don't think "digit" is the right term for a bech32 character anyway.