Bitcoin Forum
November 08, 2024, 02:26:26 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Race Conditions Between Transactions and Wallet Backup  (Read 3421 times)
RobShaver (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
February 21, 2011, 08:18:44 PM
 #1

I'm new to Bitcoin ... this is the first day I've read about it after hearing Steve Gibson's Feb 10 web cast about it. (You can find it here: http://www.grc.com/securitynow.htm)

Is sounds really clever and useful. I'm rooting for it's success.

I've read the Bitcoin web sites and searched this forum but haven't found this issue addressed.

From what I've read I understand that I am responsible for safeguarding my Bitcoin wallet. That seems good and reasonable. So my questions are:

1. In the FAQ it says, "You need to make a backup of the wallet after every transaction, as the old backup file will be partially or fully invalid." After I've made a Bitcoin transaction, at what point do I know that my wallet is up to date and completely valid? How long does a transaction take and how do I know it's done?

2. If I make a large transaction and my hard drive crashes at some point during it, is there the potential for me to loose the value in that transaction? In other words, is there a possibility of a race condition between initiation of a transaction and a crash that requires me to use my backup wallet?

3. It seems likely, from what I've read that, if my disk becomes unrecoverable after a transaction has completed but before I've completed a backup of the Bitcoin wallet, that the value of that transaction is lost forever. Or is this only true when I become the new owner of a Bitcoin but not true when I transfer ownership to another?

4. Is there any commit/rollback protocol in Bitcoin to permit the whole transaction to include a Bitcoin wallet backup to be completed before committing the transaction?

Unless I'm missing something and it already has it, until the Bitcoin system integrates some kind of commit/rollback system to permit automated backup of the Bitcoin wallet, it is not a complete and robust system. Disk-mirroring would be a partial solution.

Peace,

Rob:-]
N12
Donator
Legendary
*
Offline Offline

Activity: 1610
Merit: 1010



View Profile
February 21, 2011, 08:29:54 PM
 #2

1. Your wallet contains your private keys to all the addresses you generate. Every address contains a certain amount of BTC. If you lose the private key to addresses (old wallet), you will lose the BTC associated with them. There is a standard keypool out of 100, meaning that there are 100 addresses generated already, you just don’t see them in the UI. To be 100% sure, just make encrypted backups and update them everytime you do a transaction.

2. When you make a transaction, it is immediately sent to other nodes and it is validated every block generation, so I don’t see a possibility for this. Either the transaction is sent or it is not.

3. Bitcoins have no serial address or anything like this, they aren’t units. They are just stored in addresses in the system.

4. You mean automatic backups by the client? Not at this point.

Have a look at blockexplorer to understand the system a bit further. Each block contains the history of all transactions since the last block.
ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1060


View Profile
February 21, 2011, 08:35:18 PM
 #3

Rob, if you backup by using the "backupwallet" API call, the backup is safely interleaved with any transactions that may occur.

If you backup the wallet.dat file by copying it somewhere, you should stop the bitcoin client before you copy the wallet, then restart the client afterwards.
riX
Sr. Member
****
Offline Offline

Activity: 326
Merit: 254



View Profile
February 21, 2011, 08:48:06 PM
 #4

What many fail to realize is that there is only need for a wallet backup if you send bitcoins, not when you receive them.

When you send some bitcoins, one or more new bitcoin adresses are created and added to your wallet, to which some additional bitcoins might get sent!
As Blitzboom wrote, the wallet contains a list of 100 new addresses, so in theory you could make up to 100 transaction before this would matter.

This is a feature that is specific to the official client, not to the bitcoin protocol. You could patch the client not to send anything except what you tell it. That would however reduce the anonymity and make it easier to track the flow of bitcoins through the network.

Sorry, I can't help you with your lost password.

PGP key: 0x9F31802C79642F25
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5376
Merit: 13407


View Profile
February 21, 2011, 09:06:34 PM
 #5

See https://en.bitcoin.it/wiki/Securing_your_wallet

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
theGECK
Sr. Member
****
Offline Offline

Activity: 411
Merit: 250



View Profile
February 21, 2011, 09:57:36 PM
 #6

What many fail to realize is that there is only need for a wallet backup if you send bitcoins, not when you receive them.

When you send some bitcoins, one or more new bitcoin adresses are created and added to your wallet, to which some additional bitcoins might get sent!
As Blitzboom wrote, the wallet contains a list of 100 new addresses, so in theory you could make up to 100 transaction before this would matter.

This is a feature that is specific to the official client, not to the bitcoin protocol. You could patch the client not to send anything except what you tell it. That would however reduce the anonymity and make it easier to track the flow of bitcoins through the network.

I've been trying to figure out where all these new addresses are coming from. Would it be possible to prevent the client from doing that, or to send from a specific address? This way an address could become associated as "mine" and be trusted, much like people receiving to a specific address continually.

Use my referral codes for Bitcoin faucets and I'll send you 30% of my referral bonus - Win/Win! PM for details on all sites available or use one of the links here.

FreeBitco.in | FreeDoge.co.in
RobShaver (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
February 21, 2011, 10:19:17 PM
 #7

After reading https://en.bitcoin.it/wiki/Securing_your_wallet, as theymos suggested, it seems that:
1. You start out with a pool of 100 Bitcoin addresses.
2. Each time you do a transaction that uses an address, a new one is generated to replenish the pool.
3. Each transaction may cause several addresses to be used.
4. As long as you backup the wallet before all keys that have been used, your backup is complete and you won't loose anything.

It says on the page from the above link, "So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost."

This indicates to me that there is no race condition.

Thanks for your quick answers.

Peace,

Rob:-]
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5376
Merit: 13407


View Profile
February 21, 2011, 10:22:11 PM
 #8

3. Each transaction may cause several addresses to be used.

Only sends use an address, and each send can only use 0 or 1 address.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Hal
VIP
Sr. Member
*
expert
Offline Offline

Activity: 314
Merit: 4176



View Profile
February 21, 2011, 10:26:44 PM
 #9

1. In the FAQ it says, "You need to make a backup of the wallet after every transaction, as the old backup file will be partially or fully invalid."
Sounds like that FAQ entry is obsolete and should be updated.

Hal Finney
RobShaver (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
February 21, 2011, 10:27:05 PM
 #10

What many fail to realize is that there is only need for a wallet backup if you send bitcoins, not when you receive them.

When you send some bitcoins, one or more new bitcoin adresses are created and added to your wallet, to which some additional bitcoins might get sent!
As Blitzboom wrote, the wallet contains a list of 100 new addresses, so in theory you could make up to 100 transaction before this would matter.

This is a feature that is specific to the official client, not to the bitcoin protocol. You could patch the client not to send anything except what you tell it. That would however reduce the anonymity and make it easier to track the flow of bitcoins through the network.

I've been trying to figure out where all these new addresses are coming from. Would it be possible to prevent the client from doing that, or to send from a specific address? This way an address could become associated as "mine" and be trusted, much like people receiving to a specific address continually.

This has been answered elsewhere but, if I'm understanding this stuff, your Bitcoin client creates the addresses itself. Each address has a public and a private key associated with them. The fact that you and only you have the private key makes them, by definition, yours. (Possession is 100% of the Bitcoin law:)

You can use a single address over and over if you want but that makes your transactions easier to track. If you're after anonymity then this reduces it.
ribuck
Donator
Hero Member
*
Offline Offline

Activity: 826
Merit: 1060


View Profile
February 22, 2011, 11:24:58 AM
 #11

Quote
Only sends use an address, and each send can only use 0 or 1 address.
And, of course, clicking "New..." in the client uses 1 address.
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!