Feature: Add SLIP-19 support for safe remote-signing of WabiSabi coinjoins#685
Draft
kravens wants to merge 4 commits into
Draft
Feature: Add SLIP-19 support for safe remote-signing of WabiSabi coinjoins#685kravens wants to merge 4 commits into
kravens wants to merge 4 commits into
Conversation
…or coinjoin remote signing
Taproot key-spend proof: BIP-86 tweak the internal key (libsecp keypair_xonly_tweak_add handles internal even-Y + output parity), then a BIP-340 schnorr signature over the same SLIP-19 digest. Simulator-verified against Wasabi OwnershipProof.VerifyOwnership with an independent NBitcoin BIP-86 derivation. Note: a full taproot coinjoin round also needs taproot PSBT spend-signing, which is EDGE-firmware only.
The stm32 frozen-module manifest lists files explicitly; slip19.py was missing, so real hardware raised ImportError on the first slp9 command (err_Confused at the import in usb.py). The simulator loads shared/ from the filesystem and never hit it. Found on a Mk4 running the dev build.
…ubpath Two issues found testing HSM mode end-to-end in the simulator: - slp9 was never added to HSM_WHITELIST, so HSM mode rejected the command before the slip19_paths policy gate could run. That defeats the whole point: ownership proofs are needed during unattended coinjoin operation. - the handler passed the raw subpath string to approve_slip19, but match_deriv_path requires both sides in canonical hard notation (84h not 84-prime), so every path was denied. Clean it with cleanup_deriv_path first (which also validates junk input). Note: building this tree also requires the ckcc-protocol submodule at its recorded pin (3d1dfa8) — an older checkout lacks PSBT_GLOBAL_GENERIC_SIGNED_MESSAGE in ckcc/constants.py (symlinked as shared/public_constants.py), which breaks the auth/hsm_ux import chain at runtime and crashes the HSM menu.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SLIP-19 ownership proofs for coinjoin remote signing
What
Adds a USB command
slp9that returns a SLIP-19 ownership proof (BIP-322-style) for a given derivationpath + commitment, and an HSM policy field
slip19_pathsgating which paths may be proven while unattended.This is the one primitive a coinjoin coordinator (e.g. Wasabi WabiSabi) needs that no existing Coldcard
command provides: a signature over
SHA256(proofBody ‖ cs(spk) ‖ spk ‖ cs(commitment) ‖ commitment), whichis not a transaction sighash, so PSBT/BIP-322/message-signing cannot produce it.
Changes (3 files, ~84 lines)
shared/slip19.py(new) —make_ownership_proof(subpath, flags, commitment): derives the key,builds the proof body (
magic SL\x00\x19 ‖ flags ‖ varint(count) ‖ 32-byte ownership id), computes thedigest, ECDSA-signs (P2WPKH), and returns the fully serialized proof (proof body ‖ empty scriptSig ‖
witness stack). Taproot (P2TR, BIP-340 keyspend over the same digest) is stubbed — the
nguprimitives(
sign_schnorr,xonly_pubkey_tweak_add, tagged-sha256) are already present.shared/usb.py—slp9command handler mirroringsmsg/xpub: unpacks<III>(flags, len_subpath,len_commitment) + payloads, gates on
hsm_active.approve_slip19(subpath)when in HSM mode, returnsb'biny' + proof.shared/hsm.py—slip19_pathspolicy field (mirrorsmsg_paths), included in policy JSON/text, andapprove_slip19(subpath)(mirrorsapprove_xpub_share).Verified (simulator)
The real
slp9command returns a proof that Wasabi's own verifier accepts — see the consumer testsWalletWasabi.Tests/.../ColdcardProofSpikeTests.cs(OwnershipProof.VerifyOwnershippasses on both thereconstructed proof and the full wire bytes off the
slp9command).Before upstream submission (follow-ups)
sign_schnorr).not bind the id, but should be correct).
xpub; upstream may want an on-deviceconfirmation for interactive use (in HSM the
slip19_pathswhitelist is the gate).testing/test_hsm.pycoverage (whitelisted path signs, non-whitelisted denied) + a docs page.