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

Add option to create an encrypted wallet #15006

Merged
merged 1 commit into from May 16, 2019

Conversation

achow101
Copy link
Member

@achow101 achow101 commented Dec 19, 2018

This PR adds a new passphrase argument to createwallet which will create a wallet that is encrypted with that passphrase.

This is built on #15226 because it needs to first create an empty wallet, then encrypt the empty wallet and generate new keys that have only been stored in an encrypted state.

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 20, 2018

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #15937 (WIP: Add loadwallet and createwallet load_on_startup options by ryanofsky)
  • #13756 (wallet: "avoid_reuse" wallet flag for improved privacy by kallewoof)

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.

@jonasschnelli
Copy link
Contributor

Concept ACK

@Sjors
Copy link
Member

Sjors commented Dec 20, 2018

Concept ACK.

Today on IRC:
schermafbeelding 2018-12-20 om 11 17 16

@jnewbery
Copy link
Contributor

Concept ACK

self.log.info("Test disableprivatekeys creation.")
self.nodes[0].createwallet('w1', True)
w1 = node.get_wallet_rpc('w1')
assert_raises_rpc_error(-4,"Error: Private keys are disabled for this wallet", w1.getnewaddress)
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing whitespace after ,. Please run this newly added file through black to make sure formatting is correct :-)

Copy link
Member

Choose a reason for hiding this comment

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

@practicalswift that's an upstream test from #14938, where this has been fixed.

@laanwj
Copy link
Member

laanwj commented Jan 2, 2019

Concept ACK

@laanwj
Copy link
Member

laanwj commented Jan 21, 2019

This fails travis:

Assertion failed: lock cs_wallet not held in wallet/wallet.cpp:1389; locks held:
FAIL qt/test/test_bitcoin-qt (exit status: 134)

@achow101 achow101 force-pushed the create-encrypted-wallet branch 2 times, most recently from 780a296 to 3f17cbe Compare January 21, 2019 20:02
@achow101
Copy link
Member Author

Fixed by rebasing

@achow101
Copy link
Member Author

I've decided to base this on #15226 instead of #14938.

@achow101 achow101 force-pushed the create-encrypted-wallet branch 2 times, most recently from 18886a2 to b7918ad Compare January 23, 2019 21:00
@achow101
Copy link
Member Author

Rebased

@@ -488,6 +488,10 @@ class WalletImpl : public Wallet
{
return MakeHandler(m_wallet.NotifyWatchonlyChanged.connect(fn));
}
std::unique_ptr<Handler> handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) override
Copy link
Member

Choose a reason for hiding this comment

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

handleCanGetAddressesChanged is a terrible method name in itself, took me at least 5 minutes to decode it, please add a comment saying it's a handler for changes in whether addresses can be generated or not :-)

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's a change from #15225 and out of scope for this pr. sorry.

Copy link
Member

Choose a reason for hiding this comment

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

Fwiw I find it easy enough to read, but I'm used to similar nomenclature from iOs :-)

@@ -434,7 +434,7 @@ def batch(self, requests):
def send_cli(self, command=None, *args, **kwargs):
"""Run bitcoin-cli command. Deserializes returned string as python object."""
pos_args = [str(arg).lower() if type(arg) is bool else str(arg) for arg in args]
named_args = [str(key) + "=" + str(value) for (key, value) in kwargs.items()]
named_args = [str(key) + "=" + (str(value).lower() if type(value) is bool else str(value)) for (key, value) in kwargs.items()]
Copy link
Member

@laanwj laanwj Jan 31, 2019

Choose a reason for hiding this comment

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

I remember I had a comment on this (please factor out the value→cli functionality to a function instead of duplicating it) but somehow it got lost …

Copy link
Member Author

Choose a reason for hiding this comment

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

Since this issue affects multiple PRs, I've split the fix into a separate PR: #15301

Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm, bizarre. You definitely did have a comment here because I responded to it!

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 8, 2019
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Dec 3, 2019
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 5, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 5, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jun 7, 2020
Summary:
bitcoin/bitcoin@662d117

---

Backport of Core [[bitcoin/bitcoin#15006 | PR15006]]

Test Plan:
  ninja check
  ./test/functional/test_runner.py wallet_createwallet.py

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6423
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 16, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
achow101 pushed a commit to achow101/bitcoin that referenced this pull request Jun 22, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 25, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 25, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 25, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
achow101 pushed a commit to achow101/bitcoin that referenced this pull request Jun 25, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 2, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 2, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
achow101 pushed a commit to achow101/bitcoin that referenced this pull request Jul 6, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 11, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 11, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 13, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 13, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 23, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 23, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 23, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 23, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 23, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
achow101 pushed a commit to achow101/bitcoin that referenced this pull request Jul 27, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
achow101 pushed a commit to achow101/bitcoin that referenced this pull request Aug 10, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Aug 13, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Aug 13, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Aug 13, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Aug 13, 2020
This maintains a persistent list of wallets stored in settings that will
automatically be loaded on startup. Being able to load a wallet automatically
on startup will be more useful in the GUI when the option to create wallets is
added in bitcoin#15006, but it's reasonable to expose this feature by RPC as well.
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
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.

None yet