wizardsardine / liana

The missing safety net for your coins
https://wizardsardine.com/liana
BSD 3-Clause "New" or "Revised" License
293 stars 49 forks source link

Coldcard signing device integration #580

Closed darosior closed 5 months ago

darosior commented 11 months ago

Coldcard recently announced experimental Miniscript signing support. This issue is for discussing and tracking the integration of Coldcard with Liana.

matthiasdebernardini commented 6 months ago

From my view, it is the how the api work through https://github.com/alfred-hodler/rust-coldcard library. For my case I was missing a specific flag https://github.com/alfred-hodler/rust-coldcard/pull/9/files

what do you mean from your view? I am using the API right now, it doesn't work how you are describing it (though it would be nice) you have to send it a psbt to sign, if that goes well, then you can ask it for the finalized transaction.

I am not sure which feature flag you are referring to which allows an API to sign and return the transaction in one go, if its there please let me know since I could trim away some code. Thank you.

pythcoiner commented 6 months ago

@scgbckbone, does both mk3/mk4 support miniscript or only mk4? what about limitations?

scgbckbone commented 6 months ago

@scgbckbone, does both mk3/mk4 support miniscript or only mk4? what about limitations?

only Mk4 and only in edge firmware release

miniscript limitations: https://github.com/Coldcard/firmware/blob/edge/docs/miniscript.md#limitations taproot and minitapscript limitations https://github.com/Coldcard/firmware/blob/edge/docs/taproot.md

scgbckbone commented 6 months ago

From my view, it is the how the api work through https://github.com/alfred-hodler/rust-coldcard library. For my case I was missing a specific flag https://github.com/alfred-hodler/rust-coldcard/pull/9/files

what do you mean from your view? I am using the API right now, it doesn't work how you are describing it (though it would be nice) you have to send it a psbt to sign, if that goes well, then you can ask it for the finalized transaction.

I am not sure which feature flag you are referring to which allows an API to sign and return the transaction in one go, if its there please let me know since I could trim away some code. Thank you.

this is misunderstanding and you're right you need 2 steps - what I was describing was cli signing workflow https://github.com/Coldcard/ckcc-protocol/blob/11c711e929a090ec29ccd2a05d094aa3d2cbc113/ckcc/cli.py#L481-L548

pythcoiner commented 6 months ago

rstanding and you're right you need 2 steps - what I was describing was cli signing workflow

is mk3 on roadmap or not planned to support miniscript on it?

darosior commented 6 months ago

@edouardparis mentioned to me this is close to being done. #847 should be testable by anyone with a coldcard soon!

pythcoiner commented 6 months ago

@scgbckbone currently doing a round of test on #847, while verifying address on CC, if i want to Press (4) to view QR Code on the coldcard, it crash:

image

I had to restart the CC to go back normal

scgbckbone commented 6 months ago

great find @pythcoiner! thank you. Patch here https://github.com/Coldcard/firmware/pull/317

pythcoiner commented 5 months ago

@scgbckbone is it normal that CC follow the normal miniscript flow even if the wallet 'allias' used for registration and the one use on psbt sign does not match, by example using async-hwi cli tool:

scgbckbone commented 5 months ago

There is currently no way to specify target wallet name for signing on CC back-end. It is always chosen automatically trying to match PSBT to some registered wallet.

Looking at async-hwi CC PR it seems to me your name flag is just ignored. Coldcard.sign_tx only takes PSBT as argument.

There is currently no way to specify target wallet name for signing on CC back-end

I'm planning to add this in the next iteration. Can be really useful if you have two policies where only order of keys is different (keys are the same just policy is different). But we do not have (yet) policy or descriptor in PSBT - meaning that our tx to registered wallet matching can fail in those situation.

pythcoiner commented 5 months ago

ok, so it means, we (now) just send psbt and CC just iterate trough the 'wallet' list to check if one matching?

scgbckbone commented 5 months ago

yes

pythcoiner commented 5 months ago

@scgbckbone, does the CC HSM mode functionning w/ miniscript wallets?

scgbckbone commented 5 months ago

@scgbckbone, does the CC HSM mode functionning w/ miniscript wallets?

yes

edouardparis commented 5 months ago

847 is merged, it relies on https://github.com/wizardsardine/async-hwi/ master which relies on this current branch of rust-coldcard https://github.com/alfred-hodler/rust-coldcard/pull/11

We will update later with proper crates versions when crates are published.

Thank you all for contributing !

kloaec commented 5 months ago

Congratulations everyone :) @scgbckbone do you have an ETA for publishing the corresponding firmware publicly? Happy to announce it with you in any way or form.

scgbckbone commented 5 months ago

thanks guys!

We're "almost ready", just need to do the pre-release dance, I hope it'll be out this week... Keep you posted

scgbckbone commented 5 months ago

it is out folks https://coldcard.com/downloads/2024-01-18T1507-v6.2.2X-mk4-coldcard.dfu

scgbckbone commented 5 months ago

I tested liana master - no issues found. UX is very smooth, like it a lot

kloaec commented 4 months ago

Hello @scgbckbone and @edouardparis , finally received a Coldcard Q, i upgraded to 0.0.6Q. After adding the udev, i can get the xpub no problem, but i cannot register the descriptor. It briefly shows "receiving" or something on the screen, but then goes back to the menu and i get an error on Liana. "Decoding(Protocol("Unknown cmd")).

Might be that the Q doesn't have Miniscript support yet? Or do we need to change something in our async-hwi?

darosior commented 4 months ago

i upgraded to 0.0.6Q.

Is this the Edge firmware?

kloaec commented 4 months ago

All versions are Beta for Q, no Edge releases.

scgbckbone commented 4 months ago

We currently do not have edge Q - so no miniscript/tr support in there - soon TM