I'm familiar with the basic RPC commands, but I'm having trouble retrieving/adding an address to a wallet, using purely RPC calls (i.e. bitcoind only, not bitcoin-qt).

My understanding is that addresses are associated with accounts, but I'm unsure what role "accounts" play, and how to create new ones etc.

In pseudocode, this is what I want to be able to do:

if (count(getAddressesByLabel("donations")) == 0) {
    address = wallet.createBitcoinAddress();

donationAddress = getAddressesByLabel("donations"))
  • Don't build your accounting system on accounts. Accounts are more of a legacy feature, their future is uncertain, they are vulnerable to hardware failures and as such using them directly for accounting third party funds is a really bad idea.
    – user11221
    Commented Jan 3, 2015 at 15:43
  • @GeorgeKimionis - do you have any documentation for those changes and views? Surely labels are backed up with the wallet? Commented Jan 3, 2015 at 18:57
  • Labels are backed up along with their corresponding addresses. Please take a look at: github.com/bitcoin/bitcoin/issues/3816.
    – user11221
    Commented Jan 3, 2015 at 19:34

1 Answer 1


You may have already read this, but make sure you read this if you want to know about how the accounts feature of the core client works: https://en.bitcoin.it/wiki/Accounts_explained. (It's somewhat of a legacy feature.)

Are you looking to be able to do this manually with the RPC methods, or automated?

For manually, do:

bitcoin-cli getaddressesbyaccount "donations"

If the JSON array returned is empty, then no address is associated. To create a new bitcoin address with that label, do:

bitcoin-cli getnewaddress "donations"

To get an address for the "donations" account, do:

bitcoin-cli getaccountaddress "donations"
  • 2
    bitcoin-cli getaccountaddress "..." has been deprecated. It would be nice if this answer were updated Commented Jan 6, 2020 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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