Skip to content

wallet: add codex32 argument to addhdkey#32652

Closed
roconnor-blockstream wants to merge 10 commits intobitcoin:masterfrom
roconnor-blockstream:codex32
Closed

wallet: add codex32 argument to addhdkey#32652
roconnor-blockstream wants to merge 10 commits intobitcoin:masterfrom
roconnor-blockstream:codex32

Conversation

@roconnor-blockstream
Copy link
Contributor

@roconnor-blockstream roconnor-blockstream commented May 30, 2025

Rebase of #27351 onto #29136.

WIP

This PR introduces the ability to import BIP 93/codex32 master seeds with the addhdkey command. It currently expects seeds to be provided in either as a single seed or as a list of shares which can be assembled via Shamir Secret Sharing.

achow101 added 2 commits May 28, 2025 12:38
unused() descriptors do not have scriptPubKeys. Instead, the wallet uses
them to store keys without having any scripts to watch for.
@DrahtBot
Copy link
Contributor

DrahtBot commented May 30, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32652.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK achow101

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #bitcoin-core/gui/872 (Menu action to export a watchonly wallet by achow101)
  • #33392 (wallet, rpc: add UTXO set check and incremental rescan to importdescriptors by musaHaruna)
  • #33135 (wallet: warn against accidental unsafe older() import by Sjors)
  • #33008 (wallet: support bip388 policy with external signer by Sjors)
  • #32861 (Have createwalletdescriptor auto-detect an unused(KEY) by Sjors)
  • #32489 (wallet: Add exportwatchonlywallet RPC to export a watchonly version of a wallet by achow101)
  • #30243 (descriptors: taproot partial descriptors by Eunovo)
  • #29136 (wallet: addhdkey RPC to add just keys to wallets via new unused(KEY) descriptor by achow101)
  • #28690 (build: Introduce internal kernel library by TheCharlatan)
  • #28333 (wallet: Construct ScriptPubKeyMans with all data rather than loaded progressively by achow101)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

LLM Linter (✨ experimental)

Possible typos and grammar issues:

  • In codex32.cpp comment: residue ("secretshare32" or "secretshare32ex". → residue ("secretshare32" or "secretshare32ex") [missing closing parenthesis]

drahtbot_id_4_m

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Task previous releases, depends DEBUG: https://github.com/bitcoin/bitcoin/runs/43216931922
LLM reason (✨ experimental): The CI failure is due to a compilation error caused by an invalid use of dynamic_cast on a non-pointer type.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@achow101
Copy link
Member

achow101 commented Jun 2, 2025

Concept ACK-ish

This is certainly better than the previous approach.

roconnor-blockstream and others added 2 commits July 4, 2025 15:56
In the next commit we will implement a new checksum, codex32, which uses
the same encoding and HRP rules as bech32 and bech32m, but has a
substantially different checksum verification procedure. To minimize
duplicated code, we expose the character conversion in a new
bech32::internals module.
@roconnor-blockstream
Copy link
Contributor Author

Can you elaborate?

@achow101
Copy link
Member

I suppose NACK is a bit too strong.

While codex32 itself is interesting, it is not interesting enough that any contributors to this project is interested in reviewing PRs including it.

@Sjors
Copy link
Member

Sjors commented Oct 24, 2025

I still haven't gotten around to trying the paper booklet instructions. If and when I do that, I'll probably review this. But no idea when that is.

@BenWestgate
Copy link
Contributor

I still haven't gotten around to trying the paper booklet instructions. If and when I do that, I'll probably review this. But no idea when that is.

From BIP-0093:

...hand computation is optional, ... and implementers do not need to be concerned with this possibility.

To encode some codex32 strings to import without the paper booklet there are libraries in Rust, Ruby and Python.

@kiwihodl
Copy link

@achow101 if there is renewed interest in testing these PR's will you reopen it?

@kiwihodl
Copy link

I still haven't gotten around to trying the paper booklet instructions. If and when I do that, I'll probably review this. But no idea when that is.

@Sjors if I sent you some metal codedx32 (currently awaiting to laser engrave them), would that make it easier for you to test? Don't have to fluff about with cutting it out or piecing it together.

https://x.com/bitcoinbutlers/status/2013997324050084325

@achow101
Copy link
Member

@achow101 if there is renewed interest in testing these PR's will you reopen it?

There needs to be interest to review the PR, not just test it. Further, current contributors must also be interested. AFAICT there is no interest from current contributors in reviewing this PR.

@kiwihodl
Copy link

@achow101 I appreciate the clarification. Looking at the history:

PR #27351 received Concept ACKs from @josibake, @S3RK, and you yourself gave a “Concept ACK-ish” on this PR (#32652), noting it was “better than the previous approach.”

@BenWestgate is also an active contributor who’s engaged with codex32 work.

What would it take specifically to move this forward? Is the blocker:

1.	Code review bandwidth from existing contributors?
2.	Architectural concerns with the approach?
3.	Something else?

If it’s review bandwidth, I’d be happy to help coordinate interest from the codex32 community. There are real users waiting for this. I'm building metal backup products specifically for codex32 and currently the only wallet support is Bails/Bitcoin Knots.

Comment on lines +93 to +104
/** Accessor for the binary payload data (in base 256, not gf32) */
std::vector<unsigned char> GetPayload() const {
assert(IsValid());

std::vector<unsigned char> ret;
ret.reserve(((m_data.size() - 6) * 5) / 8);
// Note that `ConvertBits` returns a bool indicating whether or not nonzero bits
// were discarded. In BIP 93, we discard bits regardless of whether they are 0,
// so this is not an error and does not need to be checked.
ConvertBits<5, 8, false>([&](unsigned char c) { ret.push_back(c); }, m_data.begin() + 6, m_data.end());
return ret;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

We've noticed that accessing the binary payload for non-"s" strings is 1) useless, 2) can't round trip back to a share without passing the padding, 3) isn't enough information to recover the secret unambiguously.

We don't define how to decode shares to bytes in BIP93 so unless we do, perhaps gate this for "s" only.

@achow101
Copy link
Member

PR #27351 received Concept ACKs from @josibake, @S3RK

My understanding is that they are currently unable to dedicate time to the project in general.

Furthermore, just because something has Concept ACKs does not mean that it has reviewer buy in. If those Concept ACKs don't convert into actual code review after some time, that indicates that while the Concept ACKer was interested, they weren't interested enough to put in the work to actually review the PR.

and you yourself gave a “Concept ACK-ish” on this PR (#32652), noting it was “better than the previous approach.”

Which was effectively rescinded by my closure of this PR. I also refer to my previous point - I thought this was interesting, but it is not interesting enough to put review effort into it.

@BenWestgate is also an active contributor who’s engaged with codex32 work.

They are still new to the Bitcoin Core project and are not yet a regular contributor.

  1. Code review bandwidth from existing contributors?

Primarily this. Actual code review may lead to concerns with the approach, but no one has actually done that yet.

If it’s review bandwidth, I’d be happy to help coordinate interest from the codex32 community.

We generally are not interested in a PR that is reviewed solely by people new to Bitcoin Core. Such reviews are not very valuable as there are many intricacies of this codebase which are difficult to understand. New reviewers will have not yet demonstrated competency or knowledge of this codebase, and as such their reviews are given less weight than a regular contributor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants