spesmilo / electrum

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

Electrum, wallet corrupted, from 3.3.8 - 4.0.2 imported Bitcoin Core #6399

Closed Nemesidis closed 3 years ago

Nemesidis commented 3 years ago

I am new happy owner of unspendable coins. That show in my Electrum imported wallet but nowhere else.

When creating wallet i didn't try to spend any Coins from it, which was stupid, should of at least tested.

I created imported wallet in 3.3.8, imported keys from Bitcoin Core. Everything seemed fine. Except since i am not a professional bitcoin user. I did not notice that addresses generated do not belong to imported keys, instead of that addresses was generated incorrectly, or unspendable addresses as they got no private keys and no seed. The main issue is i do not remember creating any Standard wallets therefor i have no seed. Now i cannot see or transfer my funds out of electrum wallet. They are unspent and show as mine, addresses and funds. My current Electrum version is 4.0.2. As electrum basically does not see keys for that receiving addresses i guess, i am also unable to transfer funds out of it.

Problem is i have substantial summ stuck now in the wallet and no idea on how to fix it or what to do about it. I thought that corrupted wallet issue was fixed previously. Does this happen only when creating after standard wallet, or this just happens randomly? And what is the way to ammend the issue?

I had no warnings or any other errors when generating receive addresses and no messages about corrupted wallet file at any given time. Also my wallet is not watch only. It says Standard - Imported.

I don't use USB or Network drives, the wallet was created and stayed on same pretty reliable HDD that has no issues so far.

SomberNight commented 3 years ago

In the Qt GUI, top menubar, go to Wallet>Information. What do you see there? e.g. what does it say for:

Nemesidis commented 3 years ago

Wallet type: imported Script type: address Seed Available: No Keystore type: imported

Nemesidis commented 3 years ago

As additional info. I cannot get private keys for any of the addresses generated by Electrum. And get private keys from GUI shows crash with bug report, or shows blank. i Sent this issue from automatic report earlier. #6394

SomberNight commented 3 years ago

When did this "corruption" happen? Did the wallet file work properly in 3.3.8? Do you still have the original keys outside of Electrum?

It might make things easier if you are willing to sacrifice your privacy (share addresses/etc).

You could run these commands in the Console tab in Electrum: wallet.db.imported_addresses and wallet.keystore.keypairs.keys(), so e.g.:

>> wallet.db.imported_addresses
{'15hETetDmcXm1mM4sEf7U2KXC9hDHFMSzz': {'pubkey': '0278d4aa2a1c643fc68a0de5454e47c520cf59643526474e63b320144de9e0d59a', 'redeem_script': None, 'type': 'p2pkh'}, '1LcXfWmCJmvqgpFKDBRhjyN3QqzmawmEAj': {'pubkey': '02fe63dc468a135029112a2840d13d70f3569bdd66ce316d20b2f203f0a2070f83', 'redeem_script': None, 'type': 'p2pkh'}}

>> wallet.keystore.keypairs.keys()
dict_keys(['0278d4aa2a1c643fc68a0de5454e47c520cf59643526474e63b320144de9e0d59a', '02fe63dc468a135029112a2840d13d70f3569bdd66ce316d20b2f203f0a2070f83'])

Please take care not to execute and/or share the result of arbitrary commands though as some might expose your private keys. (the above two only show addresses and public keys)

SomberNight commented 3 years ago

Wait, actually I might have reproduced something, hold on.

Nemesidis commented 3 years ago

Some of the keys actually have funds showing now on core, but it's 2/10 transaction figuratively speaking that showed up on the wallet where keys was imported from. The rest just not showing. and 1 address returns watch only. It seems like all the Keys db is really messed up.

Nemesidis commented 3 years ago

Sign button now works, but after transaction is signed it doesn't have any id still and cannot be sent/broadcasted.

Nemesidis commented 3 years ago

Hope this is reversible issue. It would really hurt a lot to lose all that coin...

SomberNight commented 3 years ago

The issues I had thought might be related are https://github.com/spesmilo/electrum/issues/6400 and https://github.com/spesmilo/electrum/issues/6401 but after looking into them I am not so sure anymore. Yours might be another issue -- in which case the output from above (https://github.com/spesmilo/electrum/issues/6399#issuecomment-659710854) would still be useful.

Nemesidis commented 3 years ago

From what i can tell, there is more than a 100 receive addresses and only 7 keys. Most of the public addresses is unique with rare exceptions. All available private keys i tried to import back to Bitcoin core. 1 Shows as Watch only received, even tho they key got imported i cannot get private key for it? Wrong key generated? 2 addresses worked and received some coin on Core. The rest has gone to nowhere. There is total 13 addresses that should have transaction, but electrum only have 7 keys at most.

Possibly can try to figure issue why Broadcast does not work and Transaction id is not generated after signed? If i could get proper transaction to submit at least i could get error or might be successsful transaction. This is same for ones that gone through and dissapeared addresses. I cannot sent nothing from electrum at all, as i cannot get transaction ID after signing, therefor i cannot broadcast that TX id. I was also able to dig out old wallet from Shadow disc with same name, twice less in size than current wallet, But i cannot open it, seems like password is corrupted, because none of my passwords fit. And of course it's encrypted so to decrypt it need either password or key for AEC 256 encryption... So i doubt it can be opened. I tried both 3.3.8 versions and 4.0.2 to opne it. Cannot log in past password.

Nemesidis commented 3 years ago

There is one strange thing, in Shadow disk, when i recover deleted data i see 2 default wallets. Default and Default with same name, one is deleted that was created much later and the older one have date when i originally created wallet. The interesting thing, i did not delete any wallets from there on that date, so how did electrum create and delete new wallet file by itself? Problem however still same, password does not work for both of them. File condition for deleted is excellenet, no overwriten clusters. So it should not be corrupt.

Could this issue be related to encryption of Core wallet somehow? Not wallet password but Encryption password for Core wallet? I doubt it but you never know.

Nemesidis commented 3 years ago

Basically i could post that data to here, but i don't know how it would help. as i am already pretty sure, that Electrum generated addresses that has no connection with keys given and never saved the keys for this transactions. I prefer send that data to 1 person than post it publically for no reason. If this issue cannot be rectified there is no point to compromise private data. And i don't know how can it be rectified, if there is private keys missing for so many addresses. As they was derived from something else that is unknown. They all was generated from Electrum receive interface. Problem is as i cannot restore exact environment to it's previous places, older version with old wallet. As for who knows what reason new wallet is not backwards compatible and cannot be used on older version to check. I already consider my money lost after trying to get them back for 3 days.

Nemesidis commented 3 years ago

The issue solved, problem was in wrong Wallet.dat file. More like not wrong, but it was old, i had like 5 different versions of same wallet backed up. When i tried to load old ones, transactions just didn't load along with keys i suppose. However the strange thing is, Shouldn't electrum pick up that addresses anyway from Private keys? As visible addresses amount didn't change. There is either hiden master or private keys, that change over time without encrypting wallet or something else in Core. Because i cannot import more addresses than i did before, but i could see all transactions on latest wallet.dat file. It's really strange. Either way i couldn't send this funds out from Electrum, Sign and Broadcast was dead buttons all the time. Command payto was also not sending anything out, even with VPN. Also the crashes on trying to export private keys all together from GUI and single picked addresses remains. Also trying to get private keys from console issue is also still there. Was happy to be able to pull out my funds.

SomberNight commented 3 years ago

Did you import any keys AFTER upgrading to Electrum 4.0.2?

ecdsa commented 3 years ago

closing, nothing interesting here. user confusing keys and addresses.