joinmarket-webui / joinmarket-webui/jam
Explore Payjoin support
- Dominant language
- TypeScript
- Stars
- 330
- Forks
- 122
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 17
Description
Joinmarket comes with built-in [Payjoin](https://bitcoinops.org/en/topics/payjoin/) support. See the [Joinmarket docs on Payjoin](https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/PAYJOIN.md) for more details.
### TL;DR 📖
Payjoins don't work out of the box via the API. It doesn't look impossible to get them working, though. Adding support for making a Payjoin payment should be slightly easier than receiving payments since it looks like there's less moving parts involved. Receiving payments requires spinning up an onion service. Support for making payments would be a good first step.
---
It would be nice for Jam to support Payjoins as well. Roughly speaking, there's two cases to consider:
1️⃣ Making a Payjoin payment
2️⃣ Receiving a Payjoin payment
### Making a Payjoin Payment 💸
This is a [relatively straight forward flow](https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/PAYJOIN.md#doing) already implemented in Joinmarket's [`sendpayment.py` script](https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/scripts/sendpayment.py#L81). The [`taker/direct-send` endpoint](https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/jmclient/jmclient/wallet_rpc.py#L606) doesn't support it yet, though.
Making a Payjoin payment in Joinmarket roughly consists of [parsing the BIP21 URI](https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/scripts/sendpayment.py#L73) and passing control to [the built-in Payjoin manager](https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/scripts/sendpayment.py#L352) instead of broadcasting a regular transaction.
From what it looks we should be able to take the implementation from the `sendpayment.py` script as template and transfer it over to the API endpoint without much hassle—similarly to how we did it for the [Scheduler implementation](https://github.com/JoinMarket-Org/joinmarket-clientserver/pulls?q=is%3Apr+is%3Aclosed+author%3Adnlggr+).
### Receiving a Payjoin Payment 💰
Receiving a payment involves [spinning up an ephemeral onion service](https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/PAYJOIN.md#receiving). The [`receive-payjoin.py` script](https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/scripts/receive-payjoin.py) doesn't look too complicated. Whether we can easily port it to a new RPC-API endpoint remains to be seen, I'd be surprised if it turns out to be super hard, though. After all, the [`maker/start` endpoint](https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/jmclient/jmclient/wallet_rpc.py#L645) does something similar.
Contributor guide
Assessment
This issue has not been assessed yet.