4

I am attempting to allow multiple bitcoin addresses to be created per account, but how can I delete them using the standard API? There doesn't seem to be a function for that.

E.g. the acccount "Test" :

Array (
[0] => 1JQQXBRrG5h7uW8StVtJRcGEdb4YYTqnas
[1] => 1LP8VeKDNKAgErCnYVAFvGMnrGbM3oHe6u
[2] => 1LwTx3a7hy4FZ5EJMxcPnRG9ap8AUwd2cm
[3] => 1AtbnW8dPuzp6jVnAvipiJR4o1BupCcU8D
[4] => 1K7FyNgmJ4ryjKgNz9ybxzQcYrGDEbYEUX
[5] => 1Ng77Nq1SF46MDZnz4pEirCEbbiHZ1Wthp
[6] => 175FKAiJSC9wA12BPcYZD6drTYLxXXChdZ
)

What if the user just wants to delete 1JQQXBRrG5h7uW8StVtJRcGEdb4YYTqnas?

Cheers!

morsecoder
  • 14,008
  • 2
  • 42
  • 92
Patrick Geyer
  • 153
  • 1
  • 5
  • Are you using the [accounts](http://bitcoin.stackexchange.com/questions/tagged/accounts) feature of bitcoind? – Nick ODell Jan 11 '15 at 17:46
  • @NickODell I am :) – Patrick Geyer Jan 11 '15 at 17:47
  • Do you want to delete the account, delete the address, or dis-associate the address from that account? – morsecoder Jan 12 '15 at 03:38
  • @StephenM347 I'd like to delete an account! – Patrick Geyer Jan 25 '15 at 16:55
  • @PatrickGeyer, I was confused because in your question you ask "What if the user just wants to delete 1JQQXBRrG5h7uW8StVtJRcGEdb4YYTqnas?" I'm glad you've got it figured out, though. – morsecoder Jan 25 '15 at 17:02
  • @StephenM347 - I can now delete an address from an account.. But it still appears in the list of Bitcoin receiving addresses under the label (no label). Any advice on how to completely delete the address? – Patrick Geyer Jan 25 '15 at 17:10
  • And I'm assuming label and account are the same thing - http://bitcoin.stackexchange.com/questions/4136/importprivkeys-label-is-it-the-same-as-an-account?rq=1 – Patrick Geyer Jan 25 '15 at 17:11
  • @PatrickGeyer, Yes, label and account are the same thing. Like Nick said in his answer, though, you can't delete the address itself. – morsecoder Jan 25 '15 at 17:12
  • "You can also use PyWallet to delete addresses permanently" - I guess not quite, then. Thanks a lot Stephen :) – Patrick Geyer Jan 25 '15 at 17:14

2 Answers2

4

bitcoind does not allow you to delete addresses. (If it did, the next question people would ask is, "How do I undelete addresses?" :))

However, you can use the rpc call setaccount to change the account associated with the address. The first argument to setaccount should the the address you're changing; the second shound be the account you're moving it to. (If you want to move it to the default account, put "" as the second argument.)

Note that this does not change the balance of the account; balances are tracked internally. If you want to keep this consistent, run getreceivedbyaddress, then move that balance to the new account.

You can also use PyWallet to delete addresses permanently. Use the --multidelete option, and pass it a path to a file. That file should contain key as the first line, followed by each address you want to delete, each on a new line.

Nick ODell
  • 29,184
  • 11
  • 69
  • 129
0

Just to answer the explicit question "how to delete an account": you cannot. The label will stick to another – eventuallay unused – addresses. for further information, read this issue: https://github.com/bitcoin/bitcoin/issues/1231#issuecomment-6305302

vv01f
  • 188
  • 7