Author

Topic: Imported private key for Vanity address, now in two different wallet.dat files? (Read 155 times)

jr. member
Activity: 34
Merit: 4
So I shut down Bitcoin Core. I backed up this new Wallet.dat file, then I copied over my existing wallet.dat file to the Bitcoin folder. Computer says " Do you want to replace the existing wallet.dat" and I say yes.
Did you do all of these within a minute?
Because Bitcoin Core will take a few seconds to shutdown before it fully shuts down.
During that time, it may have "redone" what you've done in the copied-over wallet.dat to the "everyday wallet" because "releasing wallet.dat" is in the last part of the shutdown process.

I can only guess since what happened was bizarre if there's no human error involved.

I always make sure of that, at least I think I do. And the fact that only the Vanity address is shared is weird.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
So I shut down Bitcoin Core. I backed up this new Wallet.dat file, then I copied over my existing wallet.dat file to the Bitcoin folder. Computer says " Do you want to replace the existing wallet.dat" and I say yes.
Did you do all of these within a minute?
Because Bitcoin Core will take a few seconds to shutdown before it fully shuts down.
During that time, it may have "redone" what you've done in the copied-over wallet.dat to the "everyday wallet" because "releasing wallet.dat" is in the last part of the shutdown process.

I can only guess since what happened was bizarre if there's no human error involved.
jr. member
Activity: 34
Merit: 4
I copied some public addresses from my everyday wallet, and checked in the new wallet if it owned those same addresses, it came back false.

But when i do the same for the vanity address, both wallets come back true. I must have screwed up somewhere, I just can't for life of me work out where. It's not like I will ever use the vanity address for anything valuable, so it doesn't really matter, the mystery is just weirding me out.
jr. member
Activity: 34
Merit: 4
Quote
How exactly did you do this? Did you shutdown Bitcoin Core, move (not copy) the original wallet.dat file, and then start Bitcoin Core?

Before opening Bitcoin Core, I backed up my everyday wallet. I then deleted the copy of wallet.dat in the Bitcoin folder.
I then opened Bitcoin Core, it behaved as expected, it had a brand new looking wallet, with no bitcoin and no transaction history.
I then used importprivkey ############### "MyVanityNickname" in console. It took like 30 min to rescan.
I could not see any address in the address book, which I thought was weird, but as it had no bitcoin and no transactions, I thought maybe it might just not show up
So I shut down Bitcoin Core. I backed up this new Wallet.dat file, then I copied over my existing wallet.dat file to the Bitcoin folder. Computer says " Do you want to replace the existing wallet.dat" and I say yes.
I fire up Bitcoin Core. It is my old existing wallet as expected, with my bitcoin, and my transactions. To test that the import happened correctly, i send a tiny amount of bitcoin to the Vanity public address.
Transaction history now shows I sent a transaction to myself, and "MyVanityNickname" is in my address book. This I found very weird.
I shut down, backed up again, moved the new wallet.dat back into bitcoin folder (ie the empty one I imported priv key into), fire it up.
New wallet.dat shows the tiny balance I just sent it, but nothing else.
I power it down, swap wallet.dat files again, fire up my old wallet. It shows the tiny amount being sent to myself. To test I then select input coin control, to see if I can send tiny amount to my mobile wallet. ( ie see if my old wallet does actually have the private key to that address)
Bitcoin are sent to my mobile successfully.

Quote
It would appear that you've either imported that private key before (have you previously used vanitygen?)... or you hadn't actually opened Bitcoin Core with a "new" wallet.dat and you actually imported the private key into your "original" wallet.dat

Nope neither of those things I don't think. Definitely had not imported it before. The new wallet was generated because their was no wallet.dat in the bitcoin folder. Which is why I was wondering if when bitcoin core generates a new wallet.dat file, if it is deterministically linked each time.


HCP
legendary
Activity: 2086
Merit: 4361
I opened bitcoin core with no wallet.dat, so it generated a new, empty one, with no bitcoin or transactions.
How exactly did you do this? Did you shutdown Bitcoin Core, move (not copy) the original wallet.dat file, and then start Bitcoin Core?


Quote
Does bitcoin core store the private keys somewhere other than wallet.dat, or when a new wallet.dat is created on the same computer, is it deterministically linked to previous wallet.dat's created on that computer?
No... they're not saved anywhere... and No, a newly created wallet.dat should contain a completely different and random seed (and different addresses etc).


Quote
In short, how did my existing wallet.dat get the private key I imported when running a different, brand new, never before used wallet.dat?
It would appear that you've either imported that private key before (have you previously used vanitygen?)... or you hadn't actually opened Bitcoin Core with a "new" wallet.dat and you actually imported the private key into your "original" wallet.dat
jr. member
Activity: 34
Merit: 4
I generated a vanity address using reputable open source software on my home PC, taking precautions like not being connected to the internet etc. Everything went well, so instead of risking my actual wallet.dat file, I opened bitcoin core with no wallet.dat, so it generated a new, empty one, with no bitcoin or transactions. I used the importprivkey command to import the private key of my vanity wallet, everything went well.

Then i closed bitcoin core, backed that new walled.dat file up, and fired bitcoin core back up with my everyday wallet.dat that has my bitcoin. I sent a small amount to my vanity address as a test, but bitcoin core showed I sent the bitcoin to myself, and when i had a look, I had the vanity address in this wallet.dat, as well as the empty wallet. I am unsure why this happened? Shouldn't importing a private key only be linked to the wallet.dat file it was imported into? How does one wallet.dat know what happened it a separate wallet.dat.

Does bitcoin core store the private keys somewhere other than wallet.dat, or when a new wallet.dat is created on the same computer, is it deterministically linked to previous wallet.dat's created on that computer?

In short, how did my existing wallet.dat get the private key I imported when running a different, brand new, never before used wallet.dat?
Jump to: