Skip to content

JoinMarket NG backend for regtest environment#1166

Draft
m0wer wants to merge 10 commits intov2from
v2-jm-ng
Draft

JoinMarket NG backend for regtest environment#1166
m0wer wants to merge 10 commits intov2from
v2-jm-ng

Conversation

@m0wer
Copy link
Copy Markdown
Member

@m0wer m0wer commented Mar 18, 2026

Adds JoinMarket NG as a backend in the regtest setup to test compatibility.

Most functionality working! Tumbler (sweep) does not work here, see #1232.

TODO:

  • Check switch wallet feature.
  • Check rescan from height feature.
  • Expose more configuration options, such as forced 0 fee for bondless toggle.

Dev setup

npm run regtest:rebuild &&  npm run regtest:up &&  npm run regtest:init
npm run regtest:mine &
npm run jm-ng:dev

Wallet password is test.

@m0wer m0wer self-assigned this Mar 18, 2026
@theborakompanioni
Copy link
Copy Markdown
Collaborator

@m0wer Would it be possible to keep the joinmarket-clientserver as well and add jm-ng as an additional instance?

@m0wer
Copy link
Copy Markdown
Member Author

m0wer commented Mar 19, 2026

@m0wer Would it be possible to keep the joinmarket-clientserver as well and add jm-ng as an additional instance?

Sure! That's actually what we have in the compatibility tests in the jm-ng repo (a mix of reference and ng makers and takers).

What would be your preferred setup? Leave the current 3 jm-ref instances and add a jm-ng one? What about the directory server? Anything else?

@theborakompanioni
Copy link
Copy Markdown
Collaborator

theborakompanioni commented Mar 20, 2026

@m0wer Would it be possible to keep the joinmarket-clientserver as well and add jm-ng as an additional instance?

Sure! That's actually what we have in the compatibility tests in the jm-ng repo (a mix of reference and ng makers and takers).

What would be your preferred setup? Leave the current 3 jm-ref instances and add a jm-ng one? What about the directory server? Anything else?

Yeah, maybe just leave the three joinmarket-clientserver instances as is and just add two jm-ng ones. Ideally devs can change the primary backend via env vars and running npm run dev and npm run jm-ng:dev (or similar).
Regarding the directory server: Would also be nice to switch between them via env vars, but if that adds too much complexity, I am fine with running both or replacing it completely (I suppose the old setup works with your new directory server nicely..). What do you think? Any other recommendations?

@theborakompanioni theborakompanioni added v2 Related to the redesigned v2 release devtools Improvements in tooling labels Mar 29, 2026
@m0wer m0wer force-pushed the v2-jm-ng branch 2 times, most recently from 7169df2 to 807c9c5 Compare April 28, 2026 10:50
m0wer added 8 commits April 28, 2026 12:50
Adds jmwalletd, directory servers, makers, and bitcoind to the regtest
docker-compose environment so jam can be developed against the jm-ng
backend end-to-end.
Connects the local regtest containers into a single compose network,
adds tor and fund-wallet helpers, and points Vite's dev proxy at the
local jmwalletd instance.
joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue
didn't cover: 'cj-change' (deanonymising change from our CJ),
'used-empty' (previously-used address with zero balance), and 'flagged'
(address shared in a CJ that later failed). They fell through to the
generic 'default' badge with no distinguishing styling.

Add them to JmPlainTagValue and the status->variant map. 'used-empty'
maps to the existing 'used' variant, 'flagged' to 'reused' (both signal
a used address the user should avoid reusing). Add a dedicated
'cj-change' badge variant (emerald) next to 'cj-out' so the
deanonymising change output is visually distinct from an equal-amount
CJ output.
Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable.

Changelog: Allow direct sends while the maker service is running
Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``.

Changelog: Non-auth 401 responses no longer log the user out.
jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override.

Changelog: Fix WebSocket proxying in the local jm-ng dev setup.
jm-ng `jmwalletd` exposes the HTTPS API and WebSocket on separate TCP
ports (28183 and 28283 by default), not the same port as previously
assumed. Restore:

- the `JMWALLETD_WEBSOCKET_PORT=28283` default in `vite.config.ts`
- the `JMWALLETD_WEBSOCKET_PORT=32283` override in `npm run jm-ng:dev`,
  which matches the regtest container's port mapping

Update the README and developer docs to reflect that both ports must be
set when overriding for a custom jm-ng setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devtools Improvements in tooling v2 Related to the redesigned v2 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants