How to move an address to a new wallet?

9

3

I have a wallet with several addresses. I would like to isolate one of the addresses in its own wallet, but I don't know how to do it. I've been trying with pywallet.py, but I've been unable to do it.

Can you help me, please?

EDIT: I've made some progress:

  • I dumped my wallet with pywallet.py --dumpwallet >wallet.json, and searched for the key I wanted to isolate, and wrote down the field named sec.
  • Then moved wallet.dat to another folder, and started bitcoin-qt, so it generated a new wallet.
  • Opened Help -> Debug window -> console and run importprivkey XXXXXXXX mykeylabel. It took about 4 minutes to import the key.

Now I still need to:

  • remove this address from the old wallet.
  • remove the default address in the new wallet, so it contains just the imported address.

Francisco R

Posted 2013-05-01T18:44:50.417

Reputation: 283

Which client are you using?o0'. 2013-05-01T18:51:31.350

Bitcoin-qt but I'm thinking about trying ArmoryFrancisco R 2013-05-01T18:59:32.460

What is the reason that you want to do this? In most cases, the easiest and safest thing to do is just send bitcoins from one wallet to another.Eyal 2013-05-02T07:34:34.277

1While this is true, he might need to preserve that key if he publicized widely that address.o0'. 2013-05-02T10:25:53.760

2Right. I don't want to loose that address. I also don't want to mix balances with other addresses. Bitcoin-qt creates hidden change addresses with almost every transaction, so after a while, I can't be sure of the exact balance of an address (account?). I prefer to isolate this address and all its future related change addreses in its own wallet.Francisco R 2013-05-02T13:58:38.170

Answers

4

You can do that via the default bitcoind API.

I suppose you are used to use Bitcoin-Qt? Then most probably the bitcoind daemon is also installed on your computer.

You can move an address from one wallet to another using the setaccount command. It works as follows.

setaccount <bitcoinaddress> <account>

So, when you have an address, let's say 1HDPmDGcgXkRTBbACYXNQ1SNeoCQEPvN3v, that you want to move from wallet1 to wallet2, then you can do the following command.

setaccount 1HDPmDGcgXkRTBbACYXNQ1SNeoCQEPvN3v wallet2

You can perform these commands most easily from a command line interface. In Unix systems where bitcoind is installed, you can do the following:

  • Make sure Bitcoin-Qt is closed.
  • Launch bitcoind as a daemon:

bitcoind -daemon

  • Do the command I mentioned above: (It's possible that you get an error that the Bitcoin server is not yet running, just wait a little.)

bitcoind setaccount 1HDPmDGcgXkRTBbACYXNQ1SNeoCQEPvN3v wallet2

Steven Roose

Posted 2013-05-01T18:44:50.417

Reputation: 10 855

Hi, thanks for pointing out bitcoind, I find it very interesting. I tried setaccount but it doesn't generate a new wallet (wallet.dat file I can move to another computer), just a new "account" which is of no real use to me. In fact, the account which holds address I want to move to a new wallet, show a balance of several bitcoins when it should be zero, and another unnamed ("") account shows a negative balance, so it seems you can't use "accounts" to know neat balance of an address.Francisco R 2013-05-06T02:26:37.940

@FranciscoR https://en.bitcoin.it/wiki/Accounts_explained#Accounts_and_Receiving_Addresses will explain the "" unnamed account and negative balance.

Chris 2013-06-28T01:46:57.973

2

An account in bitcoin is not a wallet. As explained here (https://en.bitcoin.it/wiki/Accounts_explained), account is a way to categories the different addresses into groups within a wallet. Having said that, the setaccount method is not to transfer an address from wallet to another.

Abishek R Srikaanth 2013-12-09T14:21:09.090

3

Open Bitcoin-Qt with old wallet (Menu: Help / Debug window / Console):

walletpassphrase "OLDWALLETPASSPHRASE" 600
dumpprivkey "BITCOINADDRESS"
walletlock

...write down private key and close program. Next open Bitcoin-Qt with new wallet and import private key:

walletpassphrase "NEWWALLETPASSPHRASE" 600
importprivkey "BITCOINPRIVKEYFROMOLDWALLET" "SOMELABEL"
walletlock

...wait for rescan and lock wallet. That is all without other programs etc.

John Saturday

Posted 2013-05-01T18:44:50.417

Reputation: 41

2

The Bitcoin-Qt client currently does not provide any method to delete addresses. You can create a new wallet and import a subset of the private keys from the old wallet to create a wallet that doesn't have certain private keys/addresses.

Stephen Gornick

Posted 2013-05-01T18:44:50.417

Reputation: 26 118

1Do you know how can I create a new empty wallet, with 0 addresses in it? I tried renaming wallet.dat, and Bitcoin-qt creates a new wallet, but there is always an address in it.Francisco R 2013-05-06T02:29:32.003

0

The Bitcoin-Qt client currently does not provide any method to delete addresses. You can create a new wallet and import a subset of the private keys from the old wallet to create a wallet that doesn't have certain private keys/addresses.

Video World

Posted 2013-05-01T18:44:50.417

Reputation: 1