sparrowwallet / sparrow

Desktop Bitcoin Wallet focused on security and privacy. Free and open source.
https://sparrowwallet.com/
Apache License 2.0
1.28k stars 185 forks source link

Enable offline signing with USB hardware wallets using QR codes #1495

Closed sweetverbena closed 17 hours ago

sweetverbena commented 1 week ago

I have been testing the following and noticed that QR codes could not be used for offline signing transactions, whereas passing .psbt and .txn files back and forth worked fine:

1) Import hardware wallet onto airgapped computer via USB 2) Export the xpub etc. from airgapped computer 3) Import xpub onto online computer 4) Setup a transaction using online computer, save the QR code 5) Transfer QR code to airgapped computer and try to sign via USB 6) Observe com.sparrowwallet.sparrow.io.SignTransactionException: Previous transaction <redacted> not available in sparrow.log, and a similar message about missing transaction in the UI.

Then I tried

1) Export a .psbt for the transaction from the online computer 2) Transfer and load the .psbt on the offline computer, try to sign via USB 3) Success!

What is the difference between the QR and .psbt here? It doesn't seem like the data size is a limitation in this case as the psbt was only 407B.

Would it be possible to have this work for QRs as well?

Thank you, please let me know if clarification is needed.

craigraw commented 1 week ago

The hardware wallet is complaining that it needs the previous transaction in the PSBT to sign (the transaction(s) that create the inputs you are spending). It's unclear exactly why this is the case - something related to step 4 where you create the PSBT. See #1480 for a similar issue.

craigraw commented 17 hours ago

Closing as user support issue.