spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.33k stars 3.05k forks source link

InternalAddressCorruption, cannot restore same wallet from xprv or private keys #7363

Open Richi85 opened 3 years ago

Richi85 commented 3 years ago

Good day community. I have a problem with private key import. So, i have few private keys with positive balance. Legacy P2PKH start with K or L and adress begin with 1. When i create new wallet with options Import private keys my balans 0 zero. And adress is another that i have. Also i have private master key XPRV but when i create wallet result the same as above - ballance 0 and i can't find my true address. Electrum wallet version 4.1.4 downloaded from official site. Also i tried on older version same like 3.2..., 3.3...., etc. All are the same. Also how can i change derivation paths BIP44 during master key import? Please clarify.

Transisto commented 3 years ago

Did you enter the key type prefix when you imported like explained here? image

There is no need to enter a derivation path for individual private keys.

Richi85 commented 3 years ago

Yes, i did it. I copied with p2pkh:........private key...... Already 3 days i try to restore access to my coins but nothing.

SomberNight commented 3 years ago

Where are the private keys and xprv originally from? What wallet did you use to create them? Please give some context.

Richi85 commented 3 years ago

Electrum version 4.1.4. Downloaded from officcial site. XPRV, Private keys, seed i took from electrum consol. Also electrum create files json. I did it when electrum rejected transaction "Script failed an OP_EQUALVERIFY operation". I tried to change networks, i tried to spend coins,... but nothing. Also i can open wallet file by Notepad ++ and i can see there my seed, xprv, previous transaction with id, etc.

SomberNight commented 3 years ago

Electrum version 4.1.4. Downloaded from officcial site. XPRV, Private keys, seed i took from electrum consol.

So had you used Electrum 4.1.4 to create a new standard wallet (along with seed words)? Did you write those seed words down, when they were shown the first time (as part of the wizard)? Just try to restore from that seed.

So is it the case that you created a wallet with Electrum 4.1.4, have corresponding wallet file (e.g.) "wallet1", and are now trying to restore from seed/xprv/privkeys and create wallet file "wallet2" but wallet1 and wallet2 unexpectedly do not have the same addresses?

Also, I see you have also commented in another thread, here: https://github.com/spesmilo/electrum/issues/6537#issuecomment-868287612 Could you clarify why you commented in that specific thread? Did you get the error/exception shown there?

Richi85 commented 3 years ago

Yes, i also commented #6537 because initialy electrum anounced above error and i pressed send to. Thence was link watch your bug on github. When i followed i sow similar report of above error from other users. Pre-history how its happened. Before i used version 3 (dont remember exatly), then it updated several times. Time after time i saved wallet file to stick disc (backup). 2 weeks ago my operation system collapsed due to windows update installation (windows system 7 x64). I was made re-install by the same system from CD. Thens install electrum last version what was on Electrum.org. My laptop is not new so to avoid further problems i tried transfer coins from electrum to Trust wallet and that time error messege raised. Wallet file checked for viruses but it clear. Also if i can to open by Notepad++ and clear to read all info how it be damaged as anounced by electrum. Also i followed by instruction described on github when users are reported about same error. One more, i think important notice. I passed to ioancoleman site in order to check my derivation path (missing addresse) by seed and founded that its generate different xprv that i have. I did it on bip 44 and chose coin BTC for example m/0/0/0,....etc. But when i open wallet file by Notepad i can clear to see seed, xprv, private keys,...

SomberNight commented 3 years ago

Yes, i also commented #6537 because initialy electrum anounced above error and i pressed send to. Thence was link watch your bug on github. When i followed i sow similar report of above error from other users. i tried transfer coins from electrum to Trust wallet and that time error messege raised. Also if i can to open by Notepad++ and clear to read all info how it be damaged as anounced by electrum.

That error message is raised because your wallet is failing internal consistency checks. For example, the xpub does not correspond to the addresses.

Before i used version 3 (dont remember exatly), then it updated several times. Time after time i saved wallet file to stick disc (backup).

If you have a backup of your original seed, try to restore from that. If you have multiple backups of wallet files, try to restore those one-by-one.

One more, i think important notice. I passed to ioancoleman site in order to check my derivation path (missing addresse) by seed and founded that its generate different xprv that i have. I did it on bip 44 and chose coin BTC for example m/0/0/0,....etc.

Do you have a specific URL for the website? Do you mean https://iancoleman.io/bip39/ ? Unlike that website, Electrum does not use BIP39. Also, unlike with BIP39, Electrum seeds manage script types and derivation path on behalf of the user. In short, that website is simply not applicable if you have a seed generated by Electrum.


Have you ever successfully spent coins from this wallet?

Richi85 commented 3 years ago

Result still negative. This seed generated by Electrum from first creation. Also i have only one backup file - last one. Very strange that i can see my adddresses if i run backup file but when i tried any type of recovering wallet i cant found my real addresses.

Richi85 commented 3 years ago

If i try to send via consol ? Its safe i mean i will not lose coins forever ?

SomberNight commented 3 years ago

Very strange that i can see my adddresses if i run backup file but when i tried any type of recovering wallet

Like I said, you are getting the InternalAddressCorruption error because the application detected that something weird is going on. Some of the addresses stored in the wallet file do not correspond to the xpub. This is exactly why you are seeing different addresses when you try to restore: the new addresses are the ones that do correspond.


Have you ever successfully spent coins from this wallet?

^ Please answer that. You said you created the seed a long time ago. During that time, have you EVER tried spend coins from the wallet? Or have you only received coins but never sent?

Richi85 commented 3 years ago

I transfered several times. There not to much but anyway.

Richi85 commented 3 years ago

Very strange that i can see my adddresses if i run backup file but when i tried any type of recovering wallet

Like I said, you are getting the InternalAddressCorruption error because the application detected that something weird is going on. Some of the addresses stored in the wallet file do not correspond to the xpub. This is exactly why you are seeing different addresses when you try to restore: the new addresses are the ones that do correspond.

When i play with derivation path i can found new addresses with balance zero and transaction what i never did. For example in one address transaction was 1,5 btc on 2020 - i never had a lot of coins. Strange.... Alright i will try something else.... Anyway thank you for your cooperation.