Walletwasabi: Coldcard Signing Issue

Created on 1 Oct 2020  路  14Comments  路  Source: zkSNACKs/WalletWasabi

2 users reported coldcard signing issues:

It seems like Coldcard fails to sign when Wasabi wants to send to a multisig address.

image

I attempted to reproduce it, but I did not succeed (my tx went through: https://blockstream.info/testnet/address/2NFuwoDT7GFu4w6gT62idT2HYGxMW67JzGN)

  • testnet
  • Wasabi 1.1.12.0 (currently released)
  • Coldcard MK1, firmware: 2.1.2 (released in 2019-08-02)

Step 1:

Generate a multisig address. I generated 2NFuwoDT7GFu4w6gT62idT2HYGxMW67JzGN, 2 of 3 address with the following script:

Key bob = new Key();
Key alice = new Key();
Key satoshi = new Key();

var scriptPubKey = PayToMultiSigTemplate
    .Instance
    .GenerateScriptPubKey(2, new[] { bob.PubKey, alice.PubKey, satoshi.PubKey });

Console.WriteLine(scriptPubKey.GetScriptAddress(Network.TestNet));

Step 2:

Open Wasabi, connect Coldcard through USB and send a transaction to the address. It worked for me with no problem: https://blockstream.info/testnet/address/2NFuwoDT7GFu4w6gT62idT2HYGxMW67JzGN

Ask for reproducibility

@bitcoinplebs, @js_farinet: Would you mind trying to send to 2NFuwoDT7GFu4w6gT62idT2HYGxMW67JzGN on the testnet with your Coldcard?

  • If you succeed, then my inability to reproduce it is either the testnet or with the address I generated.
  • If you don't succeed, then my inability to reproduce it is with the Coldcard model or firmware version I use.
debug

Most helpful comment

@imacfan, @benthecarman, the fix is deployed: https://github.com/zkSNACKs/WalletWasabi/releases/tag/v1.1.12.2

Although it's not on the master yet, because I want a nicer, more comprehensive fix: https://github.com/zkSNACKs/WalletWasabi/pull/4608

All 14 comments

So - my testing scenario is:

Environment:

  1. Mainnet
  2. Coldcard MK3 - firmware version - 3.1.9 - Aug 6, 2020
  3. Wasabi - 1.1.12.0 (currently released)

Steps:

  1. Generated a multisig address. I generated 3 of 5 multisig address.
  2. Built the transaction on Wasabi. Exported PSPT
  3. Tried to sign PSBT on Coldcard MK3.
  4. Got Error.

I created same transaction on Specter Wallet.. PSBT was signed by MK3 Coldcard.

I've done further tests. Compared to the above I tried to slowly move closer to your setup:

Test 2

Changes to my original test (Test 1:)

  • Coldcard MK2 (instead of MK1, but still not MK3, I don't have access to that device.)
  • Coldcard Firmware 3.1.9 (instead of 2.1.2, same as yours.)

TX successful: https://blockstream.info/testnet/tx/f858dc14e987f914a152a09c3f835e44d1f92b7635d1dc4d64923cbeec69525b

Test 3

Changes to Test 2:

  • send to 3of5 multisig: 2N7WRZXDjzor9rFf5bAyvQUAKyW9JHchKir (instead of 2of3 multisig, same as yours.)
Key bob = new Key();
Key alice = new Key();
Key satoshi = new Key();
Key istvan = new Key();
Key bela = new Key();

var scriptPubKey = PayToMultiSigTemplate
    .Instance
    .GenerateScriptPubKey(3, new[] { bob.PubKey, alice.PubKey, satoshi.PubKey, istvan.PubKey, bela.PubKey });

Console.WriteLine(scriptPubKey.GetScriptAddress(Network.TestNet));

TX successful: https://blockstream.info/testnet/tx/8dc046e61b89467be59444eea192ddc8661eea1973ee70a8ea706643d6b1d4ba

Test 4:

Changes to Test 3:

  • PSBT workflow (instead of USB workflow, same as yours)

TX successful: https://blockstream.info/testnet/tx/91be42a60fc89124f44fc9fc57015c7a5d5a6022316f919fa28a0d40f0323a65

Test 5:

Changes to Test 4:

  • Switch to mainnet.

TX is successfully signed (won't paste txid here for privacy reasons.)

Conslusion

I could not reproduce this issue. I've done everything the exact same way as @imacfan except I used MK2 instead of MK3 and maybe the key generation was different, but I'm doubt. We'll order Coldcard MK3 so we'll be able to get closer to your setup. In the meantime would you mind generating a Bitcoin address that isn't supposed to work?

From @benthecarman:

Hey I am getting a bug when trying to send to a p2wsh address with my cold card, I get
ERROR   SendControlViewModel (361)  WalletWasabi.Hwi.Exceptions.HwiException: Remote Error: Missing redeem/witness script for output #0
Do you guys know if this is a wasabi bug or cold card?
It happens for air-gapped and non air-gapped

FTR still waiting for MK3-s to arrive. (I also collecteded Specter generated addresses from Stepan, but didn't test yet.)

It looks like wasabi added derivation paths to the p2wsh address I was sending to, however, this address was not apart of any wallet I had in wasabi. Maybe that is the cause of the issue

Received this response from the cold card team

Hi Ben,

Although your intention was to send to an external address, I think Wasabi detected it was really your own address. Because of that, it put the derivation path into that output section of the PSBT (and xfp for that was consistent with the same wallet: ).

But Wasabi didn't put the other items required if it was a change output (ie the redeem script). For the other output it did, so I suppose that one it sees as change back. Typically went sending to an external address the corresponding output section of the PSBT is empty.

Regardless, I see this as a Wasabi issue, not Coldcard. As you might expect, we are very picky about the contents of PSBT files, and want to be very conservative in our interpretation.

Attached is a dump of the original PSBT.

-Coinkite Team

It might be an NBitcoin issue created one there to figure out with the help of @NicolasDorier https://github.com/MetacoSA/NBitcoin/issues/927

@molnard Still getting the same error.

The PSBT generated still has the derivation paths on all the outputs

For testing this is a dummy address I was trying to send to. When sending to it I had a change output

bc1qnynltcr3eanme3szafx2tfcy9zyvkax9uz0wc8g9q83ggcgkcn2qu03h9k

@benthecarman you're right. It's only solved when spending max.

So in conclusion there was no way to hack around this from Wasabi. Anyhow @benthecarman This PR must work, it's with Nicolas's fix: https://github.com/zkSNACKs/WalletWasabi/pull/4608

@nopara73 have you tried with the 5.0.60 of NBitcoin? I fixed the AddKeyPath bug.
If it still fail, there is another problem. As you can see, I added the unit test to reproduce the previous bug.

@NicolasDorier Yes, tested, it works perfectly, thank you!

@imacfan, @benthecarman, the fix is deployed: https://github.com/zkSNACKs/WalletWasabi/releases/tag/v1.1.12.2

Although it's not on the master yet, because I want a nicer, more comprehensive fix: https://github.com/zkSNACKs/WalletWasabi/pull/4608

Was this page helpful?
0 / 5 - 0 ratings