0

I'm new to bitcoin (core) wallet. I recently begin to use it to store some BTC. I'm using the latest version 0.21.0.

I have some basic questions on the keys/addresses it generated. I use command getnewaddress 3 times, the last item has "hdkeypath": "m/0'/0'/2", and I dumped its private key, and put some BTC in this address.

  1. What's the relationship between the first pkey/addr (the one with hdkeypath: m/0'/0'/0 and the third one m/0'/0'/2? Does the first key/addr is the master (key) who can recover all later keys generated in the wallet.

  2. I only backup the private key of m/0'/0'/2, and removed the whole wallet (the .dat file). Is there a risk of this method? Since I only choose to use this key/addr to receive and store BTC.

  3. I later create a new wallet and restore this m/0'/0'/2 key with command importprivkey. and send some BTC to other people, and found it generate a CHANGE addr, so I also backup this new addr's private key too. Since I mainly use this m/0'/0'/2 to store long term BTC, and will not use it to make a lot transactions. So I keep the privatekey of m/0'/0'/2, and keep backups priv keys of change addresses it generated, then drop all wallet files. Is this method enough to restore all my balances in a futher day.

  4. Can the private key of m/0'/0'/2 be used to recover the change addresses' private keys? (What is the master seed of HD wallet, it is the private key of m/0'/0'/0?)

Thanks in advance

2
  1. What's the relationship between the first pkey/addr (the one with hdkeypath: m/0'/0'/0 and the third one m/0'/0'/2?

They are derived from the same parent key. Other than that, there is no relation.

Does the first key/addr is the master (key) who can recover all later keys generated in the wallet.

No. They are both child keys of the key at m/0'/0'. The actual master private key (the key at m) is not exportable. There is a HD seed (which is used to generate the master private key at m), but this is only exportable through the dumpwallet RPC.

  1. I only backup the private key of m/0'/0'/2, and removed the whole wallet (the .dat file). Is there a risk of this method? Since I only choose to use this key/addr to receive and store BTC.

Don't do that, you will lose money. When you send Bitcoin, Bitcoin Core will generate new change addresses and send any change there. Those change addresses have different private keys. Without them, you will lose money.

Additionally, by reusing the same address, you are significantly hurting your privacy. By using the same address over and over, anyone you transact with will know how much money you have in your wallet and be able to see all of your incoming and outgoing transactions. This allows anyone to track your spending habits.

  1. I later create a new wallet and restore this m/0'/0'/2 key with command importprivkey. and send some BTC to other people, and found it generate a CHANGE addr, so I also backup this new addr's private key too. Since I mainly use this m/0'/0'/2 to store long term BTC, and will not use it to make a lot transactions. So I keep the privatekey of m/0'/0'/2, and keep backups priv keys of change addresses it generated, then drop all wallet files. Is this method enough to restore all my balances in a futher day.

Bitcoin Core constantly generates new change addresses. The one time you forget means that you will lose money. If you accidentally request a new address and use it, you will lose money.

In general, backing up individual private keys is not recommended. You should back up the entire wallet.dat file itself. There is no need to export each key individually and back it up in that way. That is a surefire way to lose money at some point in the future.

  1. Can the private key of m/0'/0'/2 be used to recover the change addresses' private keys? (What is the master seed of HD wallet, it is the private key of m/0'/0'/0?)

No. The change addresses are unrelated. You would need to have the HD seed mentioned previously in order to derive them.

5
  • Thanks for the explanations. I may still to only backup private keys. Since I want to make a Paper Wallet (with a new layer of encrypt with a password with AES). Since I won't sent BTC out, so I think I can take the risk of remembering of store the priv-keys of change addresses if I do send BTC out occasionally. – ntk135 Jan 24 at 6:49
  • @ntk135 Bitcoin Core is not the right choice if you want a paper wallet. That may change with future releases, but right now, you're really going to shoot yourself in the foot. – Pieter Wuille Jan 24 at 6:49
  • @Andrew Chow: The answer to question 4 is technically yes (if you have the xpub of m/0'/0' as well), but I don't think this changes anything about the overall advice here: don't rely on any of the details of how the wallet works internally; back up the entire wallet.dat file. – Pieter Wuille Jan 24 at 6:51
  • @PieterWuille I don't understand. As long as I have the correct private keys (and no matter what wallet these private keys are generated from), I can restore the BTC in any wallet implementations, no? – ntk135 Jan 24 at 6:51
  • 1
    @ntk135 It's technically possible, but the chance of making a mistake that will lead to losing money is so high (even for experienced users) that it's not recommended. – ieatpizza Jan 24 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.