BIP-0322: implement signmsg for p2tr and PSBT-based message signing#1977
Draft
guggero wants to merge 8 commits into
Draft
BIP-0322: implement signmsg for p2tr and PSBT-based message signing#1977guggero wants to merge 8 commits into
guggero wants to merge 8 commits into
Conversation
This is a pure refactor commit. The code to produce a legacy message signature is extracted into its own function.
Allows the tagged hash engine to be re-used outside of the bip341 module.
According to the updated BIP-322 specification, a PSBT packet that is intended for signing a message will contain a new PSBT_IN_GENERIC_SIGNED_MESSAGE (0x21) field on the first input. To carry that value to the signer when signing a BIP-322 PSBT packet, we add a new optional bip322_message field to the BTCSignInitRequest. If that field is set, then the UI will show the sign message dialogs and confirmation screens instead of the transaction signing screens.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BIP-0322 was recently updated to be in status
Complete.With that, one of the big hurdles for signing devices to implement BIP322-based message signing should be gone.
With this PR I'm mostly looking for Concept ACK, the code itself might not be in its final form (I'm not a Rust developer, so I had some agentic help here as might be apparent).
I have tested Taproot address message signing using the
signmsgflow and nested-p2wpkh address message signing using thesigntxflow with the simulator.I will also test a p2wsh multisig setup soon and share the results here.
Code to create bip322 PSBTs for testing can be created with the code here: btcsuite/btcd#2521
There are also some minimal modifications to the
bitbox02-api-golibrary required to get things working through the Go API, let me know if I should share these already.In case it's useful for testing, I've created a web UI for verifying (and debugging) bip322 signature that follow the
v1.0.0updated version of the BIP: https://guggero.github.io/cryptography-toolkit/#!/bip322