10

Let's say I copy my wallet to another computer and start using it there. What happens? Can both computers send and receive payments to the same address(es) in the wallet?

A different scenario with the same results: someone steals my computer and starts using my wallet. I have a backup and start using that. Can we do it?

3 Answers 3

10

A wallet is a combination of private keys, and transactions that spend from/to it. Since somewhere in the 0.3 series, bitcoin will detect transactions from a key of yours that you did not create yourself, and count them as spends.

This means that if you duplicate your wallet on several machines, they will all be able to do spends, and observe spends by others. Probably as much as you would hope for, but there are a few caveats:

  • The wallet contains 100 pre-generated keys to simplify backups, so the first 100 new keys used by both clients will remain the same, but afterwards they will diverge, i.e. start using different keys. You do not want this to happen, which means you will need to synchronize the wallet files at least once every 100 transactions (i.e., copy from one place to the other).
  • If one of the clients is not yet aware about a spend done by the other (for example, it was offline at the time of the transaction submit, and hasn't caught up with the block chain yet), it may produce a transaction that uses the same input, in other words: a double spend. The software is not able to deal with this, as it will consider its own transactions unquestionably valid. This will probably result in an unusable wallet.

In short: there are some provisions for detecting spends by copy of a wallet, but it's certainly not an encouraged or supported use case.

1
  • 3
    Basically, my advice would be that you simply should not do this until the software has better support for it. You need at least a fully-deterministic generation of new accounts and some way to cleanly recover from transactions that are in the local wallet but invalid on the client's accepted blockchain. Apr 26, 2012 at 12:45
5

To answer the part about the stolen wallet, the thief would immediately transfer the balance of your stolen wallet into his own wallet, and repeat the process regularly. So whenever you added more Bitcoins to your wallet, they would vanish as the thief stole them. So you would be able to share the stolen wallet with the thief, but it would be a very unbalanced kind of sharing, where you did all the depositing and he did all the withdrawing.

You would be better off making a new wallet, transferring the Bitcoins out to the new wallet before the thief empties it, and never using any of the addresses from the old wallet as receiving addresses again. This would involve giving new addresses to anyone or any site that stores an address of yours and is likely to ever send coins to it.

3

This should work just fine, for the most part, though it's not recommended. What would not be fine is multiple PCs accessing the same wallet.dat from, say, dropbox at the same time. The BerkeleyDB format Bitcoin uses for its wallet is not intended to be a multi-user database and as such this can cause problems if both systems attempt an action at the same time.

It should also be noted that if you copy your wallet to a new system and make a transaction it can become out-of-sync with the old copy of the wallet, since Bitcoin generates new addresses to receive the "change" from each transaction by default.

In short, two systems using the same wallet can be done but it's not recommended because of the unexpected results it can produce. If you're simply talking about a backup/restore of the wallet.dat then that's much less troublesome.

2
  • 1
    @chris-moore says: "The wallet contains 100 pre-generated keys to simplify backups [...]. [...] you will need to synchronize the wallet files at least once every 100 transactions [...]." - This seems to imply that one address is "used" per transaction, which I don't understand since I may only use one address (or a few addresses) all the time. David Perry seems to clarify this a bit with ''[...] Bitcoin generates new addresses to receive the "change" from each transaction by default.'', but I don't understand this either. Could someone clarify?
    – mazi
    Apr 27, 2012 at 9:22
  • Bitcoin internally does not transfer amounts from address to address: transactions explicitly refer to old "coins" they consume, and create ones of arbitrary sizes. So, if you have a 10 BTC coin and want to pay me 7 BTC, the software will consume the 10 BTC coin, create two new coins from it (a 7 BTC one addressed to me, and a 3 BTC one addressed to yourself). To improve anonimity, the change goes back to a different address of yourself. Apr 27, 2012 at 12:06

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.