bitcoindevkit / bdk

A modern, lightweight, descriptor-based wallet library written in Rust!
Other
801 stars 289 forks source link

Support for codex32/BIP93 seed import #1027

Open apoelstra opened 1 year ago

apoelstra commented 1 year ago

Hi all,

I would like to support importing seeds in the BIP93 format, which consists of either

I am happy to do 100% of the implementation and integration work. We will require a new dependency, rust-codex32, though I am working on the existing dependency rust-bech32 to make it generic over checksum types, which may make rust-codex32 small enough that we can just inline the essential funcitonality.

See https://secretcodex32.com/index.html for more information.

Would people be interested/accepting of this?

notmandatory commented 1 year ago

This looks like a valuable addition to me.

If it adds a new dependency I think it'd be best to add a new optional feature like what we did for bip39, but if it becomes part of rust-bech32 it shouldn't need a feature flag. Will this only require a little glue code like impl<Ctx: ScriptContext> DerivableKey<Ctx> for Codex32String ?

apoelstra commented 1 year ago

@notmandatory yeah, not much more than that. Though it won't be DerivableKey but probably something else because codex32 seeds are BIP32 seeds rather than keys. (The same applies to bip39 seed words; I'll just copy whatever API exists for that.)

Sure, I'm happy to have a feature gate as long as we need an extra dep.

apoelstra commented 10 months ago

FYI this is blocked on resolving https://github.com/BlockstreamResearch/codex32/pull/58 which determines the exact import rules. It won't be quite as simple as I imagined because I'd like to write an API that answers all the user-facing questions about e.g. what to do about erroneous inputs, repeated shares, etc.