Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Add warning against wallet.dat re-use #18219

Merged
merged 1 commit into from
Mar 11, 2020

Conversation

corollari
Copy link
Contributor

Following discussion in #18205, this PR adds a warning against re-use of the same wallet file on two different nodes, as that can cause problems due to race conditions between nodes (eg: both nodes using the same addresses at the same time for different things because they are not aware of the other node).

I've also included the rationale behind the warning but I've kept it short to make it clearer to users, not sure if I should have written a longer explanation instead.

Also, while this PR may help some users avoid problems, the changes are largely inconsequential, so feel free to close it if it's not worth the effort.

On an unrelated note, I've also set up this site, which periodically pulls bitcoin core and turns its docs into a webpage. Browsing the docs can also be done locally or on github, so this doesn't add much value, but I personally find that more comfortable and it makes them more searchable.

@fanquake fanquake added the Docs label Feb 28, 2020
@laanwj
Copy link
Member

laanwj commented Mar 2, 2020

ACK 92d56e7
Not sure if this is the most visible place to document this but doing so is better than not.

@corollari
Copy link
Contributor Author

Any thoughts on better places to put it? The reason why I put it there was because it's right next to the description of wallet.dat, which is also only bit of documentation that references it at the moment, so I hoped that people that could use this warning would naturally end up in the page where the file is described.

@luke-jr
Copy link
Member

luke-jr commented Mar 4, 2020

Should we mention doing this with JBOK wallets can also result in lost coins? (We no longer create them, but we still support them...)

@maflcko
Copy link
Member

maflcko commented Mar 4, 2020

What is a JBOK wallet? I was running git log -S JBOK and it didn't return anything. I presume you mean pre-HD wallets?

@luke-jr
Copy link
Member

luke-jr commented Mar 4, 2020

"Just a Bunch Of Keys", yes

@ryanofsky
Copy link
Contributor

ryanofsky commented Mar 4, 2020

Any thoughts on better places to put it?

This seems like a good place to have the documentation. But another idea might be to create readme files in newly created wallet directories (if TryCreateDirectories returns true). The readme files could say something like "This is a bitcoin wallet directory. When creating backups, please be sure to back up wallet.dat as well as any transaction log files in database/*.log to avoid corruption. Also to prevent double spends and key reuse, don't run separate bitcoin nodes with copies of the same original wallet."

@fjahr
Copy link
Contributor

fjahr commented Mar 4, 2020

ACK 92d56e7

I think this is an OK location to put it, I did a quick look around and did not find a better one in a different doc. My only alternative suggestion would be to add a new section to files.md called "Sharing files". It could include hints on pitfalls when sharing files with other nodes, not just wallet.dat. I am sure there are other pitfalls/useful hint when sharing files, I just don't have any good example off the top of my head right now.

@luke-jr
Copy link
Member

luke-jr commented Mar 4, 2020

Another thing to say here: never copy the file directly, always use the backupwallet RPC or GUI menu option.

As for a "Sharing files" section: chainstate shouldn't be shared from untrusted people; blocks can be. etc

corollari added a commit to corollari/bitcoin that referenced this pull request Mar 5, 2020
@corollari
Copy link
Contributor Author

Another thing to say here: never copy the file directly, always use the backupwallet RPC or GUI menu option.

I've just added that in, from my understanding of the code, the only benefit that backupwallet provides over a standard copy is that it locks the wallet while the copy is being done, thus preventing any updates to it that could result in a corrupted copy, is that right?

create readme files in newly created wallet directories (if TryCreateDirectories returns true).

I quite like this idea, if other people also believe that it's better to do it that way over just adding a warning on the docs I'll change this PR to use that approach instead.

@luke-jr
Copy link
Member

luke-jr commented Mar 5, 2020

I've just added that in, from my understanding of the code, the only benefit that backupwallet provides over a standard copy is that it locks the wallet while the copy is being done, thus preventing any updates to it that could result in a corrupted copy, is that right?

No, it also "finalises" the logs into the single wallet.dat file. Without that step, copying the wallet.dat file alone can miss recent changes.

@ryanofsky
Copy link
Contributor

if other people also believe that it's better to do it that way over just adding a warning on the docs I'll change this PR to use that approach instead.

To be clear, the suggestion was just supposed to about an additional place this could be documented, not an alternate place. files.md is a good place to describe the file regardless

@corollari
Copy link
Contributor Author

No, it also "finalises" the logs into the single wallet.dat file. Without that step, copying the wallet.dat file alone can miss recent changes.

I've updated the PR to add that bit.

the suggestion was just supposed to about an additional place this could be documented

I see, I'll reserve that change for a new PR then.

My only alternative suggestion would be to add a new section to files.md called "Sharing files"

I don't know what alternative is better, i guess it depends on how often people try to copy files for other reasons. So far, the only use cases I have thought of for which you'd want to share files are:

  • Wallet copy/backup
  • Trusted fast-sync

For the second use case, I guess that most users that want that would prefer to get some data which is not readily available as a file currently, such as the utxo set and the last 300 blocks like btcpayserver does. Nevertheless I can see some people wanting to do a fast full-sync, so adding a warning on that might be worth it.

@laanwj
Copy link
Member

laanwj commented Mar 6, 2020

But another idea might be to create readme files in newly created wallet directories (if TryCreateDirectories returns true).

Good idea, and to make the GUI display this.

No need to do so in thie PR though! To be clear, my point was "let's merge this we can add it in other places later" not to hold this up.

re-ACK after squash.

@maflcko
Copy link
Member

maflcko commented Mar 6, 2020

Please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits

@corollari
Copy link
Contributor Author

Squashed.

@maflcko maflcko merged commit 2926cbc into bitcoin:master Mar 11, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 11, 2020
c1e0742 doc: Warn about wallet.dat re-use and backups (Albert)

Pull request description:

  Following discussion in bitcoin#18205, this PR adds a warning against re-use of the same wallet file on two different nodes, as that can cause problems due to race conditions between nodes (eg: both nodes using the same addresses at the same time for different things because they are not aware of the other node).

  I've also included the rationale behind the warning but I've kept it short to make it clearer to users, not sure if I should have written a longer explanation instead.

  Also, while this PR may help some users avoid problems, the changes are largely inconsequential, so feel free to close it if it's not worth the effort.

  On an unrelated note, I've also set up [this site](https://corollari.github.io/bitcoin-core-docs/), which periodically pulls bitcoin core and turns its docs into a webpage. Browsing the docs can also be done locally or on github, so this doesn't add much value, but I personally find that more comfortable and it makes them more searchable.

Top commit has no ACKs.

Tree-SHA512: 5ce06026176917304932714470be8c3410d35698f925875b0955ecd3b1756ef52793feb469dd4bdac4921f1a24daf59001e9911f1f096f559fb28c250baae378
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Apr 17, 2020
van-orton pushed a commit to BitgesellOfficial/bitgesell that referenced this pull request Oct 30, 2020
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
c1e0742 doc: Warn about wallet.dat re-use and backups (Albert)

Pull request description:

  Following discussion in bitcoin#18205, this PR adds a warning against re-use of the same wallet file on two different nodes, as that can cause problems due to race conditions between nodes (eg: both nodes using the same addresses at the same time for different things because they are not aware of the other node).

  I've also included the rationale behind the warning but I've kept it short to make it clearer to users, not sure if I should have written a longer explanation instead.

  Also, while this PR may help some users avoid problems, the changes are largely inconsequential, so feel free to close it if it's not worth the effort.

  On an unrelated note, I've also set up [this site](https://corollari.github.io/bitcoin-core-docs/), which periodically pulls bitcoin core and turns its docs into a webpage. Browsing the docs can also be done locally or on github, so this doesn't add much value, but I personally find that more comfortable and it makes them more searchable.

Top commit has no ACKs.

Tree-SHA512: 5ce06026176917304932714470be8c3410d35698f925875b0955ecd3b1756ef52793feb469dd4bdac4921f1a24daf59001e9911f1f096f559fb28c250baae378
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 7, 2021
Summary:
> See discussion in [[bitcoin/bitcoin#18205 | PR18205]] and bitcoin/bitcoin#18219 (comment).

This is a backport of Core [[bitcoin/bitcoin#18219 | PR18219]]

Test Plan: proof-reading in a markdown-aware IDE

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D8826
backpacker69 pushed a commit to peercoin/peercoin that referenced this pull request Mar 28, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants