JoinMarket-Org / joinmarket-clientserver

Bitcoin CoinJoin implementation with incentive structure to convince people to take part
GNU General Public License v3.0
725 stars 178 forks source link

Wallet recovery from seed! #1389

Closed HonmaSokyu closed 1 year ago

HonmaSokyu commented 1 year ago

Hello guys need some help. I was running JM and yieldgenerator on my raspberry with raspiblitz like a year ago. Then my memmory card broke and i lost my wallet.jmdat. I still have my 12 word seed and password.

Now trying to recover from mnemonic. All goes well and "recovered wallet ok". When i go check the balance its zero, nothing is there. I tried increasing the Gap limit to 1000 and 5000 and 10000 and after each i rescanned the blockcahin and still zero balance.

Then i tried the "No-history wallet synchronization" and using large gaps but still zero balance.

What am i doing wrong and how can i get my bitcoins back or are they lost forever? 😢

I am wiling to give some reward if the problem is fixed...

Thanks for helping!

kristapsk commented 1 year ago

What wallet-tool.py wallet.jmdat history -v 4 shows? Are there some transactions? Also you should be able to recover using Electrum (by default will show only mixdepth 0, for others you need to manually specify derivation path).

HonmaSokyu commented 1 year ago

I tried that. There are no transactions and 0 balance, I know i had coins in all mixdepths YG was working normaly. I will try with electrum, thanks.

kristapsk commented 1 year ago

You could also try checking some of the mixdepth 0 addresses with block explorer (assuming you initialy deposited at first address(es) of mixdepth 0), do they show any transaction history (but please use locally hosted one or via Tor (Blockstream.info is one option), to not compromise privacy).

HonmaSokyu commented 1 year ago

I used this in JM and imported to electrum and still 0 balance. (jmvenv)$python wallet-tool.py -H "m/49'/0'/4'/0/0" wallet.jmdat dumpprivkey

I must be doing something wrong...You mean when i first deposited to 3 diff addresses. I can try to find those.

kristapsk commented 1 year ago

If you can find old funding transactions, would suggest first to check are deposit addresses the same you have after wallet recovery.

HonmaSokyu commented 1 year ago

Cant find it. Will keep looking. I just cant understand how can the wallet be empty. I have the seed and pass, so should have the coins also?

kristapsk commented 1 year ago

I have the seed and pass, so should have the coins also?

Yes, if your recovery seed is correct one you should be able tto recover wallet and bitcoins.

HonmaSokyu commented 1 year ago

The seed must work because i can recover wallet but its empty and no transactions. I was running YG so should be a lot...

Will try to find those first transactions.

BTCBellyButton commented 1 year ago

Just a guess... Did you set a mnemonic extension (different from what JM calls a passphrase) when you generated the wallet? If you did, without that, it's like you are recovering a completely different and separate wallet...

When recovering it will ask for it: Input mnemonic extension, leave blank if there isnt one:

HonmaSokyu commented 1 year ago

I did not set a mnemonic extension, im sure. I give up cant find those first transactions they were 2 years back...its just wierd this seed is the only one i have saved and also the dates match when i started YG... meh quess bitcoins are gone i messed something up.

Admin can close this issue.

AdamISZ commented 1 year ago

I did not set a mnemonic extension, im sure. I give up cant find those first transactions they were 2 years back...its just wierd this seed is the only one i have saved and also the dates match when i started YG... meh quess bitcoins are gone i messed something up.

Admin can close this issue.

Since you mentioned a timeline of 2 years ago (though it'd be possible later, also):

Try setting native = false in joinmarket.cfg and then probably best to use the bitcoin-rpc-no-history setting for blockchain_source. This would regenerate a wallet with 3-addresses. (p2sh wrapped segwit).

(We switched JM to native segwit by default almost exactly 2 years ago - 27 Nov 2020).

(I suggest no-history, I think you mentioned it above somewhere, because it's faster than having to do a rescanblockchain).

HonmaSokyu commented 1 year ago

Thanks @AdamISZ. Just tried that and it WORKED ;D I can see my balance now. Can i send btc out ( sweep the wallet ) or i have to change settings back? Dont wanna mess it up.

Send me your btc add. - will send you some sats ;)

AdamISZ commented 1 year ago

Send me your btc add. - will send you some sats ;)

The sentiment is very much appreciated, but no need.

To other contributors - this is why we need descriptors :)

AdamISZ commented 1 year ago

Can i send btc out ( sweep the wallet ) or i have to change settings back?

Yes, you can sweep the coins out from Joinmarket using sendpayment.py with -N 0 and using amount '0' to sweep all coins from each mixdepth, Also you can load the wallet in Electrum (I think it was mentioned above) using the m/49'/0'/account' path (the account is the same as the 'mixdepth'). I can't remember but I think to spend from Joinmarket you might need to switch back from 'no-blockchain' to normal bitcoin-rpc.

kristapsk commented 1 year ago

To other contributors - this is why we need descriptors :)

Agree we need to move towards that direction, but not quite sure how it would have helped with this situation. @HonmaSokyu had only seed phrase and nothing more. Probably when generating wallet, JM could output not only 12 words but also wallet type and creation date and ask user to backup up that too.

AdamISZ commented 1 year ago

Oh, good point. I had it somehow in my mind that descriptors were designed to address that problem, but indeed they are of no use if people stick purely with 12/24 word seedphrases, unless there is some standard already that embeds that metadata. I know Electrum has a custom non-BIP39 (and indeed iirc lnd has aezeed but that's maybe offtopic) seedphrase system, does that address this problem?

kristapsk commented 1 year ago

Main advantage of descriptors is that you have xpub/xprv, derivation path and script type in a single string / QR code.

HonmaSokyu commented 1 year ago

Hmm when i switched back to bitcoin-rpc and did "--recoversync -g 1000 wallet.dat" the balance came back 0. ? with bitcoin-rpc-no-history its showing all the coins but cannot send them out. tried importing to electrum but also 0 balance...

AdamISZ commented 1 year ago

OK, first thing is to sanity check that you can see the funds on a block explorer (check one or two addresses, good to do over Tor of course).

Then, why is recoversync showing no coins? Probably because you haven't done rescanblockchain to have your backend Bitcoin Core actually know about those addresses; without that, it's normal that it will show zero balance at all those addresses.

As for importing into Electrum, I guess you know which screen in the import to enter the derivation path (the m/49'/0'/0' for account 0), right? And the BIP39 setting? Note it's 49 not 84 for p2sh segwit, but i think you already knew that). You might need a big gap limit in Electrum and I'm not sure if that's allowable.

As a last resort (though there's no reason I can think of why rescanblockchain as instructed by the Joinmarket script wouldn't work) you can use the syntax to recover individual private keys as per the syntax you mentioned earlier in this thread.

HonmaSokyu commented 1 year ago

Thanks adam iam such a noob :D I rescanned the blockchain over night and coins are here. Thanks for all the help!!