pooler/electrum-ltc

Importing seeds should support other strengths besides 128bits

CharlesJQuarra opened this issue · 4 comments

Not sure if this is bug or enhancement request - I tried to import a LTC cold wallet generated with 256bit strength (24 mnemonic words) but the wizard to import wallet from existing seed only allows 12 words (128bit strength)

Version 4.0.9.3 running on Mac OS X 10.13.6

How was the seed generated? Did you try checking BIP39 in Options when entering the seed?

I ran this script (depends on python-hdwallet) to generate the cold wallet, tried to use the same mnemonic generated here

from hdwallet import BIP44HDWallet
from hdwallet.derivations import BIP44Derivation
from hdwallet import HDWallet
from hdwallet.utils import generate_entropy
#from hdwallet.symbols import LTC
import hdwallet.cryptocurrencies as cc
from typing import Optional

import json

SYMBOL = "LTC"
COIN = cc.get_cryptocurrency(SYMBOL)

# Choose strength 128, 160, 192, 224 or 256
STRENGTH: int = 256  # Default is 128
# Choose language english, french, italian, spanish, chinese_simplified, chinese_traditional, japanese or korean
LANGUAGE: str = "english"  # Default is english
# Generate new entropy hex string
ENTROPY: str = generate_entropy(strength=STRENGTH)
# Secret passphrase for mnemonic
PASSPHRASE: Optional[str] = None

hdwallet: BIP44HDWallet = BIP44HDWallet(symbol=SYMBOL)
hdwallet.from_entropy(
    entropy=ENTROPY, language=LANGUAGE, passphrase=PASSPHRASE
)
hdwallet.clean_derivation()
print("Mnemonic:", hdwallet.mnemonic())

for address in range(5):
    bip44_derivation: BIP44Derivation = BIP44Derivation(
        cryptocurrency=COIN, account=0, change=False, address=address
    )
    hdwallet.from_path(path=bip44_derivation)
    # Print address_index, path, address and private_key
    print(f"({address}) {hdwallet.path()} {hdwallet.address()} 0x{hdwallet.private_key()}")
    # Clean derivation indexes/paths
    hdwallet.clean_derivation()


print(json.dumps(hdwallet.dumps(), indent=4, ensure_ascii=False))

It's importing fine for me if I check BIP39 in Options and then set the right derivation path.

Interesting, I did not try BIP39 option since the different BIP (this is presumably relying on BIP44) and the suggestion in the tooltip that it was less secure made me assume it was incompatible to this wallet scheme