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

Remove the automatic creation and loading of the default wallet #15454

Merged
merged 2 commits into from
Sep 18, 2020

Conversation

achow101
Copy link
Member

@achow101 achow101 commented Feb 20, 2019

Instead of automatically creating and loading a default wallet, users should instead explicitly create their wallet or load it on start.

Builds on #19754 which provides the load_on_startup behavior for the GUI.

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 20, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@@ -184,8 +184,16 @@ void WalletInit::Construct(InitInterfaces& interfaces) const
LogPrintf("Wallet disabled!\n");
return;
}
gArgs.SoftSetArg("-wallet", "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm missing something, this is breaking change. Why not change the behavior from "load or create each -wallet" to "just load each -wallet"? Then to create a wallet there is the option in the GUI and createwallet in RPC.

@Sjors
Copy link
Member

Sjors commented Feb 21, 2019

Partial Concept ACK on:

  • not creating a default wallet with bitcoind
  • storing opened wallets in bitcoin_rw.conf (QT only)

Concept On The Fence about making this a breaking change for bitcoind. I.e. maybe we should still load an existing <datadir>/wallet.dat and <datadir>/wallet.dat, but not create one.

Concept NACK on:

  • having QT start with a blank wallet, where the user is instructed to go the file menu and choose Create or Open Wallet
  • not loading the default wallet in QT after upgrading: that's a guarantee for user heart attacks

I think the best solution is here is to pull the create wallet UI into the startup wizard, as an additional section. The user can then just click next and it creates the default wallet.

Since it takes at least a few seconds, this gives the RNG a bit more bit time too (I assume the IBD network traffic should generate some extra entropy). (Although that requires starting IBD while the wizard is open.)

An easier but still acceptable solution is a big Create Wallet button in the Overview tab (when no wallet is loaded), as well as point out that they can load an existing wallet (less likely for first time users).

Some issues:

  • opening and closing wallets in QT updates bitcoin_rw.conf, which is good but:
    • why use a new field loadedwallet? adding and removing wallet= entries seems cleaner. It won't work for wallets already in bitcoin.conf, but that's fine (we can warn the user in that case).
    • I suggest doing this as soon as the open / close succeeds, rather than at exit

@achow101
Copy link
Member Author

achow101 commented Feb 21, 2019

An easier but still acceptable solution is a big Create Wallet button in the Overview tab (when no wallet is loaded), as well as point out that they can load an existing wallet (less likely for first time users).

I've done this.

not loading the default wallet in QT after upgrading: that's a guarantee for user heart attacks

I've changed that back to the original behavior except that it only loads the default wallet if it is available. It will not create it.

  • why use a new field loadedwallet? adding and removing wallet= entries seems cleaner. It won't work for wallets already in bitcoin.conf, but that's fine (we can warn the user in that case).

#11082 doesn't let me set the multiple of the same argument.

@Sjors
Copy link
Member

Sjors commented Feb 22, 2019

Much better, thanks. Both bitcoind and QT now load the default wallet if it exists, and the QT create button is more clear.

Can you add screenshots of the UX to the PR description?

The initial download overlay actually hides the wallet functionality, which has the nice side-effect of collecting some entropy. Although I'd rather work on making the initial experience such that users can get started more quickly, that's a whole different story.

schermafbeelding 2019-02-22 om 09 38 29

When the user hides the sync they see this:
schermafbeelding 2019-02-22 om 09 38 55

A bit ugly, but I think the button makes it super clear what to do. Nit: reverse the order, i.e. suggest creating a wallet and then point out that the user can also load an existing wallet.

Regarding the wallet creation dialog, that can be discussed in #15450, but it's important that we don't overwhelm a first time user with advanced options. One thing though: what to do with the default name, at the risk of bike shedding...
schermafbeelding 2019-02-22 om 09 40 37

I suggest we hide the wallet name field for the first wallet, or make it really clear that it's totally optional and that you can't (easily) change it (yet).

As for rw_config, which has been in limbo for quite a long time, let's start with reviewing #14866 by @AkioNak which makes the evaluation of bitcoin.conf (includes) a bit more sane. We should expand the functional test suite to more thoroughly cover the expected behavior. That in turn should make it easier to merge rw_config.

Found a small bug:

src/bitcoin-cli -testnet listwallets
[
]

src/bitcoin-cli -testnet createwallet ""
error code: -4
error message:
Wallet  already exists

@jnewbery
Copy link
Contributor

concept ACK

@@ -228,10 +240,19 @@ void StopWallets()
void UnloadWallets()
{
auto wallets = GetWallets();
std::string loaded_wallets = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Redundant initialisation :-)

if (!loaded_wallets.empty()) {
loaded_wallets += ",";
}
loaded_wallets += wallet->GetName();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the wallet name has a comma? Would prefer to see rwconf extended to multiple wallet= fields...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So would I. I would prefer that #11082 implements it that way instead of requiring me to change it as I am not familiar with that code.

wallets.pop_back();
RemoveWallet(wallet);
UnloadWallet(std::move(wallet));
}
if (gArgs.HaveRWConfigFile()) {
gArgs.ModifyRWConfigFile("loadedwallet", loaded_wallets);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just use wallet=?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will cause some problems as is since it would be one string that represents multiple wallets. If/when rwconf allows repeated fields, then it can be wallet=.

jsarenik added a commit to jsarenik/lightning that referenced this pull request Oct 1, 2020
jsarenik added a commit to jsarenik/lightning that referenced this pull request Oct 1, 2020
cdecker pushed a commit to jsarenik/lightning that referenced this pull request Oct 13, 2020
cdecker pushed a commit to ElementsProject/lightning that referenced this pull request Oct 13, 2020
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 19, 2020
This changes -wallet setting to only load existing wallets, not create new ones.

- Fixes settings.json corner cases reported by sjors & promag:
  bitcoin-core/gui#95,
  bitcoin#19754 (comment),
  bitcoin#19754 (comment)

- Prevents accidental creation of wallets reported most recently by jb55
  http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

- Simplifies behavior after bitcoin#15454. bitcoin#15454 took the big step of disabling
  creation of the default wallet. This PR extends it to avoid creating other
  wallets as well. With this change, new wallets just aren't created on
  startup, instead of sometimes being created, sometimes not. bitcoin#15454 release
  notes are updated here and are simpler.

This change should be targetted for 0.21.0. It's a bug fix and simplifies
behavior of the bitcoin#15937 / bitcoin#19754 / bitcoin#15454 features added in 0.21.0.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 19, 2020
This changes -wallet setting to only load existing wallets, not create new ones.

- Fixes settings.json corner cases reported by sjors & promag:
  bitcoin-core/gui#95,
  bitcoin#19754 (comment),
  bitcoin#19754 (comment)

- Prevents accidental creation of wallets reported most recently by jb55
  http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

- Simplifies behavior after bitcoin#15454. bitcoin#15454 took the big step of disabling
  creation of the default wallet. This PR extends it to avoid creating other
  wallets as well. With this change, new wallets just aren't created on
  startup, instead of sometimes being created, sometimes not. bitcoin#15454 release
  notes are updated here and are simpler.

This change should be targetted for 0.21.0. It's a bug fix and simplifies
behavior of the bitcoin#15937 / bitcoin#19754 / bitcoin#15454 features added in 0.21.0.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 21, 2020
This changes -wallet setting to only load existing wallets, not create new ones.

- Fixes settings.json corner cases reported by sjors & promag:
  bitcoin-core/gui#95,
  bitcoin#19754 (comment),
  bitcoin#19754 (comment)

- Prevents accidental creation of wallets reported most recently by jb55
  http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

- Simplifies behavior after bitcoin#15454. bitcoin#15454 took the big step of disabling
  creation of the default wallet. This PR extends it to avoid creating other
  wallets as well. With this change, new wallets just aren't created on
  startup, instead of sometimes being created, sometimes not. bitcoin#15454 release
  notes are updated here and are simpler.

This change should be targetted for 0.21.0. It's a bug fix and simplifies
behavior of the bitcoin#15937 / bitcoin#19754 / bitcoin#15454 features added in 0.21.0.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 21, 2020
This changes -wallet setting to only load existing wallets, not create new ones.

- Fixes settings.json corner cases reported by sjors & promag:
  bitcoin-core/gui#95,
  bitcoin#19754 (comment),
  bitcoin#19754 (comment)

- Prevents accidental creation of wallets reported most recently by jb55
  http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

- Simplifies behavior after bitcoin#15454. bitcoin#15454 took the big step of disabling
  creation of the default wallet. This PR extends it to avoid creating other
  wallets as well. With this change, new wallets just aren't created on
  startup, instead of sometimes being created, sometimes not. bitcoin#15454 release
  notes are updated here and are simpler.

This change should be targetted for 0.21.0. It's a bug fix and simplifies
behavior of the bitcoin#15937 / bitcoin#19754 / bitcoin#15454 features added in 0.21.0.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Oct 21, 2020
This changes -wallet setting to only load existing wallets, not create new ones.

- Fixes settings.json corner cases reported by sjors & promag:
  bitcoin-core/gui#95,
  bitcoin#19754 (comment),
  bitcoin#19754 (comment)

- Prevents accidental creation of wallets reported most recently by jb55
  http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

- Simplifies behavior after bitcoin#15454. bitcoin#15454 took the big step of disabling
  creation of the default wallet. This PR extends it to avoid creating other
  wallets as well. With this change, new wallets just aren't created on
  startup, instead of sometimes being created, sometimes not. bitcoin#15454 release
  notes are updated here and are simpler.

This change should be targeted for 0.21.0. It's a bug fix and simplifies
behavior of the bitcoin#15937 / bitcoin#19754 / bitcoin#15454 features added in 0.21.0.
bitcoinhodler added a commit to bitcoinhodler/GlacierProtocol that referenced this pull request Oct 22, 2020
Since Bitcoin Core will no longer do so; see
bitcoin/bitcoin#15454

Tested with bitcoind 0.18.0, 0.20.0, and git
dda18e7310a202a8aa46c95279446131659f91c5 (a pre-release 0.21).
maflcko pushed a commit that referenced this pull request Oct 29, 2020
01476a8 wallet: Make -wallet setting not create wallets (Russell Yanofsky)

Pull request description:

  This changes `-wallet` setting to only load existing wallets, not create new ones.

  - Fixes settings.json corner cases reported by sjors & promag: bitcoin-core/gui#95, #19754 (comment), #19754 (comment)

  - Prevents accidental creation of wallets reported most recently by jb55 http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

  - Simplifies behavior after #15454. #15454 took the big step of disabling creation of the default wallet. This PR extends it to avoid creating other wallets as well. With this change, new wallets just aren't created on startup, instead of sometimes being created, sometimes not. #15454 release notes are updated here and are simpler.

  This change should be targeted for 0.21.0. It's a bug fix and simplifies behavior of the #15937 / #19754 / #15454 features added in 0.21.0.

  ---

  This PR is implementing the simplest, most basic alternative listed in bitcoin-core/gui#95 (comment). Other improvements mentioned there can build on top of this.

ACKs for top commit:
  achow101:
    ACK 01476a8
  hebasto:
    re-ACK 01476a8
  MarcoFalke:
    review ACK 01476a8 🏂

Tree-SHA512: 0d50f4e5dfbd04a2efd9fd66c02085a0ed705807bdec1cf5770d0ae8cb6af07080fb81306349937bf66acdb713d03fb35636f6442b650d0820e66cbae09c2f87
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 29, 2020
01476a8 wallet: Make -wallet setting not create wallets (Russell Yanofsky)

Pull request description:

  This changes `-wallet` setting to only load existing wallets, not create new ones.

  - Fixes settings.json corner cases reported by sjors & promag: bitcoin-core/gui#95, bitcoin#19754 (comment), bitcoin#19754 (comment)

  - Prevents accidental creation of wallets reported most recently by jb55 http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-14.html#l-355

  - Simplifies behavior after bitcoin#15454. bitcoin#15454 took the big step of disabling creation of the default wallet. This PR extends it to avoid creating other wallets as well. With this change, new wallets just aren't created on startup, instead of sometimes being created, sometimes not. bitcoin#15454 release notes are updated here and are simpler.

  This change should be targeted for 0.21.0. It's a bug fix and simplifies behavior of the bitcoin#15937 / bitcoin#19754 / bitcoin#15454 features added in 0.21.0.

  ---

  This PR is implementing the simplest, most basic alternative listed in bitcoin-core/gui#95 (comment). Other improvements mentioned there can build on top of this.

ACKs for top commit:
  achow101:
    ACK 01476a8
  hebasto:
    re-ACK 01476a8
  MarcoFalke:
    review ACK 01476a8 🏂

Tree-SHA512: 0d50f4e5dfbd04a2efd9fd66c02085a0ed705807bdec1cf5770d0ae8cb6af07080fb81306349937bf66acdb713d03fb35636f6442b650d0820e66cbae09c2f87
maflcko pushed a commit to bitcoin-core/gui that referenced this pull request Nov 17, 2020
ac64cec gui: create wallet: add advanced section (Sjors Provoost)
c99d6f6 gui: create wallet: name placeholder (Sjors Provoost)
5bff825 [gui] create wallet: smarter checkbox toggling (Sjors Provoost)

Pull request description:

  Previously only users who needed a second wallet had to use to the create wallet dialog. With the merge of bitcoin/bitcoin#15454 now all new users have to. I don't think it was user-friendly enough for that.

  <img width="403" alt="Schermafbeelding 2020-09-18 om 09 41 44" src="https://user-images.githubusercontent.com/10217/93574129-52ef9680-f998-11ea-9a6f-31144f66d3bf.png">

  This PR makes a few simple improvements so that new users don't have to think too much:

  <img width="369" alt="Schermafbeelding 2020-10-15 om 16 45 22" src="https://user-images.githubusercontent.com/10217/96145959-0c914700-0f06-11eb-9526-cf447d841d7a.png">

  It's lightly inspired by #77. It would be better if those changes made it into the upcoming release, but this PR is a good start imo.

  * wallet encryption is no longer checked by default, because such a change in the default needs a separate discussion (fwiw, I suspect it increases the number of users losing access to coins)
  * watch-only and descriptor wallet stuff is moved to advanced, so new users know they can safely ignore these check boxes
  * bonus: when you click on "disable private keys" it disables encrypt wallet and checks blank wallet
  * label changes: see screenshot
  * tooltip changes: see code diff

  Note that a blank wallet name isn't allowed in the dialog; I haven't addressed that.

  _Update 2020-10-30_, dropped the new strings for now:
  <img width="450" alt="Schermafbeelding 2020-10-30 om 11 26 55" src="https://user-images.githubusercontent.com/10217/97694591-1b99fc80-1aa3-11eb-8b85-e19f1ad5add4.png">

ACKs for top commit:
  fjahr:
    Tested ACK ac64cec
  jonatack:
    re-ACK ac64cec, per `git diff d393708 ac64cec` only change since my last review is improving the placeholder from "MyWallet" to "Wallet" and dropping the last commit. Tested creating a dozen wallets in signet with different combinations of options and then verifying/comparing their characteristics in the console with getwalletinfo. My remaining caveats are (1) the need for less user surprise by either (a) improving the user info or (b) with less auto-(un)selecting as mentioned in #96 (comment) and (2) I prefer the "Encrypt private keys" and "Watch-only" wording and descriptions below over the current ones; hopefully these can be addressed in a follow-up.
  hebasto:
    re-ACK ac64cec
  ryanofsky:
    Code review ACK ac64cec. Only changes since last review are tweaking placeholder text and dropping "allow nameless" commit

Tree-SHA512: a25f84eb66ee4f99af441d73e33928df9d9cf592177398ef48f0037f5913699e47a162cf1301c83b34501546d43ff4ae12607fd078c5c03b92f573bf7604a9f2
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 17, 2020
ac64cec gui: create wallet: add advanced section (Sjors Provoost)
c99d6f6 gui: create wallet: name placeholder (Sjors Provoost)
5bff825 [gui] create wallet: smarter checkbox toggling (Sjors Provoost)

Pull request description:

  Previously only users who needed a second wallet had to use to the create wallet dialog. With the merge of bitcoin#15454 now all new users have to. I don't think it was user-friendly enough for that.

  <img width="403" alt="Schermafbeelding 2020-09-18 om 09 41 44" src="https://user-images.githubusercontent.com/10217/93574129-52ef9680-f998-11ea-9a6f-31144f66d3bf.png">

  This PR makes a few simple improvements so that new users don't have to think too much:

  <img width="369" alt="Schermafbeelding 2020-10-15 om 16 45 22" src="https://user-images.githubusercontent.com/10217/96145959-0c914700-0f06-11eb-9526-cf447d841d7a.png">

  It's lightly inspired by #77. It would be better if those changes made it into the upcoming release, but this PR is a good start imo.

  * wallet encryption is no longer checked by default, because such a change in the default needs a separate discussion (fwiw, I suspect it increases the number of users losing access to coins)
  * watch-only and descriptor wallet stuff is moved to advanced, so new users know they can safely ignore these check boxes
  * bonus: when you click on "disable private keys" it disables encrypt wallet and checks blank wallet
  * label changes: see screenshot
  * tooltip changes: see code diff

  Note that a blank wallet name isn't allowed in the dialog; I haven't addressed that.

  _Update 2020-10-30_, dropped the new strings for now:
  <img width="450" alt="Schermafbeelding 2020-10-30 om 11 26 55" src="https://user-images.githubusercontent.com/10217/97694591-1b99fc80-1aa3-11eb-8b85-e19f1ad5add4.png">

ACKs for top commit:
  fjahr:
    Tested ACK ac64cec
  jonatack:
    re-ACK ac64cec, per `git diff d393708 ac64cec` only change since my last review is improving the placeholder from "MyWallet" to "Wallet" and dropping the last commit. Tested creating a dozen wallets in signet with different combinations of options and then verifying/comparing their characteristics in the console with getwalletinfo. My remaining caveats are (1) the need for less user surprise by either (a) improving the user info or (b) with less auto-(un)selecting as mentioned in bitcoin-core/gui#96 (comment) and (2) I prefer the "Encrypt private keys" and "Watch-only" wording and descriptions below over the current ones; hopefully these can be addressed in a follow-up.
  hebasto:
    re-ACK ac64cec
  ryanofsky:
    Code review ACK ac64cec. Only changes since last review are tweaking placeholder text and dropping "allow nameless" commit

Tree-SHA512: a25f84eb66ee4f99af441d73e33928df9d9cf592177398ef48f0037f5913699e47a162cf1301c83b34501546d43ff4ae12607fd078c5c03b92f573bf7604a9f2
bitcoinhodler added a commit to bitcoinhodler/GlacierProtocol that referenced this pull request Nov 22, 2020
Since Bitcoin Core will no longer do so; see
bitcoin/bitcoin#15454

Tested with all of the following bitcoind versions:

0.17.1
0.19.0.1
0.20.1
0.18.0
0.20.0
v0.21.0rc1 (from git)
vibhaa pushed a commit to spider-pcn/lightning that referenced this pull request Mar 24, 2021
nixbitcoin added a commit to nixbitcoin/nix-bitcoin that referenced this pull request Jul 8, 2021
Includes
- coincurve: 13.0.0 -> 15.0.0
- Darkscience Tor onion address update
- bitcoin-cli jm_wallet generation
- don't copy bitcoin-rpcpassword-privileged as privileged user, instead
  add the joinmarket user to bitcoin group. Same effect, less
  complexity. Note, PoLP still obeyed for joinmarket-ob-watcher.

Starting with 0.21.0, [bitcoin no longer automatically creates and loads
a default wallet](bitcoin/bitcoin#15454). This
was being ignored because of [a JoinMarket issue](
JoinMarket-Org/joinmarket-clientserver#812) in
CI builds prior to this version. Now a watch-only Bitcoin Core wallet is
created in the ExecStartPost.
nixbitcoin added a commit to nixbitcoin/nix-bitcoin that referenced this pull request Jul 12, 2021
Includes
- coincurve: 13.0.0 -> 15.0.0
- Darkscience Tor onion address update
- bitcoin-cli jm_wallet generation
- don't copy bitcoin-rpcpassword-privileged as privileged user, instead
  add the joinmarket user to bitcoin group. Same effect, less
  complexity. Note, PoLP still obeyed for joinmarket-ob-watcher.

Starting with 0.21.0, [bitcoin no longer automatically creates and loads
a default wallet](bitcoin/bitcoin#15454). This
was being ignored because of [a JoinMarket issue](
JoinMarket-Org/joinmarket-clientserver#812) in
CI builds prior to this version. Now a watch-only Bitcoin Core wallet is
created in the ExecStartPost.
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 7, 2021
Summary:
No longer create a default wallet. The default wallet will still be
loaded if it exists and not other wallets were specified (anywhere,
including settings.json, bitcoin.conf, and command line).

Tests are updated to be started with `-wallet=` if they need the default
wallet.

Added test to wallet_startup.py testing that no default wallet is
created and that it is loaded if it exists and no other wallets were
specified.

Tell users how to load or create a wallet when no wallet is loaded

This is a backport of [[bitcoin/bitcoin#15454 | core#15454]] and  [[bitcoin/bitcoin#19971 | core#19971]] (bug fix)

Depends on D10240

Test Plan: `ninja all check check-functional-extended`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10243
bitcoinfacts pushed a commit to bitcoinfacts/GlacierProtocol that referenced this pull request Dec 27, 2021
Since Bitcoin Core will no longer do so; see
bitcoin/bitcoin#15454

Tested with all of the following bitcoind versions:

0.17.1
0.19.0.1
0.20.1
0.18.0
0.20.0
v0.21.0rc1 (from git)
@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.