Skip to content

feat(coinjoin): add SLIP-19 ownership proofs#903

Open
PMK wants to merge 8 commits into
selfcustody:developfrom
PMK:feat/slip-19-coinjoin
Open

feat(coinjoin): add SLIP-19 ownership proofs#903
PMK wants to merge 8 commits into
selfcustody:developfrom
PMK:feat/slip-19-coinjoin

Conversation

@PMK

@PMK PMK commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What is this PR for?

Implement firmware-side SLIP-19 support for CoinJoin flows:

  • Add SLIP-21 ownership key derivation and SLIP-19 proof generation
  • Support P2WPKH and BIP-86 tweaked P2TR proof signing
  • Add policy-gated CoinJoin PSBT signing with self-transfer checks
  • Add disabled-by-default CoinJoin security settings
  • Add focused SLIP-19 and CoinJoin PSBT tests
  • Add CoinJoin feature documentation
  • Add translation entries for new CoinJoin settings

See this documentation for more info about CoinJoin.

Fixes #709

Changes made to:

  • Code
  • Tests
  • Docs
  • CHANGELOG

Did you build the code and tested on device?

  • Yes, build and tested on M5StickV
  • Yes, build and tested on WonderMV

What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Docs update
  • Other

krux-coinjoin

With thanks to @kravens

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.44%. Comparing base (1b311fa) to head (1a1599d).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #903      +/-   ##
===========================================
+ Coverage    97.39%   97.44%   +0.05%     
===========================================
  Files           83       84       +1     
  Lines        10845    11078     +233     
===========================================
+ Hits         10562    10795     +233     
  Misses         283      283              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@PMK PMK marked this pull request as draft July 11, 2026 23:55
@PMK PMK marked this pull request as ready for review July 12, 2026 00:32
@PMK PMK changed the base branch from main to develop July 12, 2026 00:35
@PMK PMK force-pushed the feat/slip-19-coinjoin branch from b853125 to 2b5d27a Compare July 12, 2026 09:46
@PMK PMK marked this pull request as draft July 12, 2026 09:47
PMK added 6 commits July 12, 2026 12:16
Implement firmware-side SLIP-19 support for CoinJoin flows:

- Add SLIP-21 ownership key derivation and SLIP-19 proof generation
- Support P2WPKH and BIP-86 tweaked P2TR proof signing
- Add policy-gated CoinJoin PSBT signing with self-transfer checks
- Add disabled-by-default CoinJoin security settings
- Add focused SLIP-19 and CoinJoin PSBT tests
- Add CoinJoin feature documentation
- Add translation entries for new CoinJoin settings
- normal PSBT uses signer.sign
- CoinJoin PSBT uses signer.sign_coinjoin
@PMK PMK force-pushed the feat/slip-19-coinjoin branch from 2b5d27a to 4bf4598 Compare July 12, 2026 10:30
@PMK PMK marked this pull request as ready for review July 12, 2026 10:35
@PMK

PMK commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author
5951773866017361709 5951773866017361717

Left: the menu where the option to sign a CoinJoin transaction appears when the CoinJoin is set to enabled in the settings.
Right: when the policy is incorrect with your values it shows this message.

PMK added 2 commits July 12, 2026 15:55
Only show the CoinJoin PSBT signing option when CoinJoin is enabled in
security settings. Add a focused menu visibility test for enabled and
disabled states.
@qlrd

qlrd commented Jul 12, 2026

Copy link
Copy Markdown
Member

Thxs for contribution @PMK. I will need to read SLIP-19/SLIP-21 (and their suposed SLIP*) and will be a nice learn so i could review.

Please correct-me if i made a conceptual error here, but from what i rememeber coinjoin needs PSBTv2 (being done on embit), this is another way to do coinjoin?

But since it's a SLIP*, it have a good acceptance on a hardware wallet. Let's wait others review too :)

Since the concept of coinjoin is not an air-gap workflow AFAIK, but it's a neat new workflow. So IMO would be nice to have a issue linked to this PR, since it's a new feature.

@qlrd

qlrd commented Jul 12, 2026

Copy link
Copy Markdown
Member

5951773866017361709 5951773866017361717

Don' get the figures, they show some unexpected error or something else?

@kravens

kravens commented Jul 12, 2026

Copy link
Copy Markdown

This is the first step to supporting remote-signing of coinjoin transactions, sadly a pure airgapped solution would disrupt rounds more than be helpful. So I'm working on the next step, a fork that allows limited communication over USB, so that we can do unattended auto-signing based on pre-approved spending policy (a bit like a HSM). Old Trezor firmware still does this, which I revived recently: https://github.com/kravens/WalletWasabi/tree/feature/trezor-coinjoin but I'd like to have cheaper self-built solutions too (where Krux is a great starting point). This probably deviates from the philosophy of not shipping any USB comm code with the firmware, let us know what you think!

@PMK

PMK commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

5951773866017361709 5951773866017361717

Don' get the figures, they show some unexpected error or something else?

From the created documentation:

A CoinJoin flow usually has these steps:

  1. Your wallet asks Krux to prove that it controls the coins being registered.
  2. The coordinator builds a round with inputs and outputs from several people.
  3. Your wallet sends the CoinJoin PSBT to Krux.
  4. Krux checks the transaction against your CoinJoin policy.
  5. Krux signs only if the transaction stays inside your limits.

You can personalize the policy with:

  • Max fee rate sat/vB: the highest effective fee rate Krux allows for your own registered inputs. The default is 5 sat/vB.
  • Max rounds: the maximum number of CoinJoin rounds your setup may run before asking you to approve again. The default is 210.
  • Min self-transfer %: the minimum share of your own input value that must return to your own wallet. Higher values are stricter. The default is 95%.

If any step goes outside these limits, Krux refuses to sign.

The second screenshot is that it failed to sign. I indeed had to put a caption below it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants