-
Notifications
You must be signed in to change notification settings - Fork 35.7k
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
gui: create PSBT with watch-only wallet #16944
Conversation
Concept ACK |
Would love to see this happen +1 |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, 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. |
concept ACK. I do however think a proper dialogue will be required to let the user know what's going on at a minimum rather than magic resulting in a clipboard result. very light testing also shows it appears it does what's on the tin. I'll do lots more testing later once approach is settled. |
So as some of you saw, I did some related work quite awhile ago. I have a dialog with support for creating/saving/loading/signing/sending these. It's somewhat modeled after the offline signing UI in Armory. I was never happy with the UI, and I think designing this to be intuitive is really hard, but I think it may already be an improvement over clipboard-only. Let me spend a few minutes figuring out what the most recent version is that builds cleanly and works, and I will link it here so people can try it. |
Concept ACK. |
Ok, if you'd like to see my work on this, please have a look at https://github.com/gwillen/bitcoin/tree/feature-offline-v2 . You will need to check preferences->wallet->enable offline transaction features. Then you'll get an 'Offline' menu, a new offline transactions dialog box, and a new pair of checkboxes in the 'send' dialog: "Include watchonly coins" and "create offline transaction" (which is forced on if you include watchonly). If you select the latter, the 'send' button becomes "Create unsigned" and will take you to the new dialog. There is still some amount of jank to be ironed out, there are some XXX comments in the source and some missing error handling. I've had this vaguely shelved for awhile, but I'd be happy to bring it out and work aggressively on it now if desired; I'd also be happy to bring it out less aggressively and start prepping it as a possible sequel to the PR under discussion here. |
@gwillen can you make a (draft) PR with that branch? If you rebase on top of this, you can probably drop the "Enable offline transaction features" checkbox as well as the "include watchonly coins" and "create unsigned "checkboxes, in favor of only allowing the functionality with watch-only wallets. I like how the send button text changes, so I'll steal that for this PR :-) Once we have descriptor wallets and better HWI integration, the simple distinction between watch-only and wallets with private keys will no longer work. For example you might be part of a 2 of 3 multisig, with the keys in the wallet. Or maybe you don't have keys in the Core wallet, but your hardware wallet can sign its part via USB. So in terms of your wizard, I would split into two wizards: one for composing & exporting, and one for loading. There's probably a step 0 where you attempt to (partially) sign with your own keys and with any connected devices. If that's not enough, then you go to step 1 where you can export the PSBT via clipboard or file system. I would introduce a fresh dialog for loading, maybe co-signing and then broadcasting a transaction. |
Let's continue the UX brainstom here: #16954 |
I'm afraid the current version of this PR introduces a bug in First, note that
Second, some context:
This is being suggested in this PR: Lines 2592 to 2593 in 41c5165
Shortened to highlight the issue:
Which -- given the precedence rules -- is equivalent to:
Which -- given that
Or simply:
:) I think the intention was:
Could that be the case? :) |
The final dialogue should have the "Yes" text replace with "Copy unsigned tx to clipboard" or something self-explanatory. Really "Yes" should be "Send" in the average case anyways(think I might PR that change separately) |
41c5165
to
0bd3e1c
Compare
Fixed the precedence bug @practicalswift found. With that I don't think it's necessary to show a dialog with the PSBT text. See also #16966 for a more rigorous approach (I'm trying to keep that an easy rebase), where it will be easier to integrate @gwillen's PSBT management changes (save to disk, check progress, etc). |
"e.g., and offline Bitcoin Core wallet, or a PSBT-compatible hardware wallet" I think that change would make me happy. |
0bd3e1c
to
da86959
Compare
@instagibbs done (I didn't update the screenshots) |
tACK da86959 Ran both watch-only and non-watch-only modes, tested coin control in watch-only mode, tested a Core -> HWI -> Core round-trip and successfully finalized a PSBT with the desired properties. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conecept ACK
It would be preferable if clicking "Copy to Clipboard" wouldn't close the dialog. Also, maybe show the psbt in a text box in the dialog too?
send_failure = true; | ||
} | ||
} | ||
if (!send_failure) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be outside of the else
block since it isn't used in the no private keys case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the no private keys case we also clear the form. We just assume (with an assert
) that PSBT creation can never fail, which is why send_failure
is always false
.
The confirmation dialog is a |
This makes them available in GUI coin selection. Github-Pull: bitcoin#16944 Rebased-From: 40537f0
For wallets with WALLET_FLAG_DISABLE_PRIVATE_KEYS. Github-Pull: bitcoin#16944 Rebased-From: 848f889
Github-Pull: bitcoin#16944 Rebased-From: 39465d5
Github-Pull: bitcoin#16944 Rebased-From: c6dd565
e1e1442 Activate no-privkey -> ISMINE_WATCH_ONLY behavior for LegacySPKM only (Gregory Sanders) Pull request description: Slight cleanup following #16944 This should allow future scriptpubkeymans to transparently work, since the current plan is to have ismine always be spendable. ACKs for top commit: achow101: ACK e1e1442 Sjors: Code review ACK e1e1442 meshcollider: Code review ACK e1e1442 Tree-SHA512: c0a86587d33b8b1646494a5cb0bf8681ee4a88e6913918157746943a0996b501903e0e6ee954cf04154c1e0faee0cbb375c74ca789f46ba9244eb5296632b042
…M only e1e1442 Activate no-privkey -> ISMINE_WATCH_ONLY behavior for LegacySPKM only (Gregory Sanders) Pull request description: Slight cleanup following bitcoin#16944 This should allow future scriptpubkeymans to transparently work, since the current plan is to have ismine always be spendable. ACKs for top commit: achow101: ACK e1e1442 Sjors: Code review ACK e1e1442 meshcollider: Code review ACK e1e1442 Tree-SHA512: c0a86587d33b8b1646494a5cb0bf8681ee4a88e6913918157746943a0996b501903e0e6ee954cf04154c1e0faee0cbb375c74ca789f46ba9244eb5296632b042
…empty 92bcd70 [wallet] allow transaction without change if keypool is empty (Sjors Provoost) 709f868 [wallet] CreateTransaction: simplify change address check (Sjors Provoost) 5efc25f [wallet] translate "Keypool ran out" message (Sjors Provoost) Pull request description: Extracted from #16944 First this PR simplifies the check when generating a change address, by dropping `CanGetAddresses` and just letting `reservedest.GetReservedDestination` do this check. Second, when the keypool is empty, instead of immediately giving up, we create a dummy change address and pass that to coin selection. If we didn't need the change address (e.g. when spending the entire balance), then it's all good. If we did need a change address, we throw the original error. ACKs for top commit: fjahr: Code review ACK 92bcd70 jonasschnelli: utACK 92bcd70 achow101: ACK 92bcd70 meshcollider: Code review ACK 92bcd70 Tree-SHA512: 07b8c8251f57061c58a85ebf0359be63583c23bac7a2c4cefdc14820c0cdebcc90a2bb218e5ede0db11d1e204cda149e056dfd18614642070b3d56efe2735006
…ool is empty 92bcd70 [wallet] allow transaction without change if keypool is empty (Sjors Provoost) 709f868 [wallet] CreateTransaction: simplify change address check (Sjors Provoost) 5efc25f [wallet] translate "Keypool ran out" message (Sjors Provoost) Pull request description: Extracted from bitcoin#16944 First this PR simplifies the check when generating a change address, by dropping `CanGetAddresses` and just letting `reservedest.GetReservedDestination` do this check. Second, when the keypool is empty, instead of immediately giving up, we create a dummy change address and pass that to coin selection. If we didn't need the change address (e.g. when spending the entire balance), then it's all good. If we did need a change address, we throw the original error. ACKs for top commit: fjahr: Code review ACK 92bcd70 jonasschnelli: utACK 92bcd70 achow101: ACK 92bcd70 meshcollider: Code review ACK 92bcd70 Tree-SHA512: 07b8c8251f57061c58a85ebf0359be63583c23bac7a2c4cefdc14820c0cdebcc90a2bb218e5ede0db11d1e204cda149e056dfd18614642070b3d56efe2735006
Summary: Change sendcoins dialogue Yes to Send (Gregory Sanders) Pull request description: It's more self-explanatory, matches "cancel" better, and makes future extensions such as bitcoin/bitcoin#16944 more directly understandable to the user. bitcoin/bitcoin@a649cc6 --- Backport of Core [[bitcoin/bitcoin#16964 | PR16964]] Test Plan: ninja ./src/qt/bitcoin-qt -regtest send myself money, see 'Send' instead of 'Yes' Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D7292
…thout private keys Summary: This makes them available in GUI coin selection. bitcoin/bitcoin@40537f0 --- Partial backport of Core [[bitcoin/bitcoin#16944 | PR16944]] Depends on D7292 Test Plan: ninja check Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D7293
Summary: For wallets with WALLET_FLAG_DISABLE_PRIVATE_KEYS. bitcoin/bitcoin@848f889 --- Depends on D7293 Partial backport of Core [[bitcoin/bitcoin#16944 | PR16944]] Test Plan: ninja check Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D7294
Summary: bitcoin/bitcoin@39465d5 --- ~~Note to reviewers: Original PR has a default SigHashType argument for fillPSBT set in both the declaration and definition, I've removed the default from the definition as it's DRYer and less error-prone that way~~ Partial backport of Core [[bitcoin/bitcoin#16944 | PR16944]] Depends on D7294 Test Plan: ninja check Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D7295
Summary: bitcoin/bitcoin@c6dd565 Depends on D7295 Concludes backport of Core [[bitcoin/bitcoin#16944 | PR16944]] Test Plan: ninja all check check-functional Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D7727
Summary: e1e1442f3eadc1d139380e71c1b60b86d8d6bdee Activate no-privkey -> ISMINE_WATCH_ONLY behavior for LegacySPKM only (Gregory Sanders) Pull request description: Slight cleanup following bitcoin/bitcoin#16944 This should allow future scriptpubkeymans to transparently work, since the current plan is to have ismine always be spendable. --- Backport of Core [[bitcoin/bitcoin#17677 | PR17677]] Test Plan: ninja all check check-functional Reviewers: #bitcoin_abc, jasonbcox Reviewed By: #bitcoin_abc, jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D7728
c6dd565 [gui] watch-only wallet: copy PSBT to clipboard (Sjors Provoost) 39465d5 [wallet] add fillPSBT to interface (Sjors Provoost) 848f889 [gui] send: include watch-only (Sjors Provoost) 40537f0 [wallet] ListCoins: include watch-only for wallets without private keys (Sjors Provoost) Pull request description: For wallets with `WALLET_FLAG_DISABLE_PRIVATE_KEYS` this makes the watch-only balance available on the send screen (including coin selection). Instead of sending a transaction it generates a PSBT. The user can take this PSBT and process it with [HWI](https://github.com/bitcoin-core/HWI) or put it an SD card for hardware wallets that support that. The PSBT is copied to the clipboard. This was the easiest approach; we can add a dialog later to display it, as well as an option to save to disk. ACKs for top commit: instagibbs: test and code review ACK bitcoin@c6dd565 meshcollider: re-ACK c6dd565 Tree-SHA512: ebc3da0737e33b255ed926191b84569aedb6097d14868662bd5dce726ce3048e86e9a31eba987b10dffe1482b35c21ae1cd595c2caa4634bc4cf78a826a83852
4a96e45 [gui] send: show watch-only balance in send screen (Sjors Provoost) 2689c8f [test] qt: add send screen balance test (Sjors Provoost) Pull request description: Now that we can create a PSBT from a watch-only wallet (bitcoin#16944), we should also display the watch-only balance on the send screen. Before: <img width="1008" alt="before" src="https://user-images.githubusercontent.com/10217/69533384-030e9180-0f78-11ea-9748-c32c957e822e.png"> After: <img width="1009" alt="Schermafbeelding 2019-11-26 om 11 44 17" src="https://user-images.githubusercontent.com/10217/69622879-19811f80-1042-11ea-8279-091012f39b38.png"> I added a test to check the balance on the send screen, but it only covers regular wallets. A better would add a watch-only only wallet. ACKs for top commit: meshcollider: utACK 4a96e45 jb55: utACK 4a96e45 promag: reACK 4a96e45, rebased and label change since last review. instagibbs: code review and light test ACK bitcoin@4a96e45 Tree-SHA512: 4213549888bd309f72bdbba1453218f4a2b07e809100d786a3791897c75468f9092b06fe4b971942b1c228aa75ee7c04971f262ca9a478b42756e056eb534620
…M only e1e1442 Activate no-privkey -> ISMINE_WATCH_ONLY behavior for LegacySPKM only (Gregory Sanders) Pull request description: Slight cleanup following bitcoin#16944 This should allow future scriptpubkeymans to transparently work, since the current plan is to have ismine always be spendable. ACKs for top commit: achow101: ACK e1e1442 Sjors: Code review ACK e1e1442 meshcollider: Code review ACK e1e1442 Tree-SHA512: c0a86587d33b8b1646494a5cb0bf8681ee4a88e6913918157746943a0996b501903e0e6ee954cf04154c1e0faee0cbb375c74ca789f46ba9244eb5296632b042
a649cc6 Change sendcoins dialogue Yes to Send (Gregory Sanders) Pull request description: It's more self-explanatory, matches "cancel" better, and makes future extensions such as bitcoin#16944 more directly understandable to the user. ACKs for top commit: Sjors: Trivial code review ACK a649cc6. I also used Send in bitcoin#16966 (`ui - make send a wizard`) laanwj: ACK a649cc6 jonatack: Code review ACK a649cc6 Tree-SHA512: fe4993bc7ac653d28f3d399ade046bcfd405511aec06ff041bb5aef47e0736faf3e3112a6db660cd761af56392dc6b97f2c2341ed3eff4490079c5eb8a0d465a
a649cc6 Change sendcoins dialogue Yes to Send (Gregory Sanders) Pull request description: It's more self-explanatory, matches "cancel" better, and makes future extensions such as bitcoin#16944 more directly understandable to the user. ACKs for top commit: Sjors: Trivial code review ACK a649cc6. I also used Send in bitcoin#16966 (`ui - make send a wizard`) laanwj: ACK a649cc6 jonatack: Code review ACK a649cc6 Tree-SHA512: fe4993bc7ac653d28f3d399ade046bcfd405511aec06ff041bb5aef47e0736faf3e3112a6db660cd761af56392dc6b97f2c2341ed3eff4490079c5eb8a0d465a
a649cc6 Change sendcoins dialogue Yes to Send (Gregory Sanders) Pull request description: It's more self-explanatory, matches "cancel" better, and makes future extensions such as bitcoin#16944 more directly understandable to the user. ACKs for top commit: Sjors: Trivial code review ACK a649cc6. I also used Send in bitcoin#16966 (`ui - make send a wizard`) laanwj: ACK a649cc6 jonatack: Code review ACK a649cc6 Tree-SHA512: fe4993bc7ac653d28f3d399ade046bcfd405511aec06ff041bb5aef47e0736faf3e3112a6db660cd761af56392dc6b97f2c2341ed3eff4490079c5eb8a0d465a
a649cc6 Change sendcoins dialogue Yes to Send (Gregory Sanders) Pull request description: It's more self-explanatory, matches "cancel" better, and makes future extensions such as bitcoin#16944 more directly understandable to the user. ACKs for top commit: Sjors: Trivial code review ACK a649cc6. I also used Send in bitcoin#16966 (`ui - make send a wizard`) laanwj: ACK a649cc6 jonatack: Code review ACK a649cc6 Tree-SHA512: fe4993bc7ac653d28f3d399ade046bcfd405511aec06ff041bb5aef47e0736faf3e3112a6db660cd761af56392dc6b97f2c2341ed3eff4490079c5eb8a0d465a
a649cc6 Change sendcoins dialogue Yes to Send (Gregory Sanders) Pull request description: It's more self-explanatory, matches "cancel" better, and makes future extensions such as bitcoin#16944 more directly understandable to the user. ACKs for top commit: Sjors: Trivial code review ACK a649cc6. I also used Send in bitcoin#16966 (`ui - make send a wizard`) laanwj: ACK a649cc6 jonatack: Code review ACK a649cc6 Tree-SHA512: fe4993bc7ac653d28f3d399ade046bcfd405511aec06ff041bb5aef47e0736faf3e3112a6db660cd761af56392dc6b97f2c2341ed3eff4490079c5eb8a0d465a
a649cc6 Change sendcoins dialogue Yes to Send (Gregory Sanders) Pull request description: It's more self-explanatory, matches "cancel" better, and makes future extensions such as bitcoin#16944 more directly understandable to the user. ACKs for top commit: Sjors: Trivial code review ACK a649cc6. I also used Send in bitcoin#16966 (`ui - make send a wizard`) laanwj: ACK a649cc6 jonatack: Code review ACK a649cc6 Tree-SHA512: fe4993bc7ac653d28f3d399ade046bcfd405511aec06ff041bb5aef47e0736faf3e3112a6db660cd761af56392dc6b97f2c2341ed3eff4490079c5eb8a0d465a
a649cc6 Change sendcoins dialogue Yes to Send (Gregory Sanders) Pull request description: It's more self-explanatory, matches "cancel" better, and makes future extensions such as bitcoin#16944 more directly understandable to the user. ACKs for top commit: Sjors: Trivial code review ACK a649cc6. I also used Send in bitcoin#16966 (`ui - make send a wizard`) laanwj: ACK a649cc6 jonatack: Code review ACK a649cc6 Tree-SHA512: fe4993bc7ac653d28f3d399ade046bcfd405511aec06ff041bb5aef47e0736faf3e3112a6db660cd761af56392dc6b97f2c2341ed3eff4490079c5eb8a0d465a
a649cc6 Change sendcoins dialogue Yes to Send (Gregory Sanders) Pull request description: It's more self-explanatory, matches "cancel" better, and makes future extensions such as bitcoin#16944 more directly understandable to the user. ACKs for top commit: Sjors: Trivial code review ACK a649cc6. I also used Send in bitcoin#16966 (`ui - make send a wizard`) laanwj: ACK a649cc6 jonatack: Code review ACK a649cc6 Tree-SHA512: fe4993bc7ac653d28f3d399ade046bcfd405511aec06ff041bb5aef47e0736faf3e3112a6db660cd761af56392dc6b97f2c2341ed3eff4490079c5eb8a0d465a
For wallets with
WALLET_FLAG_DISABLE_PRIVATE_KEYS
this makes the watch-only balance available on the send screen (including coin selection). Instead of sending a transaction it generates a PSBT.The user can take this PSBT and process it with HWI or put it an SD card for hardware wallets that support that.
The PSBT is copied to the clipboard. This was the easiest approach; we can add a dialog later to display it, as well as an option to save to disk.