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

[Feature Request] Preview of Every Input's Hash-Preimage in the Transaction Finalization Screen #1574

Open
SalvaZaraes opened this issue Dec 30, 2024 · 7 comments

Comments

@SalvaZaraes
Copy link

In the screen where transaction details are finalized (e.g., RBF, LockTime, Version; before signing), it would be a fantastic addition to include a preview of each input's hash-preimage that will be signed.

For users like me who are interested in the technical aspects of Bitcoin, this feature would provide valuable insight and enhance the debugging capabilities of the wallet (also educational ones). It could also serve as a great tool for verifying the exact data being signed, adding another layer of transparency for advanced users.

@craigraw
Copy link
Collaborator

Can you be more specific about what you mean by the "input's hash-preimage"?

@SalvaZaraes
Copy link
Author

Of course!

When the transaction it's going to be signed, there are different preimages for each input.

For example, in a 2 input transaction with the SigHash flag ´ALL´, the preimage for the first input would set the ScriptPubKey of the second input to 0x00 and vice versa.

Right now, the "preimage" that Sparrow shows before signing is not the real preimage that it is going to be signed by each input's private key. So, in order to improve the debugging capabilities, it would be helpful to show the exact data that it is going to be signed for every input.

For instance, the following 3input-2output (SigHash SINGLE) tx:

Before signing Sparrow shows the following "preimage":

0100000003d38e64afa39dd966f96e07bf56ae44bc3d402630771480f461389edff8a0051e0100000000ffffffff11ac3e436400735e8edc830a37f60fcab2098c871d6687c08507afe5168d110e0000000000ffffffff11ac3e436400735e8edc830a37f60fcab2098c871d6687c08507afe5168d110e0100000000ffffffff0258980000000000001976a914487b2cf05b1dc2b50c3c3019e578be45c29d03ff88ac58980000000000001976a914d80f48340dd7ee6c7fae287342d3eeb1d4d887e288ac00000000

However, in reality, the preimage for input 1 is:

0100000003d38e64afa39dd966f96e07bf56ae44bc3d402630771480f461389edff8a0051e010000001976a914ac2129222b94c90222c18c1f1a52b4139643d2f088acffffffff11ac3e436400735e8edc830a37f60fcab2098c871d6687c08507afe5168d110e00000000000000000011ac3e436400735e8edc830a37f60fcab2098c871d6687c08507afe5168d110e0100000000000000000158980000000000001976a914487b2cf05b1dc2b50c3c3019e578be45c29d03ff88ac0000000003000000

For input 2:

0100000003d38e64afa39dd966f96e07bf56ae44bc3d402630771480f461389edff8a0051e01000000000000000011ac3e436400735e8edc830a37f60fcab2098c871d6687c08507afe5168d110e000000001976a914c103e57c094061209b419e5ca559704a8a22f3f988acffffffff11ac3e436400735e8edc830a37f60fcab2098c871d6687c08507afe5168d110e01000000000000000002ffffffffffffffff0058980000000000001976a914d80f48340dd7ee6c7fae287342d3eeb1d4d887e288ac0000000003000000

And for input 3:

452312848583266388373324160190187140051835877600158453279131187530910662656

@craigraw
Copy link
Collaborator

I appreciate the desire for this data, but I don't see a good way to present it in the transaction finalisation screen that doesn't overwhelm the user.

@SalvaZaraes
Copy link
Author

SalvaZaraes commented Jan 15, 2025

How about adding a button in this menu? (the one that pops-up when you click the transaction before signing)

[Mockup of the button]

image

As I see it, this button could merge very well with the rest of the UI.

Then a Text window could pop-up showing the hash-preimage for each input.

[Mockup of the pop-up window]

image2

It could also be added in this window a disclaimer saying "These are the pieces of information that are going to be signed in order to construct the final transaction."

@craigraw
Copy link
Collaborator

I appreciate the effort to put it out the way :) But each pre-image needs to be copyable, therefore ideally in a separate textfield. And I dislike popups on top of popups.

Ideally, this idea should have more support as well - every addition to the wallet comes with a maintenance cost, and in this case, a UI complexity cost as well.

@SalvaZaraes
Copy link
Author

How about placing the text field of the Preimage in each input's detailed menu? Adding the textfield in the botton of the menu, right below "Status".

[Mockup]

Image

As in the text field of the transaction, a scroll wheel would be necessary if the Preimage is too large and does not fit entirely in the text field.

Even though is not finally added, thanks for taking this feature into account. And thanks for your hard work!

@craigraw
Copy link
Collaborator

How about placing the text field of the Preimage in each input's detailed menu?

I've considered that (it would be the best place), but that screen is already quite tall - the application has a minimum height parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants