SatSale/SatSale

xpub key generated by Electrum doesn't work

Opened this issue · 2 comments

I am using Electrum 4.4.5 and 287d30d

I am trying to use the master public key from the wallet I created in Electrum as "xpub" in the config, but I get this error:

[INFO] Initialised Flask with secret key: ...
[INFO] Deriving addresses for first time from xpub: zpub...
[WARNING] YOU MUST CHECK THIS MATCHES THE FIRST ADDRESS IN YOUR WALLET:
Traceback (most recent call last):
  File "satsale.py", line 415, in <module>
    bitcoin_node = xpub.xpub(method)
  File "node\xpub.py", line 42, in __init__
    logging.warn(self.get_address_at_index(next_n))
  File "node\xpub.py", line 108, in get_address_at_index
    bip84_acc = Bip84.FromExtendedKey(self.config["xpub"],
  File "venv\lib\site-packages\bip_utils\bip\bip84\bip84.py", line 99, in FromExtendedKey
    return cls._FromExtendedKey(ex_key_str, Bip84ConfGetter.GetConfig(coin_type))
  File "venv\lib\site-packages\bip_utils\bip\bip44_base\bip44_base.py", line 114, in _FromExtendedKey
    return cls(bip32_cls.FromExtendedKey(ex_key_str, coin_conf.KeyNetVersions()),
  File "venv\lib\site-packages\bip_utils\bip\bip44_base\bip44_base.py", line 194, in __init__
    raise Bip44DepthError(
bip_utils.bip.bip44_base.bip44_base_ex.Bip44DepthError: Depth of the public-only Bip object (<bip_utils.bip.bip32.bip32_key_data.Bip32Depth object at 0x000001FDC270B850>) is below account level or beyond address index level

Was able to reproduce with freshly generated Electrum wallet, will look into it.

Ohh, that's because Electrum uses custom key derivation path, not BIP84.

It looks there is some Electrum support in used bip-utils package for handling xpubs (ElectrumV2Segwit), but that needs to be implemented in SatSale side too.