-
Notifications
You must be signed in to change notification settings - Fork 5.8k
BIP85: Add Codex32 as application 93' #1958
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
base: master
Are you sure you want to change the base?
Conversation
|
Documenting recent discussions: |
It seems you'd like to consolidate some of the paths. There's a few ways to do this, if you have a favorite or one that immediately stands out as obvious let me know. I think
I'm thinking the identifier could be the bech32 encoding of the bip85 index, as the purpose of incrementing the index is to get new seeds, and BIP93 says "...the identifier SHOULD be distinct for all master seeds the user may need to disambiguate." index = 0 -> identifier = qqqq, index = 1 -> identifier qqqp, and so on. A particular identifier can be selected by converting it to an integer {index} once index reaches 32^4, it can fall back to the default BIP-0032 fingerprint. On byte extraction: I agree we should draw |
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.
Pinging @scgbckbone (who has been active on BIP85 review) for feedback.
|
Seems to me this is well over the BIP-85 application scope. As I understand it, BIP85 generates "a thing" from "a thing". Your application is generating "multiple things" from "a thing". Why are you generating multiple initial shares via BIP85 ? What I imagined BIP85 application should looks like after reading BIP93:
** maybe even threshold should be part of the BIP32 derivation path, BUT I think not as it has no effect to the actual secret generated (it only affects checksum) Assuming I'm not wrong in my "specualtion", why not just use m/83696968'/128169'/{num_bytes}'/{index}' to generate deterministic bytes from BIP-32 root seed for any share ? |
|
Thank you for great feedback @scgbckbone. I'll explain the rationale behind your questions first.
True, but that thing can be structured.
Determinism. bip85 = Bip85(master_root_xprv)
# 1. generate secret share "s" from root seed
secret1 = bip85.derive_codex32(t=3, share_idx='s')
# 2. generate `k` any non-"s" shares from root seed, interpolate according to BIP93
secret2 = Codex32String.interpolate_at(
[
bip85.derive_codex32(k=3, share_idx='a'),
bip85.derive_codex32(k=3, share_idx='c),
bip85.derive_codex32(k=3, share_idx='d'),
],
target="s"
)
secret3 = Codex32String.recover(
[
bip85.derive_codex32(k=3, share_idx='x'),
bip85.derive_codex32(k=3, share_idx='y),
bip85.derive_codex32(k=3, share_idx='z'),
],
target="s"
)
derived_secrets = [secret1, secret2, secret3]
identifiers = set()
master_seeds = set()
for secret in derived_secrets:
identifiers.add(secret.identifier)
master_seeds.add(secret.data)
if len(identifiers) < len(master_seeds):
raise Bip93Quote("Identifier SHOULD be distinct for every master seed the user may need to disambiguate")For the same BIP85 root key, each
For secret sharing, the For unshared secrets, the threshold has no effect, so it'd be ideal to ignore it when not secret sharing. That way, knowing the BIP85 index and root key uniquely identifies the seed, regardless of threshold, consistent with other BIP85 applications.
Then why not use that for BIP39 or any other application too? Based on feedback from you and @akarve
Simplifications:
Example of the simplified form: bip85 = Bip85(master_root_xprv)
# 1. generate k=0 secret share "s" from root seed
secret1 = bip85.derive_codex32(k=0)
# 2. generate `k` fixed non-"s" shares from root seed, interpolate according to BIP93
shares = bip85.derive_codex32(k=2)
secret2 = Codex32String.interpolate_at(shares, target="s")
shares = bip85.derive_codex32(k=3)
secret3 = Codex32String.interpolate_at(shares, target="s")
derived_secrets = [secret1, secret2, secret3]
identifiers = set()
master_seeds = set()
for secret in derived_secrets:
identifiers.add(secret.identifier)
master_seeds.add(secret.data)
assert len(identifiers) == len(master_seeds)
# header is distinct for each master seed the user may need to disambiguate
assert len(master_seeds) == 1
# same master seed for same {index}, regardless of k
The version brings it back within scope:
|
This allows wallets to derive codex32 secrets and codex32 shares from BIP-0032 master keys.
Summary of changes
Rationale
Specification
Tests
Reference tests and new vectors will be included in the reference bipsea implementation:
BenWestgate/bipsea@master...BenWestgate:bipsea:master
Mailing List
Discussion: https://groups.google.com/g/bitcoindev/c/--lHTAtq0Qc
Status
Ready for conceptual and approach review. This change is additive and does not modify existing BIP-85 behavior.