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 · 2 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

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