use psbtv0 for bip322 psbt qr and file exports
What changed, and why it matters
This commit changes how Sparrow Wallet exports BIP-322 message-signing PSBTs (Partially Signed Bitcoin Transactions) to QR codes and files. Instead of serializing the PSBT in whatever internal version it was created, it now explicitly requests a PSBT version 0 format for export. This is likely a compatibility fix to ensure other wallets and tools can read the exported PSBT correctly.
No immediate action required. Treat as a compatibility/interoperability improvement. If a security advisory is later published, re-evaluate.
Security signals we found
Change in serialization format for externally shared data
BIP-322 PSBT used as signature proof container
Potential interoperability issue if exported PSBT version is unsupported by signers/scanners
Evidence from the diff
In MessageSignDialog.java, two call sites that previously invoked psbt.serialize() for BIP-322 PSBT exports now call psbt.getForExport().serialize(). The getForExport() helper appears to force PSBT version 0 serialization. BIP-322 message signing uses a PSBT as a container for a signature proof; some hardware wallets or external signers may only support PSBT v0, so exporting in v0 improves interoperability and avoids parsing failures on the receiving side.
Changed components
src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.javaBIP-322 message signing QR exportBIP-322 message signing file exportInspect captured patch +2 / −2
diff --git a/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java
index e4c14d5..3a6864e 100644
--- a/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java
+++ b/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java
@@ -505,7 +505,7 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
PSBT psbt = Bip322.getBip322Psbt(scriptType, walletNode.getAddress(), message.getText().trim());
addBip322DerivationInfo(psbt, signingWallet);
- byte[] psbtBytes = psbt.serialize();
+ byte[] psbtBytes = psbt.getForExport().serialize();
CryptoPSBT cryptoPSBT = new CryptoPSBT(psbtBytes);
BBQR bbqr = new BBQR(BBQRType.PSBT, psbtBytes);
QRDisplayDialog qrDisplayDialog = new QRDisplayDialog(cryptoPSBT.toUR(), bbqr, false, true, QREncoding.UR);
@@ -613,7 +613,7 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
File file = fileChooser.showSaveDialog(window);
if(file != null) {
try(OutputStream os = new FileOutputStream(file)) {
- os.write(psbt.serialize());
+ os.write(psbt.getForExport().serialize());
} catch(IOException e) {
log.error("Error saving BIP-322 PSBT", e);
AppServices.showErrorDialog("Error saving PSBT", "Cannot write to " + file.getAbsolutePath());
Why this scored 29/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.