# joinstr v2

joinstr v2 is a proof of concept for coinjoin pools built from MuSig2 and pre-signed transactions.

Peers still find each other on nostr. Instead of one transaction with equal outputs, they fund a single taproot output that they own together with MuSig2. Before anyone signs the funding transaction, they all sign the transactions that pay every peer out of it.

- Each exit has one input and two outputs and is spent with a single key path signature, so on chain it looks like an ordinary taproot payment with change.
- The amount of a payout depends only on its denomination and its place in the chain, never on whose it is.
- Ring signatures hide from the other peers which payout belongs to which coin. They also stop anyone from adding payouts that nobody paid for, so a pool cannot be blocked that way.
- Funding inputs are signed with `SIGHASH_ALL`, not `ANYONECANPAY`, because the pre-signed exits commit to the funding transaction id.

## Pool types

- A **chain**, where peers leave one after the other in a fixed order.
- **Any order**, where a pool of 3 to 7 peers signs an exit for every order in which its peers may leave, so each peer can leave alone whenever it wants.
- A **tree** of exits for larger pools.
- Exits that pay several peers at once, earlier exits that pay a higher fee rate, P2A anchors for fee bumping and several denominations in one pool.

Five pools ran on signet, from 5 to 100 peers. The [signet demo](https://gitlab.com/1440000bytes/joinstr-v2/-/blob/main/docs/signet-demo.md) links every transaction and lists every pre-signed transaction in full.

## Links

- [gitlab.com/1440000bytes/joinstr-v2](https://gitlab.com/1440000bytes/joinstr-v2) has the source and the specification.
- [docs/design.md](https://gitlab.com/1440000bytes/joinstr-v2/-/blob/main/docs/design.md) explains the design step by step.
- The [playground](https://1440000bytes.gitlab.io/joinstr-v2-playground/) simulates pools in the browser, with no node or coins needed. It can replay the signet pools or build new ones and shows what each party sees.
