Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: frrrossst on December 14, 2017, 05:23:00 AM



Title: How can I change my private key for my BTC?
Post by: frrrossst on December 14, 2017, 05:23:00 AM
I am using Bitcoin Core and am not 100% if someone has my private key. I want to change my private key, however I am not sure how to go about doing so. Can I crate a new receiving address, and move the BTC I have to that new address, which would then give me a new private key all with using the same Bitcore client?


Title: Re: How can I change my private key for my BTC?
Post by: HCP on December 14, 2017, 06:37:24 AM
A slightly complicated way to go about this, but should guarantee no-one has your private keys (unless your entire computer is compromised)

- Shutdown Bitcoin Core
- Backup your wallet.dat... rename it wallet.old
- Restart Bitcoin Core to create a "new" wallet.dat with new addresses/private keys
- Generate a receive address
- Shutdown Bitcoin Core
- Swap the wallets again (wallet.dat -> wallet.new, wallet.old -> wallet.dat)
- Restart Bitcoin Core
- Send your BTC to new address
- Shutdown Bitcoin Core
- Swap wallets one last time (wallet.dat -> wallet.old, wallet.new -> wallet.dat)
- Continue using Bitcoin Core with your new wallet

This way, you're guaranteed not to accidentally use your OLD key again (but you have access should you ever need it)... and no-one should have access to your new keys.


Title: Re: How can I change my private key for my BTC?
Post by: frrrossst on December 14, 2017, 06:41:37 AM
Is there anyway I can mess this up and end up losing my coin over paranoia? Is this noob proof lol? I'm sorry I'm just so stressed out over all this bitcoin. I don't have that much, but losing money over stupidity is just really, really awful lol.


Title: Re: How can I change my private key for my BTC?
Post by: HCP on December 14, 2017, 06:45:18 AM
As long as you take backups of the wallet.dat's (put them on external storage like USB drives for extra safety)... you should be able to recover from any "mistakes".

What makes you think that someone else has your private key anyway? ??? Did you type it into a website or something?


Title: Re: How can I change my private key for my BTC?
Post by: frrrossst on December 14, 2017, 06:52:10 AM
I might have a year ago, but nothing ever happened and I dont know for sure.

So let me get this straight. Backup my current wallet.dat (1) with my BTC there. Remove it from the AppData folder, let Bitcoin Core generate a new wallet.dat (2). Get the public address generated with this new wallet.dat (2), back up it up and close bitcoin core. Put wallet.dat (1) with my BTC back into the AppData folder, completely sync the blockchain, send the BTC to the new public address that was created and associated with wallet.dat (2). Now put wallet.dat (2) into the AppData folder, and the coin should appear under this new address? Would I have to redownload the blockchain for it to show up? Also, how long would it take to confirm and how much would the fee be?

If I somehow messed this up, but I had the original wallet.dat (1), I could undo this?


Title: Re: How can I change my private key for my BTC?
Post by: mocacinno on December 14, 2017, 06:54:45 AM
I might have a year ago, but nothing ever happened and I dont know for sure.

So let me get this straight. Backup my current wallet.dat (1) with my BTC there. Remove it from the AppData folder, let Bitcoin Core generate a new wallet.dat (2). Get the public address generated with this new wallet.dat (2), back up it up and close bitcoin core. Put wallet.dat (1) with my BTC back into the AppData folder, completely sync the blockchain, send the BTC to the new public address that was created and associated with wallet.dat (2). Now put wallet.dat (2) into the AppData folder, and the coin should appear under this new address? Would I have to redownload the blockchain for it to show up? Also, how long would it take to confirm and how much would the fee be?

If I somehow messed this up, but I had the original wallet.dat (1), I could undo this?

Seems about right...
Now, to answer your questions:
You'd need to rescan the complete blockchain, but not redownload it. Rescanning can take a couple of hours, but everything depends on your cpu, memory and IO speed of your disk.
The best fee depends on the number of unspent outputs that are managed by your wallet (1). I wrote a tool long ago to help you with this task: https://www.mocacinno.com/page/feeestimate
If you have the number of inputs/outputs OR a list of funded addresses managed by your wallet, this tool will help you estimate a reasonable fee. However, if you keep your wallet open for a couple of hours before creating a tx, bitcoin core should have a reasonable fee estimation automatically.

As for your last question: there are ways to mess this up in a way you cannot fix it by having access to wallet.dat (1). However, as long as you keep 2 secure backups of both wallet.dat's, and you double check the deposit address generated by wallet.dat (2), i don't see a way to really mess things up.


Title: Re: How can I change my private key for my BTC?
Post by: frrrossst on December 14, 2017, 06:58:20 AM
I might have a year ago, but nothing ever happened and I dont know for sure.

So let me get this straight. Backup my current wallet.dat (1) with my BTC there. Remove it from the AppData folder, let Bitcoin Core generate a new wallet.dat (2). Get the public address generated with this new wallet.dat (2), back up it up and close bitcoin core. Put wallet.dat (1) with my BTC back into the AppData folder, completely sync the blockchain, send the BTC to the new public address that was created and associated with wallet.dat (2). Now put wallet.dat (2) into the AppData folder, and the coin should appear under this new address? Would I have to redownload the blockchain for it to show up? Also, how long would it take to confirm and how much would the fee be?

If I somehow messed this up, but I had the original wallet.dat (1), I could undo this?

Seems about right...
Now, to answer your questions:
You'd need to rescan the complete blockchain, but not redownload it. Rescanning can take a couple of hours, but everything depends on your cpu, memory and IO speed of your disk.
The best fee depends on the number of unspent inputs that are managed by your wallet (1).

As for your last question: there are ways to mess this up in a way you cannot fix it by having access to wallet.dat (1). However, as long as you keep 2 secure backups of both wallet.dat's, and you double check the deposit address generated by wallet.dat (2), i don't see a way to really mess things up.


How long would it take for roughly 1BTC to transfer over to the new address? Also, i'm not sure what "unspent inputs that are managed by your wallet" means? In terms of $$, how much would moving 1BTC cost?


Title: Re: How can I change my private key for my BTC?
Post by: mocacinno on December 14, 2017, 06:59:49 AM
How long would it take for roughly 1BTC to transfer over to the new address? Also, i'm not sure what "unspent inputs that are managed by your wallet" means? In terms of $$, how much would moving 1BTC cost?

I was still editing my previous post (re-editing posts is something i like to do when i don't like my initial answer), i think your question has been answered by my edit.
In short: you'll be creating a transaction with x inputs and 1 output... To find the number of inputs, open your wallet ,go to help => debug window => console and type "listunspent" (without quotes offcourse). Now you can count the number of unspent outputs.
If you don't like the fee estimation bitcoin core is giving you, you can put the number of inputs you found by using the command "listunspent" and 1 output in my wizard: https://www.mocacinno.com/page/feeestimate (option 2)


Title: Re: How can I change my private key for my BTC?
Post by: bitcoinblog on December 14, 2017, 07:04:07 AM
Is there anyway I can mess this up and end up losing my coin over paranoia? Is this noob proof lol? I'm sorry I'm just so stressed out over all this bitcoin. I don't have that much, but losing money over stupidity is just really, really awful lol.

I don't know how much reliable is Blockchain.info for you. But I did that with it.

After November 30 when BCC , BTG all came into existence. There was all coin in my paperwallet which was old since February 2017. So first i take of my BTC through privatekey and send them to another wallet. Later i use secretkey on blockchain and got my BCC there.

At the time of inserting secretkey in Blockchain , that address become Imported Address for it. I developed new secretkey for same Address from there.

Check this image u can understand what to do.

https://i.imgur.com/2rfMf2a.png

Later u can import that address in you other wallet and generate another privatekey.


Title: Re: How can I change my private key for my BTC?
Post by: frrrossst on December 14, 2017, 07:05:59 AM
How long would it take for roughly 1BTC to transfer over to the new address? Also, i'm not sure what "unspent inputs that are managed by your wallet" means? In terms of $$, how much would moving 1BTC cost?

I was still editing my previous post (re-editing posts is something i like to do when i don't like my initial answer), i think your question has been answered by my edit.
In short: you'll be creating a transaction with x inputs and 1 output... To find the number of inputs, open your wallet ,go to help => debug window => console and type "listunspent" (without quotes offcourse). Now you can count the number of unspent outputs.
If you don't like the fee estimation bitcoin core is giving you, you can put the number of inputs you found by using the command "listunspent" and 1 output in my wizard: https://www.mocacinno.com/page/feeestimate (option 2)

So it could cost me a thousand dollars to move 1 BTC?


Title: Re: How can I change my private key for my BTC?
Post by: mocacinno on December 14, 2017, 07:07:44 AM
How long would it take for roughly 1BTC to transfer over to the new address? Also, i'm not sure what "unspent inputs that are managed by your wallet" means? In terms of $$, how much would moving 1BTC cost?

I was still editing my previous post (re-editing posts is something i like to do when i don't like my initial answer), i think your question has been answered by my edit.
In short: you'll be creating a transaction with x inputs and 1 output... To find the number of inputs, open your wallet ,go to help => debug window => console and type "listunspent" (without quotes offcourse). Now you can count the number of unspent outputs.
If you don't like the fee estimation bitcoin core is giving you, you can put the number of inputs you found by using the command "listunspent" and 1 output in my wizard: https://www.mocacinno.com/page/feeestimate (option 2)

So it could cost me a thousand dollars to move 1 BTC?

Theoretically, yes... If you were collecting 1000's of dust inputs, the fee can be really high when talking in fiat terms... However, if this is the case, let me know and i'll give you some tips on how to pay a smaller fee.


Title: Re: How can I change my private key for my BTC?
Post by: frrrossst on December 14, 2017, 07:13:38 AM
How long would it take for roughly 1BTC to transfer over to the new address? Also, i'm not sure what "unspent inputs that are managed by your wallet" means? In terms of $$, how much would moving 1BTC cost?

I was still editing my previous post (re-editing posts is something i like to do when i don't like my initial answer), i think your question has been answered by my edit.
In short: you'll be creating a transaction with x inputs and 1 output... To find the number of inputs, open your wallet ,go to help => debug window => console and type "listunspent" (without quotes offcourse). Now you can count the number of unspent outputs.
If you don't like the fee estimation bitcoin core is giving you, you can put the number of inputs you found by using the command "listunspent" and 1 output in my wizard: https://www.mocacinno.com/page/feeestimate (option 2)

So it could cost me a thousand dollars to move 1 BTC?

Theoretically, yes... If you were collecting 1000's of dust inputs, the fee can be really high when talking in fiat terms... However, if this is the case, let me know and i'll give you some tips on how to pay a smaller fee.

Is there anyway I can see the inputs without the client? I don't have access to it right this second (not at home ATM), but I am genuinely curious. I think I've had like 6 total transactions ever with this one address, does that make a difference? 


Title: Re: How can I change my private key for my BTC?
Post by: mocacinno on December 14, 2017, 07:18:01 AM
How long would it take for roughly 1BTC to transfer over to the new address? Also, i'm not sure what "unspent inputs that are managed by your wallet" means? In terms of $$, how much would moving 1BTC cost?

I was still editing my previous post (re-editing posts is something i like to do when i don't like my initial answer), i think your question has been answered by my edit.
In short: you'll be creating a transaction with x inputs and 1 output... To find the number of inputs, open your wallet ,go to help => debug window => console and type "listunspent" (without quotes offcourse). Now you can count the number of unspent outputs.
If you don't like the fee estimation bitcoin core is giving you, you can put the number of inputs you found by using the command "listunspent" and 1 output in my wizard: https://www.mocacinno.com/page/feeestimate (option 2)

So it could cost me a thousand dollars to move 1 BTC?

Theoretically, yes... If you were collecting 1000's of dust inputs, the fee can be really high when talking in fiat terms... However, if this is the case, let me know and i'll give you some tips on how to pay a smaller fee.

Is there anyway I can see the inputs without the client? I don't have access to it right this second (not at home ATM), but I am genuinely curious. I think I've had like 6 total transactions ever with this one address, does that make a difference?  

no, it doesn't make a difference... An unspent output is an unspent output, disregarding which address it's funding.
As for your other question: if you have an idear which addresses are managed by your wallet, you can look those addresses up on a block explorer, even if you don't have physical access to your wallet.

For example: if you look up your address on blockchain.info, you should see a link called "Unspent Outputs". If you click it, you can count the number of unspent outputs funding this one address. If you do this for most (or all) of the funded addresses of your wallet, you know the number of unspent outputs (approximately... It's allways possible you're forgetting some addresses... And it's possible your wallet generated change addresses you don't know about to)


Title: Re: How can I change my private key for my BTC?
Post by: frrrossst on December 14, 2017, 07:23:05 AM
How long would it take for roughly 1BTC to transfer over to the new address? Also, i'm not sure what "unspent inputs that are managed by your wallet" means? In terms of $$, how much would moving 1BTC cost?

I was still editing my previous post (re-editing posts is something i like to do when i don't like my initial answer), i think your question has been answered by my edit.
In short: you'll be creating a transaction with x inputs and 1 output... To find the number of inputs, open your wallet ,go to help => debug window => console and type "listunspent" (without quotes offcourse). Now you can count the number of unspent outputs.
If you don't like the fee estimation bitcoin core is giving you, you can put the number of inputs you found by using the command "listunspent" and 1 output in my wizard: https://www.mocacinno.com/page/feeestimate (option 2)

So it could cost me a thousand dollars to move 1 BTC?

Theoretically, yes... If you were collecting 1000's of dust inputs, the fee can be really high when talking in fiat terms... However, if this is the case, let me know and i'll give you some tips on how to pay a smaller fee.

Is there anyway I can see the inputs without the client? I don't have access to it right this second (not at home ATM), but I am genuinely curious. I think I've had like 6 total transactions ever with this one address, does that make a difference?  

no, it doesn't make a difference... An unspent output is an unspent output, disregarding which address it's funding.
As for your other question: if you have an idear which addresses are managed by your wallet, you can look those addresses up on a block explorer, even if you don't have physical access to your wallet.

For example: if you look up your address on blockchain.info, you should see a link called "Unspent Outputs". If you click it, you can count the number of unspent outputs funding this one address. If you do this for most (or all) of the funded addresses of your wallet, you know the number of unspent outputs (approximately... It's allways possible you're forgetting some addresses... And it's possible your wallet generated change addresses you don't know about to)

I believe it is 6?


Title: Re: How can I change my private key for my BTC?
Post by: mocacinno on December 14, 2017, 07:29:02 AM
--snip, quote was getting to big--

I believe it is 6?

In that case, at this time, i'd recommand a fee of ~0.003, with this fee you'll have a very reasonable chance of getting your transaction confirmed within 2-3 hours.
If ~0.003 is to much (personally, i think it's a lot of money), you can always try a little lower fee, however you'll have to expect to wait a longer time.
A second option is to wait a couple of days and keep monitoring https://bitcoinfees.earn.com/ for a recommanded fee drop... There's a reasonable chance the recommanded fee might drop for shorter or longer periods over the next couple of weeks (not a guarantee tough).


Title: Re: How can I change my private key for my BTC?
Post by: frrrossst on December 14, 2017, 07:30:33 AM
--snip, quote was getting to big--

I believe it is 6?

In that case, at this time, i'd recommand a fee of ~0.003, in this case you'll have a very reasonable chance of getting your transaction confirmed within 2-3 hours.
If ~0.003 is to much (personally, i think it's a lot of money), you can always try a little lower fee, however you'll have to expect to wait a longer time.

So that's roughly $50 USD to move 1BTC. I guess it's not terrible, but I supposed it's better than losing everything.


Title: Re: How can I change my private key for my BTC?
Post by: HCP on December 14, 2017, 07:31:16 AM
I believe it is 6?
Shouldn't be tooooo bad then... your transaction size will end up being something like 900-1000 bytes.... at around 400 sats/byte "recommended" fees... you're looking at fees of around 0.0035 to 0.004 BTC.

You can probably do it for less using a transaction accelerator ;)


Title: Re: How can I change my private key for my BTC?
Post by: Mountaingoat on December 14, 2017, 08:51:25 AM
You can't create a new private key without creating a new address.

They are linked and can't be separated.


Title: Re: How can I change my private key for my BTC?
Post by: frrrossst on December 16, 2017, 09:02:01 PM
I might have a year ago, but nothing ever happened and I dont know for sure.

So let me get this straight. Backup my current wallet.dat (1) with my BTC there. Remove it from the AppData folder, let Bitcoin Core generate a new wallet.dat (2). Get the public address generated with this new wallet.dat (2), back up it up and close bitcoin core. Put wallet.dat (1) with my BTC back into the AppData folder, completely sync the blockchain, send the BTC to the new public address that was created and associated with wallet.dat (2). Now put wallet.dat (2) into the AppData folder, and the coin should appear under this new address? Would I have to redownload the blockchain for it to show up? Also, how long would it take to confirm and how much would the fee be?

If I somehow messed this up, but I had the original wallet.dat (1), I could undo this?

Seems about right...
Now, to answer your questions:
You'd need to rescan the complete blockchain, but not redownload it. Rescanning can take a couple of hours, but everything depends on your cpu, memory and IO speed of your disk.
The best fee depends on the number of unspent outputs that are managed by your wallet (1). I wrote a tool long ago to help you with this task: https://www.mocacinno.com/page/feeestimate
If you have the number of inputs/outputs OR a list of funded addresses managed by your wallet, this tool will help you estimate a reasonable fee. However, if you keep your wallet open for a couple of hours before creating a tx, bitcoin core should have a reasonable fee estimation automatically.

As for your last question: there are ways to mess this up in a way you cannot fix it by having access to wallet.dat (1). However, as long as you keep 2 secure backups of both wallet.dat's, and you double check the deposit address generated by wallet.dat (2), i don't see a way to really mess things up.

Hey another quick question. Could I move my BTC to a new address (and get a new private key) within the same Bitcoin Core wallet? If I go to file, receiving address and select new, it provides me a new public key (and If i'm correct, also generates a new private key). Could I then move the BTC in my wallet to this new public address and then have it in a private key? Am I missing something here or is the only way to do it with the previously discussed way of generating a new wallet.dat file?

Also, can I name the wallet.dat file anything I want or does it always have to have the .dat extension to work? 


Title: Re: How can I change my private key for my BTC?
Post by: frrrossst on December 16, 2017, 09:24:10 PM
You can't create a new private key without creating a new address.

They are linked and can't be separated.

Can I create a new address within the same bitcoin core wallet? If I go to file, receiving address and select new, it provides me a new public key (and If i'm correct, also generates a new private key). Could I then move the BTC in my wallet to this new public address and then have it in a private key?

Also can you please help me understand how to do a rescan of the blockchain within Bitcoin Core client?


Title: Re: How can I change my private key for my BTC?
Post by: HCP on December 17, 2017, 04:12:09 AM
Yes, that new address has a new private key... however, if you have an HD wallet (does it have the HD symbol in the bottom right corner or is it crossed out?) there is a chance that having one compromised private key could compromise your entire wallet (as all the private keys are "related" in a very complicated mathematical way)

If it is non-HD wallet (HD symbol crossed out) all the private keys are randomly generated and not related. The only "risk" comes from accidentally using that compromised privkey/address again in the future.

In my opinion, the safer option is to move to a new wallet... but moving all the coins to a new private key/address is definitely better than doing nothing.

Also, can I name the wallet.dat file anything I want or does it always have to have the .dat extension to work?  
I believe that Bitcoin Core allows you to specify the wallet file at runtime using the -wallet option, so theoretically you can name it whatever you want... wallet.dat is just what it defaults to if no wallet file is specified.

You might want to be careful renaming it... I've seen posts by several users on here that have previously done this and then been unable to remember/locate the file at a later date :P


Also can you please help me understand how to do a rescan of the blockchain within Bitcoin Core client?
to do a rescan... simply start it using:

Code:
path\to\Bitcoin\installdir\bitcoin-qt.exe -rescan

On windows... likely to be something like: C:\Program Files\Bitcoin\bitcoin-qt.exe -rescan

or add rescan=1 to the bitcoin.conf file in your Bitcoin data directory (where your wallet.dat is)... if you don't have a bitcoin.conf, just make one using a text editor. Just remember that once you have done the rescan, you should remove rescan option from your bitcoin.conf or it will do it EVERY time you start the program! :P