4

I have some bitcoins in an old bitcoin-core wallet and would like to transfer all of them to a new BIP32 wallet. I tried doing sendtoaddress with subtractfeefromamount=true, but bitcoin transferred all but 0.0005BTC to the new address (I suspect some rounding issue when calculating the fee and amount to send). So now I have an address with 0.0005BTC (plus some other addresses with a larger amount). How can I reliably transfer all funds so that all the addresses in the old wallet have zero balance?

Furthermore, is there a way to verify that all addresses for which I have the private key have a zero balance?

3 Answers 3

2

You can create a transaction having an output value equal to the entire balance of your bitcoin core wallet. The last parameter of sendtoaddress is a boolean signifying whether to include transaction fees or not, which you can set as true. The sendtoaddress API has a mechanism of generating a new address for the change remaining from the value you have given.

Another way would be to manually create the transaction with all the inputs from the addresses which have balance and sending it to the new wallet address. Remember to keep some difference in the input and output of the values which would be treated as transaction fees.

As for the last question, if your question is pertaining to the addresses in your old bitcoin core wallet, then you can use the listaddressgroupings API to get a detailed balance of each of the address your wallet has created. If the addresses don't belong to a core wallet, then you can simply search for the balance on https://blockchain.info/address/<your_address>

2
  • If I manually create a transaction, is the whole difference between input and output treated as the transaction fees (automatically, by virtue of there being a difference)? Nov 23, 2016 at 19:05
  • 1
    Yes it is. If there is no difference, it would be treated like a no fee transaction, and since it involves a lot of inputs in your case, the transaction size would be larger(because it depends on the amount of bytes as a standard, you can search for it) and would not be mined. However 0.0001 BTC is an average which would get your transaction mined (as per my experience) Nov 23, 2016 at 19:41
2

Another way to transfer all funds from one wallet to another is to just import the private key into the wallet. With your new wallet there will be an option to "import private key". You can scan the qr code or cut and paste your private key and everything in that wallet will be transferred into the new one. Make sure you choose the option to import into new address.

1
  • 1
    It makes little sense to import private keys into a BIP32 wallet. And the wallet I use (copay) doesn't seem to offer that option. Nov 23, 2016 at 19:04
1

Most wallets have a "Sweep" function that allows you to import private keys, transfer the balance to the new wallet, and then delete the private keys.

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