WalletWasabi icon indicating copy to clipboard operation
WalletWasabi copied to clipboard

ColdCard device returns the Taproot ExtPubKey while it does not exist on it.

Open Whem opened this issue 2 years ago • 4 comments

General Description

main_issue: #11018

When we connect to the CC in Wasabi and create a new wallet from it, the Taproot ExtPubKey is filled while there is no Taproot account on the device. That means HWI communicates with CC via the provided CC protocol and the device gives back a Taproot ExtPubKey, which we don't know if it's valid because the device doesn't support Taproot.

HWI code path:

https://github.com/bitcoin-core/HWI/blob/8d4fa19551ce1b097bd011ce1e7ce64008a1d87c/hwilib/devices/coldcard.py#L108

I can't find any Tapproot KeyPath on the device. So in that case the ColdCard Firmware makes a bad answer, I think.

And if I export the skeleton file from CC, it doesn't have the TaprootExtPub section.

Skeleton file data:

{"ExtPubKey": "xpub6CbtS57jivMSuzcvp5YZxp6JhUU8YWup2axi2xkQRVHY8w4otp8YkEvfWBHgE5rA2AJYNHquuRoLFFdWeSi1UgVohcUeM7SkE9c8NftRwRJ", "MasterFingerprint": "E5DBC9CB", "ColdCardFirmwareVersion": "4.1.9"}

How To Reproduce?

Version 1

  1. Open WasabiWallet
  2. Click on Add Wallet
  3. Click on Connect to HardwareWallet
  4. Wallet Added to Keymanager
  5. Go to the new CC wallet
  6. Settings -> Info -> Taproot ExtPubKey

Version 2

  1. Open PowerShell
  2. Go to hwi.exe's path
  3. Run with
 .\hwi.exe --device-path "<your_device_path>" --device-type "coldcard" getxpub m/86h/0h/0h

Example: HWI Command:

.\hwi.exe --device-path "\\?\HID#VID_D13E&PID_CC10&MI_00#9&c164067&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}" --device-type "coldcard" getxpub m/86h/0h/0h

HWI response:

{"xpub": "xpub6D6gAmwhFaLnioAGEWu5SUuk6BY8zMYp2PTN42NECcCxwzLtG87hzqthGSiP1smiKsmjjkrSdZRUcKhuTRkxoYTq7LiF2Pz1P2rExQpEUy7"}

Hardware Wallet specification

Model: ColdCard Mk3 Firmware version: 4.1.9

Whem avatar Feb 01 '24 11:02 Whem

Seems like you conflate "key at path" and "script type". Mk3 can provide ANY "key at path" yet it does not understand segwit v1 at all. Although m/86h is BIP convention for v1, nothing prevents you to get key at that path and use p2pkh script type. (that is partially why we descriptor now)

if you're trying to evaluate if COLDCARD at hand supports v1, for now, you need to check if you run edge release (version ending with X). You can get the version over USB by ckcc version. Or you could store some is_edge flag when X is encountered in version parsing from export file, instead of just removing it https://github.com/zkSNACKs/WalletWasabi/commit/9a1b531eb2cdc6ad5543576df7bd5814f912ac0b

edge releases DO NOT export TaprootExtPubKey in JSON as it does not work on Wasabi side yet. I have already opened this issue https://github.com/zkSNACKs/WalletWasabi/issues/12350

scgbckbone avatar Feb 07 '24 11:02 scgbckbone

Unfortunately, at the moment HWI does not return the firmware version number when we enumerate it, we cannot distinguish the CC from its older or latest version, only if it is imported with the Skeleton file, but we can add the CC to KeyManager not only with the skeleton file.

What you write is already a native implementation, which we don't want.

Unfortunately, the current solution is to ignore the Taproot KeyPath when connecting the new Hardware Wallet.

Do you have any suggestions on how we can determine if you have a real Taproot Account?

Whem avatar Feb 12 '24 15:02 Whem

@Whem disable taproot for CC.

lontivero avatar Feb 12 '24 15:02 lontivero

Unfortunately, at the moment HWI does not return the firmware version number when we enumerate it, we cannot distinguish the CC from its older or latest version, only if it is imported with the Skeleton file, but we can add the CC to KeyManager not only with the skeleton file.

What you write is already a native implementation, which we don't want.

Unfortunately, the current solution is to ignore the Taproot KeyPath when connecting the new Hardware Wallet.

Do you have any suggestions on how we can determine if you have a real Taproot Account?

any of my suggestion would require you to have (small) native implementation... But I agree that HWI should provide this info on enumerate. My draft attempt https://github.com/bitcoin-core/HWI/pull/725

scgbckbone avatar Feb 13 '24 20:02 scgbckbone