Skip to content

doc: Update wallets.md generation draft for BIP-93 and python-codex32 v1 - #7

Draft
BenWestgate wants to merge 11 commits into
57-wallet-add-doc-for-generatingfrom
claude/project-thread-jnw01c
Draft

BenWestgate wants to merge 11 commits into
57-wallet-add-doc-for-generatingfrom
claude/project-thread-jnw01c

Conversation

@BenWestgate

@BenWestgate BenWestgate commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Requested by Ben · project thread

Proposed update to BlockstreamResearch#71. It's opened against BlockstreamResearch#71's head branch so it can be reviewed before anything reaches the upstream PR. Merging this PR updates BlockstreamResearch#71.

It addresses the 2026-10-03 note on BlockstreamResearch#71: drop guidance that BIP-93 now covers, make share sets use a user-selected or random identifier, and follow python-codex32's v1 ms32 create flow (reviewability-v1). Share set generation is now in the follow-up #8, which is stacked on this branch.

Commits

  1. Defer seed lengths and HRPs to BIP-93. Generation must support 128 or 256 bits and defaults to 128. HRP registration and length rules are left to BIP-93/SLIP-0173. Wallets use ms and never offer it as an option.
  2. Derive identifiers only for unshared secrets. The fingerprint default applies only to freshly generated unshared secrets. Share sets MUST NOT use a secret-derived identifier. A wallet MUST NOT create two share sets of one secret with the same header.
  3. Match python-codex32 CRC padding. The old snippet started the CRC register at 0, but v1 starts it at 1. It's replaced with a short crc_pad that matches v1 for all six seed lengths, and both test vectors are regenerated.
  4. Follow ms32 create display and confirmation. Show four windows per row, and show the identifier and the fresh-seed fingerprint. Confirmation aligns entries so an insertion or deletion marks only nearby windows, and re-asks only the wrong windows. Adds the caveat that confirmation can't prove the written copy was fixed.
  5. Quote BIP-93 correction limits. The checksum corrects 4 substitutions, 8 erasures, or 13 consecutive erasures.

Review fixes

  1. Leave seed length limits to BIP-93. Drops the repeated generation rule and the list of optional import lengths.
  2. Tighten the identifier policy. Drops the 20-bit leak note and the "would link" claim. Merges the repeated user-selected-or-random rules, and asks wallets to show a generated identifier and let the user edit it.
  3. Fix display and confirmation details. Windows can alternate weight, color or background. "Terminal scrollback" is dropped. Confirmation no longer ignores case: an all-uppercase or all-lowercase entry is fine, but mixed case is rejected.
  4. Label test vector data types. Adds (hex), (binary) and (bech32) labels.
  5. Move share set generation to a follow-up PR (doc: Add share set generation guidance to wallets.md #8).

Verification

  • crc_pad in the doc equals python-codex32 v1 _crc_pad on 300 random seeds of each BIP-93 length, plus all-zero and all-one seeds.
  • The vectors decode with python-codex32 v1 and with the BIP-93 reference ms32_decode. The review fixes changed only their labels.

Not changed

  • Import Support, apart from the seed-length line.
  • Partial verification (the Jade method).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JjfHnJYx61dYZxUGWTL9nS

BIP-93 now restricts master seeds to 128, 160, 192, 224, 256 and 512
bits, so wallets.md no longer needs to discourage other lengths. Keep
128 and 256 bits as the import baseline and default generation to 128.

Human-readable part registration and length rules belong to BIP-93 and
SLIP-0173. Bitcoin wallets only need to use ms and never offer it as an
option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N8jLK7YowhkeTheJRzgs7d
Every share carries the identifier, so an identifier derived from the
secret gives a holder of fewer than the threshold of shares a 20-bit
test against candidate secrets and links each share to the wallet's
public fingerprint. Keep the fingerprint default for freshly generated
unshared secrets only; share sets use a user-selected or random
identifier.

This matches the identifier policy of python-codex32's v1 branch, which
also uses random identifiers when encoding existing seeds and rejects a
re-shared set that repeats the source set's header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N8jLK7YowhkeTheJRzgs7d
The padding code started the CRC register at 0, while python-codex32's
v1 generator starts it at 1 (equivalently, prefixes the seed bits with
a single 1 bit). Replace the convertbits-based snippet with a short
crc_pad function that matches v1 for every BIP-93 seed length, say that
importers must accept any padding, and regenerate both test vectors.

The vectors were checked against python-codex32 v1, the BIP-93
reference decoder, and an independent BIP-0032 fingerprint calculation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N8jLK7YowhkeTheJRzgs7d
Bring the display and full-verification guidance in line with the
python-codex32 v1 ms32 create flow, which works well on full-keyboard
desktop wallets:

- Group windows four per row to match a recovery card template.
- Show the identifier, share details and, for fresh seeds, the master
  fingerprint the user records.
- Clear the string, including scrollback, before re-entry.
- Ignore spaces and case, align the entry so an insertion or deletion
  marks only nearby windows, and re-ask only the wrong windows.
- Note that confirmation cannot prove the written copy was corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N8jLK7YowhkeTheJRzgs7d
The checksum corrects up to 4 substitutions, 8 erasures, or 13
consecutive erasures; it does not correct 4 errors and 13 erasures at
once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N8jLK7YowhkeTheJRzgs7d
Ben's review note on this PR points to python-codex32's v1 staging
branches for share generation. Describe what its ms32 create does so
other wallets can follow it:

- random share indices instead of alphabetical ones;
- redraw the last random share until the secret has CRC padding;
- re-encode an existing secret under a new header before sharing;
- generate and confirm one share at a time, and import only after
  every share is confirmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N8jLK7YowhkeTheJRzgs7d
@BenWestgate BenWestgate self-assigned this Oct 28, 2026

@BenWestgate BenWestgate left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requesting changes and answers to questions.

Comment thread docs/wallets.md Resolved
Comment thread docs/wallets.md Resolved
Comment thread docs/wallets.md
* The default SHOULD be the bech32-encoded BIP-0032 master key fingerprint.
* The identifier groups shares belonging to the same secret and helps users tell backups apart. It is public metadata, not authentication.
* Only unshared secrets MAY use an identifier derived from the secret.
* For a freshly generated unshared secret, the default SHOULD be the first four bech32 characters (20 bits) of its BIP-0032 master key fingerprint.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should or may which is best here?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept SHOULD. The next line's benefit, a stateless wallet finding the right backup from a descriptor or PSBT, only works if wallets can count on the fingerprint default. With MAY, no wallet could assume it. Since f8b3204, wallets also SHOULD show the generated identifier and let the user edit it, so a user who knows of a clash can still change it. Say if you'd still prefer MAY.


Generated by Claude Code

Comment thread docs/wallets.md Resolved
Comment thread docs/wallets.md Resolved
Comment thread docs/wallets.md Resolved
Comment thread docs/wallets.md Resolved
Comment thread docs/wallets.md Resolved
Comment thread docs/wallets.md Resolved
Comment thread docs/wallets.md Resolved
BIP-93 already restricts master seeds to its six lengths, so drop the
line repeating that for generation and the list of the optional
lengths for import, which would need updating if BIP-93 changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JjfHnJYx61dYZxUGWTL9nS
- Drop the note that the default identifier leaks 20 bits of the
  fingerprint. Only unshared secrets use it, and anyone who sees one
  already has the whole seed.
- Drop the claim that a secret-derived share identifier links shares
  to the fingerprint; not every secret-derived identifier does. The
  threshold argument alone rules them out.
- Merge the repeated "user selected or random" rules into one, and
  ask wallets to show a generated identifier and let the user edit
  it, since the user may know it matches another backup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JjfHnJYx61dYZxUGWTL9nS
- Let wallets alternate color or background, not only font weight,
  between windows.
- Drop "terminal scrollback": this guidance is aimed at graphical
  wallets.
- Confirmation must not ignore letter case, since mixed case is
  invalid. An all-uppercase or all-lowercase entry is fine, and as
  during import the user should only be able to type uppercase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JjfHnJYx61dYZxUGWTL9nS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JjfHnJYx61dYZxUGWTL9nS
Keep this PR to unshared secret generation so it stays small enough
to review. The share set section returns, with the review fixes, in
a follow-up PR stacked on this one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JjfHnJYx61dYZxUGWTL9nS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants