1200wd / bitcoinlib

Bitcoin and other Cryptocurrencies Library for Python. Includes a fully functional wallet, Mnemonic key generation and management and connection with various service providers to receive and send blockchain and transaction information.
http://bitcoinlib.readthedocs.io/
GNU General Public License v3.0
602 stars 199 forks source link

Using private key generated from Electrum Wallet #271

Closed pamuassa22 closed 1 year ago

pamuassa22 commented 1 year ago

Hello. What I'm trying to do is to create a wallet in electrum, then import its master private key to use within bitcoinlib library. I've exported the xprv key through cmd 'wallet.keystore.xprv' in electrum, then I have imported it in bitcoinlib like that:

hdkey = bitcoinlib.keys.HDKey(import_key="xprv.........................................")

Then, I have made a wallet using this HDKey, like that:

w = bitcoinlib.wallets.wallet_create_or_open(name="wallet_name", keys=hdkey)

But if I get the address of 'w', and I sent something like 0.30$ to it, it won't show up anything in Electrum! What am I doing wrong? Sorry for my ignorance.

Thanks in advance.

mccwdev commented 1 year ago

Are you using the same keys path in Bitcoinlib and Electrum and do you import the masterkey in bitcoinlib?

Some examples can be found in the unittests: https://github.com/1200wd/bitcoinlib/blob/23e34fc57c512ebed9d06a67aeb506184775dc1f/tests/test_wallets.py#L725