Skip to content

BIP-0322: implement signmsg for p2tr and PSBT-based message signing#1977

Draft
guggero wants to merge 8 commits into
BitBoxSwiss:masterfrom
guggero:bip-322-taproot
Draft

BIP-0322: implement signmsg for p2tr and PSBT-based message signing#1977
guggero wants to merge 8 commits into
BitBoxSwiss:masterfrom
guggero:bip-322-taproot

Conversation

@guggero
Copy link
Copy Markdown

@guggero guggero commented May 21, 2026

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 signmsg flow and nested-p2wpkh address message signing using the signtx flow 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-go library 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.0 updated version of the BIP: https://guggero.github.io/cryptography-toolkit/#!/bip322

guggero added 8 commits May 21, 2026 13:53
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.
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

Successfully merging this pull request may close these issues.

1 participant