AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 57 Bitcoin

wallet: use correct derivation for elements when using mnemonic hsm_secret.

Public commit record

What the developer wrote

Authored by Rusty Russell

73/100 · Adequate
wallet: use correct derivation for elements when using mnemonic hsm_secret.

Even though we don't do taproot addresses on elements yet, use the
same scheme for simplicity and for future when we *do* do taproot.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This change fixes how Core Lightning derives Bitcoin/Elements addresses when creating change outputs or PSBT outputs from a wallet seed phrase (mnemonic). Previously, on Elements sidechains, the code derived the public key one way and then built a SegWit address from it directly. Now it uses a dedicated helper that follows the same derivation path used elsewhere (including the future Taproot path). The practical risk is that change outputs could have been sent to addresses the wallet did not fully recognize or could not later spend from, which can lock up funds.

Recommended action

Review the implementation of p2wpkh_for_keyidx to confirm it uses the same derivation path as the wallet's address generation and key lookup. Test that existing Elements wallets with mnemonic hsm_secret can re-derive and spend previously created change outputs. Consider whether a migration or recovery tool is needed for any outputs created with the old derivation before this patch.

Security signals we found

01

Change output / PSBT output address derivation mismatch on Elements

02

Use of lower-level bip32_pubkey + manual scriptpubkey_p2wpkh replaced by unified p2wpkh_for_keyidx

03

Commit message frames change as 'correct derivation' for mnemonic-backed hsm_secret

04

Potential fund-recovery risk if wallet cannot re-derive the change path

Risk score

Why this scored 57/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 6/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.