Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Raimy on November 17, 2017, 12:36:56 AM



Title: Question on Private Keys and Wallet.dat
Post by: Raimy on November 17, 2017, 12:36:56 AM
I am using Bitcoin Core as a wallet that holds some BTC that I would like to split for the various forks. If I understand correctly, I can send the BTC first to a new wallet (address) and then once the funds are transferred it would be safe to import the now "old" private keys to the new forked client wallet.

My question is, if I can simply rename the old wallet.dat to something else and let the core client create new wallet.dat file, is the new file considered the same as having brand new keys or would I need to completely uninstall the Bitcoin Core client and start from scratch?

So my plan would be to rename my current wallet.dat to something like wallet.old, restart the client and let it generate a new wallet.dat with new private keys and addresses. I could then write down one of the new bitcoin addresses, and then do the same thing but in reverse; rename the new wallet.dat to wallet.new, rename wallet.old back to wallet.dat, fire up the core client and then transfer the btc in the old wallet to my new address in the new wallet.dat file.

Does this process seem correct? Any help or suggestion are much appreciated as I think I understand how the process works but sometimes that can be dangerous.


Title: Re: Question on Private Keys and Wallet.dat
Post by: TryNinja on November 17, 2017, 12:55:10 AM
Yes. This should work.


Title: Re: Question on Private Keys and Wallet.dat
Post by: Raimy on November 17, 2017, 01:13:23 AM
Yes. This should work.

Thanks for the feedback/assurance.

I guess after re-reading it I could have simply asked is creating a new wallet.dat the same as generating a new set of private keys.


Title: Re: Question on Private Keys and Wallet.dat
Post by: Spendulus on November 17, 2017, 01:26:59 AM
I am using Bitcoin Core as a wallet that holds some BTC that I would like to split for the various forks. If I understand correctly, I can send the BTC first to a new wallet (address) and then once the funds are transferred it would be safe to import the now "old" private keys to the new forked client wallet.

My question is, if I can simply rename the old wallet.dat to something else and let the core client create new wallet.dat file, is the new file considered the same as having brand new keys or would I need to completely uninstall the Bitcoin Core client and start from scratch?

So my plan would be to rename my current wallet.dat to something like wallet.old, restart the client and let it generate a new wallet.dat with new private keys and addresses. I could then write down one of the new bitcoin addresses, and then do the same thing but in reverse; rename the new wallet.dat to wallet.new, rename wallet.old back to wallet.dat, fire up the core client and then transfer the btc in the old wallet to my new address in the new wallet.dat file.

Does this process seem correct? Any help or suggestion are much appreciated as I think I understand how the process works but sometimes that can be dangerous.

i highlighted where you may have a misunderstanding.

first from your current wallet, move all funds somewhere else. temporarily, but move them. wait until the transactions have cleared.

then take your existing wallet.dat, enter console mode, dumprivatekeys.
locate the text file generated.

now you have a copy of the keys that you will be importing to a bitcoin cash wallet.

I imported that text file to an excel worksheet. the reason is, the format of the lines and the data. I wanted to strip out just the private keys, from a file where there was ...

"public key, field, field, private key."

there were a lot of private keys that were irrelevant, like the latest batch of "reserve" addresses.

although they are irrelevant, the entire list of private keys can be entered into the bitcoin cash wallet. it will just ignore the ones that have no value.

i used the electron-cash wallet, and moved first just one address, verified the funds came up, then did a couple, then a couple more, then the whole batch. caution: the whole batch took a couple minutes to process. this is a conservative approach, where if there is a problem, it will be found out on maybe just the first test, before the large batch is entered into the new wallet.

my first efforts were to use the bitcoin-abc full node, but that was way too much hassle. no reason at this time to run a full node for bitcoin-cash, and it was taking a long time to build the 130gb database/whatever it is. i wound up using the electron-cash spv wallet, which worked fine.






Title: Re: Question on Private Keys and Wallet.dat
Post by: Raimy on November 17, 2017, 01:47:43 AM
I am using Bitcoin Core as a wallet that holds some BTC that I would like to split for the various forks. If I understand correctly, I can send the BTC first to a new wallet (address) and then once the funds are transferred it would be safe to import the now "old" private keys to the new forked client wallet.

My question is, if I can simply rename the old wallet.dat to something else and let the core client create new wallet.dat file, is the new file considered the same as having brand new keys or would I need to completely uninstall the Bitcoin Core client and start from scratch?

So my plan would be to rename my current wallet.dat to something like wallet.old, restart the client and let it generate a new wallet.dat with new private keys and addresses. I could then write down one of the new bitcoin addresses, and then do the same thing but in reverse; rename the new wallet.dat to wallet.new, rename wallet.old back to wallet.dat, fire up the core client and then transfer the btc in the old wallet to my new address in the new wallet.dat file.

Does this process seem correct? Any help or suggestion are much appreciated as I think I understand how the process works but sometimes that can be dangerous.

i highlighted where you may have a misunderstanding.

first from your current wallet, move all funds somewhere else. temporarily, but move them. wait until the transactions have cleared.

then take your existing wallet.dat, enter console mode, dumprivatekeys.
locate the text file generated.

now you have a copy of the keys that you will be importing to a bitcoin cash wallet.

I imported that text file to an excel worksheet.

there were a lot of keys that were irrelevant, like the latest batch of "reserve" addresses.

although they are irrelevant, the entire list of private keys can be entered into the bitcoin cash wallet. it will just ignore the ones that have no value.

i used the electron-cash wallet, and moved first just one address, verified the funds came up, then did a couple, then a couple more, then the whole batch. caution: the whole batch took a couple minutes to process.

my first efforts were to use the bitcoin-abc full node, but that was way too much hassle. wound up using the electron-cash spv wallet.


Thanks for the tips, but I am still working on the first part of what you said, which is to transfer the bitcoin to a temporary safe address.

So my question would be if I generate a new encrypted dat file would those keys/addresses be considered a safe place to send my coins to from the old wallet?

My thought was to move the funds there first, let it completely confirm as you said, and then I could just import the old dat file into a new client such as Bitcoin ABC since it would no longer have bitcoin in it.


Title: Re: Question on Private Keys and Wallet.dat
Post by: HCP on November 17, 2017, 04:08:22 AM
No... you didn't understand incorrectly... Spendulus did ;)

So my plan would be to rename my current wallet.dat to something like wallet.old, restart the client and let it generate a new wallet.dat with new private keys and addresses. I could then write down one of the new bitcoin addresses, and then do the same thing but in reverse; rename the new wallet.dat to wallet.new, rename wallet.old back to wallet.dat, fire up the core client and then transfer the btc in the old wallet to my new address in the new wallet.dat file.
This process is EXACTLY "transferring the bitcoin to a temporary safe address"... although it doesn't need to be temporary... your "new" wallet.dat should be fine to continue using for the future.

By renaming your "old" wallet.dat to wallet.old and then starting Bitcoin Core, you will create a completely new BTC wallet.dat... So, your idea to take an address from the "NEW" wallet.dat, shutdown Core... then rename "new" wallet.dat to wallet.new... rename wallet.old back to wallet.dat... then start Core, and then send ALL your BTC from "old" wallet.dat to the address you just wrote down from "new" wallet.dat then your BTC will be "safe"... it is now on a completely new address, in a new wallet with all new seed/addresses/private keys.

You can then safely import copies of the "old" wallet.dat into BCH Core (and probably BTG Core) to get those coins as all the BTC will be gone... or you can dump the private keys from your "old" wallet.dat and import the old keys into compatible ilghtweight SPV wallets if you don't want to download 3 copies of the blockchain :P ::)


NOTE: If you're super paranoid (although BCH is fast becoming "worthless" again)... You could then repeat the exercise with BCH so that you create new BCH wallet.dat so when you import into BTG your BCH is "safe" #cryptoInception ;)



Title: Re: Question on Private Keys and Wallet.dat
Post by: Raimy on November 17, 2017, 05:17:04 AM
No... you didn't understand incorrectly... Spendulus did ;)

So my plan would be to rename my current wallet.dat to something like wallet.old, restart the client and let it generate a new wallet.dat with new private keys and addresses. I could then write down one of the new bitcoin addresses, and then do the same thing but in reverse; rename the new wallet.dat to wallet.new, rename wallet.old back to wallet.dat, fire up the core client and then transfer the btc in the old wallet to my new address in the new wallet.dat file.
This process is EXACTLY "transferring the bitcoin to a temporary safe address"... although it doesn't need to be temporary... your "new" wallet.dat should be fine to continue using for the future.

By renaming your "old" wallet.dat to wallet.old and then starting Bitcoin Core, you will create a completely new BTC wallet.dat... So, your idea to take an address from the "NEW" wallet.dat, shutdown Core... then rename "new" wallet.dat to wallet.new... rename wallet.old back to wallet.dat... then start Core, and then send ALL your BTC from "old" wallet.dat to the address you just wrote down from "new" wallet.dat then your BTC will be "safe"... it is now on a completely new address, in a new wallet with all new seed/addresses/private keys.

You can then safely import copies of the "old" wallet.dat into BCH Core (and probably BTG Core) to get those coins as all the BTC will be gone... or you can dump the private keys from your "old" wallet.dat and import the old keys into compatible ilghtweight SPV wallets if you don't want to download 3 copies of the blockchain :P ::)


NOTE: If you're super paranoid (although BCH is fast becoming "worthless" again)... You could then repeat the exercise with BCH so that you create new BCH wallet.dat so when you import into BTG your BCH is "safe" #cryptoInception ;)



Ok, thanks for this as I wanted to make sure my thought process was correct on what is happening, which it seems it is. :)

I know I probably missed the boat on BCH and I am in no hurry to sell anything, but just thought it would be a good idea to finally get around to separating all these coins from one another so I can be in a better position going forward should one of the prices spike up again. But before I do anything I want to protect my btc which is my main concern for now.

Thanks again for the input, it is what I am looking for.



Title: Re: Question on Private Keys and Wallet.dat
Post by: Spendulus on November 18, 2017, 12:59:34 PM
No... you didn't understand incorrectly... Spendulus did ;)

So my plan would be to rename my current wallet.dat to something like wallet.old, restart the client and let it generate a new wallet.dat with new private keys and addresses. I could then write down one of the new bitcoin addresses, and then do the same thing but in reverse; rename the new wallet.dat to wallet.new, rename wallet.old back to wallet.dat, fire up the core client and then transfer the btc in the old wallet to my new address in the new wallet.dat file.
This process is EXACTLY "transferring the bitcoin to a temporary safe address"... although it doesn't need to be temporary... your "new" wallet.dat should be fine to continue using for the future.

By renaming your "old" wallet.dat to wallet.old and then starting Bitcoin Core, you will create a completely new BTC wallet.dat... So, your idea to take an address from the "NEW" wallet.dat, shutdown Core... then rename "new" wallet.dat to wallet.new... rename wallet.old back to wallet.dat... then start Core, and then send ALL your BTC from "old" wallet.dat to the address you just wrote down from "new" wallet.dat then your BTC will be "safe"... it is now on a completely new address, in a new wallet with all new seed/addresses/private keys.

You can then safely import copies of the "old" wallet.dat into BCH Core (and probably BTG Core) to get those coins as all the BTC will be gone... or you can dump the private keys from your "old" wallet.dat and import the old keys into compatible ilghtweight SPV wallets if you don't want to download 3 copies of the blockchain :P ::)


NOTE: If you're super paranoid (although BCH is fast becoming "worthless" again)... You could then repeat the exercise with BCH so that you create new BCH wallet.dat so when you import into BTG your BCH is "safe" #cryptoInception ;)



Ok, thanks for this as I wanted to make sure my thought process was correct on what is happening, which it seems it is. :)

I know I probably missed the boat on BCH and I am in no hurry to sell anything, but just thought it would be a good idea to finally get around to separating all these coins from one another so I can be in a better position going forward should one of the prices spike up again. But before I do anything I want to protect my btc which is my main concern for now.

Thanks again for the input, it is what I am looking for.


The simplest way to do the first part of this is as follows. Assume you have Bitcoin core wallet.

Load a copy of electrum, do what it says when it is setting up. Like writing down on paper the seed and the phrases, not storing them in a computer.

First save a copy of the bitcoin core wallet.dat. Next....

Generate a Receive address. Then go to Core and execute a Send to that receive address. Wait if you like and verify it worked. Do this until the Core wallet reads 0.00 funds. Now you are done with emptying out the wallet.

Save a copy of the bitcoin wallet and the electrum wallet.

Next you are ready to take the core wallet.dat private keys and use them to retrieve your bitcoin cash.