2

I understand the reasons for wanting to use new change address for each transaction, but am unsure as to how they are treated by the Bitcoin core client.

  1. Is the address deleted as soon as the funds it received as change are spent?
  2. The client probably doesn't watch for any further sends to these addresses, right?
1
  • Is the address deleted Since it's possible to back up the wallet's keypool, it doesn't seem like the client could know for sure that it never gave that address out as a receiving address.
    – Nick ODell
    Commented Jan 14, 2015 at 16:33

3 Answers 3

3
  1. Is the address deleted as soon as the funds it received as change are spent?

No, the change address is not deleted but it is stored as another of your key pairs of your wallet. Bassically when you make a transaction with 1 BTC spending only 0.7 the remaining 0.3 BTC is send to new address that is stored inside the client (current account) waiting for new transaction from operating "main" address to occur.

Try yourself list your addresses (after you spend input on one of your change addreses) with command: listaddressgroupings

  1. The client probably doesn't watch for any further sends to these addresses, right?

No, the client updates the balance on all keys inside the client. The change address can receive and sends BTC. The remaining funds will be updated as part of the main bitcoin address.

For more information see: Change on Bitcoin wiki

4
  • If funds are sent to a change address, with the client show it in the GUI even though it doesn't show change addresses in the GUI by default?
    – morsecoder
    Commented Jan 14, 2015 at 17:22
  • @StephenM347: I would assume that it only hides change transactions, which are identified by both the sending and receiving key being its own.
    – Murch
    Commented Jan 14, 2015 at 17:25
  • 1
    @StephenM347 Balance shown in the GUI is for all addresses (key pairs) in bitcoin client. If funds are send to change address the balance in GUI will be updated accordingly.
    – Marek
    Commented Jan 14, 2015 at 17:28
  • Then what's the point of making a distinction between change addresses and regular addresses? Seems like we should just be marking specific outputs as change outputs, rather than addresses.
    – morsecoder
    Commented Jan 20, 2015 at 21:06
1

Change addresses are no different than other addresses, except that they do not get shown in the UI, i.e. they are not visible in the recent transactions column. Just like all other addresses they will be checked for new balances whenever a new block is added to the database.

BitcoinCore keeps a number of unused addresses on hand of the size of keypool. The standard setting is 100 keys.

Whenever you create a transaction that doesn't spend a previous UTXO completely, the change gets sent to one of the previously unused addresses in the keypool, and a new address gets generated in the back of the keypool, to keep the number of unused addresses constant.

Likewise, when you request a "new receiving address" the first unused address from the keypool is popped, and a new one is generated and pushed in the back.

Even before the addresses are visible, the addresses are stored in the wallet.dat allowing you to create backups only every once in a while. (Well, you should at least every keypool transactions.)

Note: The keypool will only be refilled if the wallet is unlocked.

4
  • Are they checked for any further receiving of bitcoin on those addresses?
    – morsecoder
    Commented Jan 14, 2015 at 16:31
  • Sure, why not? After you use them to send, somebody could send money back to you there.
    – Murch
    Commented Jan 14, 2015 at 16:32
  • I'm currently looking for a source to confirm, but anything else would completely surprise me.
    – Murch
    Commented Jan 14, 2015 at 16:33
  • At least they seem to get listed after sending money from them as suggested by this answer to How to get all addresses - including the "change" addresses – from bitcoind?
    – Murch
    Commented Jan 14, 2015 at 16:44
0

I have written a program in Python3 that allows you to search for any address on bitcoin core whether it belongs to your wallet or not.

Here is the github link:

https://github.com/ORP967/Bitcoin_Core_RPC_par_address

Let me know what you think or if you have any improvements you might have.

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.