Bitcoin Forum
April 25, 2024, 12:31:16 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: question: change addresses, multiple transactions, wallet backups in bitcoin-QT  (Read 2902 times)
asdf123 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
January 14, 2014, 01:51:14 PM
 #1

Hi there. Total newbie questions, I've done lots of googling & youtube-ing about bitcoin, but am not clear about the following issues.  Would like to be clear before I start trying to actually move any funds.  Could someone advise please?  Sorry about length of my questions.


I've installed the bitcoin-qt client.  
Say I have 1.5 BTC in my confirmed balance, that all came from one single receipt of 1.5 BTC.  So this is all on one address in my wallet.
Say I want to send 1 BTC to some address.
I enter the details to make the payment, incl. say a 0.0005 transaction fee for the miners, and send.  My remaining balance would be  0.4995 BTC.

I understand that when I send bitcoins to some other address, in the above case the client will send out the 1.5 BTC from my previous transaction balance, sending 1 BTC to the address I am paying, plus the 0.0005 BTC transaction fee, and send the change of 0.4995 BTC back to me, to a 'change address' that is hidden in the client.  

For security, say I am normally storing my wallet.dat in an encrypted folder on external USB sticks, and don't keep it on the hard drive, having created addresses in this wallet previously.  So I let bitcoin-qt client start up, and sync with network to catch up with the blockchain.  The wallet.dat that bitcoin-qt sees at this point is an empty one, the one it creates by default.

Now to make a payment I disconnect from the net, quit bitcoin client, and copy my backed up wallet.dat onto hard drive, overwriting the empty wallet.dat.  Start bitcoin client, bitcoin-qt sees my real wallet and knows my balance, I enter all the payment details, re-connect to the net and hit send.  Disconnect from net.  This means my actual wallet is exposed to an online machine for the minimum time, for security.    

Q1 - is best practice that I should now make a backup of the wallet.dat I just used, rather than just delete it and rely upon my earlier backups?   I'm thinking that the (hidden) change address that bitcoin created to arrange for my 0.4995 to be sent back to me will be one that my earlier backed up wallets will not know about, so would I lose the change if I don't make fresh backups every time I send BTC in this way?

Q2 - if I want to simultaneously send the 1.0005 BTC out, and at the same time clear out all remaining funds in that address by doing another transaction that sends 0.4995 BTC to another address of mine, is that possible right away, or do I have to wait?

I'm thinking here that my first transaction has effectively used up all my 1.5 BTC, and until the change comes back (i.e. until the blocks are created that confirm the transaction), I don't have any more funds to send?  Is that correct?  So I have to wait 10 mins for the first block, and longer for confirmations to be safe, before I can then send the 0.4995 anywhere?

Q3 - I am wondering why the default behaviour of bitcoin-qt client is that change is sent back to a hidden address?  I'm sure there must be some reason which I haven't understood.  Isn't hiding the change address going to result in a lot of ppl not realising it's in a hidden address, and what if they lose access to it through not realising they need to know the private keys of not only the addresses they have openly created, but the private keys of these hidden change addresses that the client has secretly created as well?

Thanks for your help in understanding the above.
1714005076
Hero Member
*
Offline Offline

Posts: 1714005076

View Profile Personal Message (Offline)

Ignore
1714005076
Reply with quote  #2

1714005076
Report to moderator
1714005076
Hero Member
*
Offline Offline

Posts: 1714005076

View Profile Personal Message (Offline)

Ignore
1714005076
Reply with quote  #2

1714005076
Report to moderator
Remember that Bitcoin is still beta software. Don't put all of your money into BTC!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
BlockChainLottery
Sr. Member
****
Offline Offline

Activity: 332
Merit: 250


AwesomeDice.net


View Profile WWW
January 14, 2014, 02:13:34 PM
 #2

A1 - I know the wallet.dat file contains a pool of addresses, so if you don't use a lot of addresses it wouldn't be necessary to backup. But I would do it anyway if I were you, because it could happen. Also your new wallet.dat file contains previous transactions, that way you know what your balance is.
A2 - You can do that right away, because you own the change address.
A3 - For the ones not tech savvy, they shouldn't be bothered dealing with different addresses I think. Maybe it isn't perfect yet, still waiting for some killer app.

torusJKL
Hero Member
*****
Offline Offline

Activity: 619
Merit: 500


View Profile
January 14, 2014, 02:52:15 PM
 #3

Q3 makes a very good point.
I did loose some bitcoins in the very beginning because of this.

If you find my post useful send some Bitcoin: 167XM1Za8aG9CdbYuHFMpL2kvPsw6uC8da
Bitrated || bitcoin-otc || Moon Bitcoin Faucet
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
January 14, 2014, 08:14:33 PM
 #4

For security, say I am normally storing my wallet.dat in an encrypted folder on external USB sticks, and don't keep it on the hard drive, having created addresses in this wallet previously.  So I let bitcoin-qt client start up, and sync with network to catch up with the blockchain.  The wallet.dat that bitcoin-qt sees at this point is an empty one, the one it creates by default.

Now to make a payment I disconnect from the net, quit bitcoin client, and copy my backed up wallet.dat onto hard drive, overwriting the empty wallet.dat.  Start bitcoin client, bitcoin-qt sees my real wallet and knows my balance, I enter all the payment details, re-connect to the net and hit send.  Disconnect from net.  This means my actual wallet is exposed to an online machine for the minimum time, for security.

If you're really going to go through all that effort, you should seriously consider getting a cheap second computer to keep offline at all times and just running Armory.

Q1 - is best practice that I should now make a backup of the wallet.dat I just used, rather than just delete it and rely upon my earlier backups?   I'm thinking that the (hidden) change address that bitcoin created to arrange for my 0.4995 to be sent back to me will be one that my earlier backed up wallets will not know about, so would I lose the change if I don't make fresh backups every time I send BTC in this way?

By default, Bitcoin-Qt pre-generates 100 private keys / addresses when it creates a new wallet.dat.  Anytime it needs a new address (for change, or because you clicked the "New Address" button), it takes it from this queue of addresses that are already stored in the wallet.dat and then adds a new address on to the end of the file.

As such, the backup that you have already has the "change" address in it as long as you created the backup less than 100 addresses/transactions ago.

Q2 - if I want to simultaneously send the 1.0005 BTC out, and at the same time clear out all remaining funds in that address by doing another transaction that sends 0.4995 BTC to another address of mine, is that possible right away, or do I have to wait?

It is possible to do right away.  In the "send" tab, you can choose to "Add Recipient" to send to more than one person/address with a single transaction.

I'm thinking here that my first transaction has effectively used up all my 1.5 BTC, and until the change comes back (i.e. until the blocks are created that confirm the transaction), I don't have any more funds to send?  Is that correct?

No.  Bitcoin-Qt is aware of the transactions that it creates.  It trusts itself not to double spend a transaction that it is sending to itself, so it allows you to use the outputs of that transaction that are sent back to yourself immediately in another transaction (although that next transaction will likely require a transaction fee since the inputs won't have built up enough priority yet).

So I have to wait 10 mins for the first block, and longer for confirmations to be safe, before I can then send the 0.4995 anywhere?

Generally, most users won't run into such a problem.  However, if you are swapping wallet.dat files in and out, and you are sending a transaction with one wallet.dat to an address that is only in some other wallet.dat, then yes you'll have to wait for confirmations before Bitcoin-Qt will let you use the bitcoins.

Q3 - I am wondering why the default behaviour of bitcoin-qt client is that change is sent back to a hidden address?  I'm sure there must be some reason which I haven't understood.  Isn't hiding the change address going to result in a lot of ppl not realising it's in a hidden address, and what if they lose access to it through not realising they need to know the private keys of not only the addresses they have openly created, but the private keys of these hidden change addresses that the client has secretly created as well?

It seems that Bitcoin-Qt was created with the assumption that people would install it and use it.  (Not play around with deleting some of its data files, moving pieces to other drives, and importing and exporting keys)

For the average user that expects to be able to send and receive money like they do with a bank account, it would only add confusion to show these "change" addresses.  This is a protocol layer technical detail, and the wallet is designed to add a layer of abstraction so the user only needs to think about where they want to send the money, and how much they want to send (without needing to know all the intricate technical details about how such a transaction is handled at the protocol level).

Those who intend to use the software in advanced technical ways, are expected to know what they are doing.

As an alanogy: If I want to drive my car, I put the key in, turn it, move the lever to the "D" position and push the pedal near the floor.  I don't need to understand gear ratios, compression ratios, fueal air mixtures, torque, valve timing, etc.  If I decide that I want to play around with modfying valve timing, or replacing the fuel with an alternative fuel, then I'm expected to either understand fully what I am doing, or suffer the consequences.
asdf123 (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
January 15, 2014, 10:19:40 AM
 #5


It seems that Bitcoin-Qt was created with the assumption that people would install it and use it.  (Not play around with deleting some of its data files, moving pieces to other drives, and importing and exporting keys)

For the average user that expects to be able to send and receive money like they do with a bank account, it would only add confusion to show these "change" addresses.  This is a protocol layer technical detail, and the wallet is designed to add a layer of abstraction so the user only needs to think about where they want to send the money, and how much they want to send (without needing to know all the intricate technical details about how such a transaction is handled at the protocol level).

Those who intend to use the software in advanced technical ways, are expected to know what they are doing.

As an alanogy: If I want to drive my car, I put the key in, turn it, move the lever to the "D" position and push the pedal near the floor.  I don't need to understand gear ratios, compression ratios, fueal air mixtures, torque, valve timing, etc.  If I decide that I want to play around with modfying valve timing, or replacing the fuel with an alternative fuel, then I'm expected to either understand fully what I am doing, or suffer the consequences.


Thanks for the helpful answers, but I don't agree your above analogy.
The bitcoin-qt client expects users to make backups of the wallet.dat file, it offers a 'backup wallet' option in the menu.  So I would say it expects that this particular data file will be stored on other drives for future restoration.

There's nothing 'advanced' about restoring a backed up wallet file.

But there is no warning in the software that, as you've explained, any backup will only be good as long as it doesn't get older than 100 addresses/transactions behind the live wallet, after which any change the user receives will be going into addresses that the backup knows nothing about and can never access.

That means lost coins, possibly amounting to a huge sum of money, and there's no warning of that in the software. If bitcoin wants mass adoption and wants to be taken seriously for handling large sums, the official wallet client has to either show all the addresses coins are being stored in, so the user knows exactly where their money is, or it should warn (and warn in very big letters) that backups older than 100 transactions will lose some of your coins.
BlockChainLottery
Sr. Member
****
Offline Offline

Activity: 332
Merit: 250


AwesomeDice.net


View Profile WWW
January 15, 2014, 10:41:50 AM
 #6

That's inherent of using any backup. Between a current copy and a backup, things have changed. So between those, information always is lost. But maybe it can't hurt to tell people that that should be done before someone used up 100 addresses. But Bitcoin-QT isn't perfect, and because you run it yourself it's your responsibility. With online wallets you don't have this problem, except you have to trust the company behind it.

dscotese
Sr. Member
****
Offline Offline

Activity: 444
Merit: 250


I prefer evolution to revolution.


View Profile WWW
May 30, 2014, 08:11:11 PM
 #7

Sorry to dredge up this old thread, but it is the top google hit for wallet backup change address because it addresses the important issue of wallet security for non-technical people who are smart enough to keep backups.

I just wanted to call out DannyHamilton for this excellent explanation:
Quote
Anytime it needs a new address (for change, or because you clicked the "New Address" button), it takes it from this queue of addresses that are already stored in the wallet.dat and then adds a new address on to the end of the file.

It would be a simple matter to record the timestamp each time the "backup wallet" function was used.  This would allow the client to indicate "X bitcoin addresses left before a new backup is required."

If I don't see a reply that someone has proposed this to the development team (or implemented it and pushed the change to github), I may get around to it myself someday.  If I do, well, include a bitcoin address so I can thank you!

I like to provide some work at no charge to prove my valueAvoid supporting terrorism!
Satoshi Nakamoto: "He ought to find it more profitable to play by the rules."
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
May 31, 2014, 02:45:29 AM
 #8

Sorry to dredge up this old thread, but it is the top google hit for wallet backup change address because it addresses the important issue of wallet security for non-technical people who are smart enough to keep backups.

I just wanted to call out DannyHamilton for this excellent explanation:
Quote
Anytime it needs a new address (for change, or because you clicked the "New Address" button), it takes it from this queue of addresses that are already stored in the wallet.dat and then adds a new address on to the end of the file.

It would be a simple matter to record the timestamp each time the "backup wallet" function was used.  This would allow the client to indicate "X bitcoin addresses left before a new backup is required."

If I don't see a reply that someone has proposed this to the development team (or implemented it and pushed the change to github), I may get around to it myself someday.  If I do, well, include a bitcoin address so I can thank you!

I'm not certain, but I think I read that the latest version 0.9.x takes an address from the pool, but doesn't generate the replacement address right away.  Replacement addresses are only generated in situations where the user is already being asked to enter their password.

If the pool becomes empty, then the user is prompted to enter their password so the wallet can rebuild the entire pool.

Of course, many people choose to create copies of the wallet.dat file directly, and even automate that process.  This wouldn't trigger the recording of the timestamp, so it might be nice to have some way to override (or turn off) the indicator if you add it.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!