1

I need to restore a wallet created with bitcoin-qt which was encrypted. I have the encrypted wallet.dat file only. Do I restore this simply by replacing the current wallet.dat with my backup wallet.dat file?

2

Yes. However, you will lose any new private keys in the current wallet.dat. Even if you didn't create any new addresses, bitcoin-qt creates change addresses if you send any money. So, to be safe, you should dump the private keys for your current wallet.dat and the stop bitcoin-qt. Replace the current wallet.dat with the saved wallet.dat. Restart bitcoin-qt and then dump the private keys again. If you have the same set, all is well. Otherwise, you will need to import any missing private keys.

To dump the private keys using the bitcoin-qt debug console:

  1. listaddressgroupings
  2. walletpassphrase your-passphrase 300
  3. dumpprivkey bitcoin-address
  4. walletlock

Step 1 will list the bitcoin addresses in your wallet. Steps 2 and 4 are only needed if the wallet is encrypted and unlocks your wallet for a maximum of 300 seconds. Repeat Step 3 for each bitcoin address.

To import a private key using the bitcoin-qt debug console:

  1. walletpassphrase your-passphrase 300
  2. importprivkey private-key "key-label"
  3. walletlock

Steps 1 and 3 are only needed if the wallet is encrypted. Repeat Step 2 for each private key you are importing. The key-label is whatever you want to identify the key.

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.