sparrow icon indicating copy to clipboard operation
sparrow copied to clipboard

Feature request: Support lnd AEZEED seed import

Open jimbojw opened this issue 4 years ago • 2 comments

Background: Instead of using BIP-39, the lnd lightning implementation uses a cipher seed scheme called AEZEED. Implementation (Go) and details here: https://github.com/lightningnetwork/lnd/tree/master/aezeed

Feature request: Support the lnd AEZEED cipher seed format as an input mechanism in the Sparrow software wallet import dialog. This would allow users to recover/manage on-chain balances from an lnd wallet.

Workaround: A tool called guggero/chantools has a command called showrootkey that can retrieve the BIP-32 xprv. As of Sparrow v1.4.0, this can be imported directly in the software wallet import dialog.

Implementation notes: The part of the chantools code that converts the AEZEED mnemonic into the xprv starts on line 104 of lnd/aezeed.go:

	var mnemonic aezeed.Mnemonic
	copy(mnemonic[:], cipherSeedMnemonic)

	// If we're unable to map it back into the ciphertext, then either the
	// mnemonic is wrong, or the passphrase is wrong.
	cipherSeed, err := mnemonic.ToCipherSeed(passphraseBytes)
	if err != nil {
		return nil, time.Unix(0, 0), fmt.Errorf("failed to decrypt "+
			"seed with passphrase: %v", err)
	}
	rootKey, err := hdkeychain.NewMaster(cipherSeed.Entropy[:], params)
	if err != nil {
		return nil, time.Unix(0, 0), fmt.Errorf("failed to derive " +
			"master extended key")
	}
	return rootKey, cipherSeed.BirthdayTime(), nil

It looks like the mnemonic.ToCipherSeed() method is responsible for converting the AEZEED mnemonic into entropy bits. Note that hdkeychain is from btcsuite/btcutil.

jimbojw avatar May 04 '21 10:05 jimbojw

Outstanding Action: As with WIF paper wallet import, nice to have but may be significant work for a niche feature. Proposed Priority: Low

6102bitcoin avatar May 20 '21 21:05 6102bitcoin