Skip to content

feat(keyring): switch deriveContextHash to per-account-xpub semantics#5

Open
jrwbabylonlab wants to merge 2 commits intounisat-wallet:masterfrom
jrwbabylonlab:feat/derive-context-hash-account-level
Open

feat(keyring): switch deriveContextHash to per-account-xpub semantics#5
jrwbabylonlab wants to merge 2 commits intounisat-wallet:masterfrom
jrwbabylonlab:feat/derive-context-hash-account-level

Conversation

@jrwbabylonlab
Copy link
Copy Markdown
Contributor

@jrwbabylonlab jrwbabylonlab commented May 6, 2026

Summary

Changes deriveContextHash IKM source from a fixed BIP-32 path
(wallet-level) to the connected leaf's private key — the BIP-32 leaf
at the active receive-address path (e.g. m/44'/0'/0'/0/0). HD and
imported paths are now symmetric: one connected public key = one IKM =
one output.

Behavior change

Scenario Before After
Same wallet, different receive addresses Same Different
Same wallet, account 0 vs account 1 Same Different
Same wallet, BIP-44 vs BIP-86 Same Different
Same connected leaf called twice Same Same
Imported wallets Per-key Per-key (unchanged)

dApps that need cross-leaf shared state (e.g. account-scoped data) must
do that aggregation themselves — they're connecting one address at a
time, so they get exactly one output per connection.

Breaking change is sanctioned by @experimental

deriveContextHash is marked Experimental in the inpage method,
type registry, API docs, doc index, and release notes. The API docs
explicitly tell integrators to use feature detection. Salt unchanged —
the IKM-source change alone produces independent outputs from v1.0.

Implementation note

The HD-keyring lookup matches the connected pubkey against the keyring's
existing leaf wallets and uses that leaf's private key directly as IKM.
No new BIP-32 derivation path; reuses whatever path the keyring is
already authorized for.

Spec updates: babylonlabs-io/babylon-toolkit#1540

@jrwbabylonlab jrwbabylonlab marked this pull request as ready for review May 6, 2026 12:23
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.

1 participant