research / cashfusion

topic 02 · the BCH implementation · survey + our research

CashFusion

CoinJoin on Bitcoin Cash — a measured adoption history, and our coordinator-free variant.

CashFusion is Bitcoin Cash's CoinJoin-style mixing tool. Its distinguishing fact is measured adoption: a widely-cited 2022 forum analysis reports that 94% of all BCH transacted since July 2020 descends from a CashFusion transaction. This page covers the classic protocol and the coordinator-free variant we built and measured over Nostr.

live on BCHsurvey — third-party workour research · G1–G3L

on this page

Eleven sections, one record.

01 · the protocol

What CashFusion is

live on BCHCoinJoin-style

CashFusion is Bitcoin Cash's CoinJoin-style mixing tool. A round takes inputs from multiple participants and returns outputs to the same participants, breaking the direct input→output link that chain analysis relies on. The classic implementation uses an external coordinator server and Tor covert channels; the coordinator is blinded to the input→output mapping but sees the round [cited · P2P-FUSION-DESIGN.md §1].

It is not a shielded pool. Amounts and the transaction graph remain public; what changes is the link between your inputs and your outputs. Amount privacy is the shielded pool's job — see /research/shielded-pool[cited · P2P-FUSION-DESIGN.md §1 non-goals].

The implementation is live on BCH, with a measured adoption history and an active red-team discussion. The next section covers that record.

02 · the record

The adoption record

The 94% figure is the reason this protocol matters: a larger set is what makes a mix meaningful. We cite the analysis; we do not own it.

[cited · third-party analysis] — the 94% adoption figure comes from a 2022 Bitcoin Cash Research analysis, linked below. The work is also under active scrutiny: a standing red-team discussion on the research forum, ongoing UX/tech improvement threads, and a public fusion-statistics dashboard.

We survey and link this work — it belongs to its authors. Our contribution is the coordinator-free fusion research on this page, and the shielded-pool layer above it.

03 · the premise

Remove the coordinator

A classic CashFusion client already ships with the project, but it depends on an external coordinator server. This research removes the server: peers self-elect a coordinator per round, and every message is end-to-end gift-wrapped before it reaches a relay.

dimensionclassic CashFusion (in app)P2P over Nostr (this research)
coordinatorexternal server, trusted for round integritynone — peers self-elect per round
transportTor covert channels to the serverNostr relays, end-to-end gift-wrapped messages
output blindingserver-side blindnessonion mix-net through all peers
backendnonenone — matches the app's no-backend identity

[measured · P2P-FUSION-DESIGN.md §1, file inspected 2026-11-20]

The design is a clean-room specification informed by the public 00-Protocol description. Both upstream repositories have no LICENSE file (all rights reserved), so we read and cite them — we do not copy code.

Non-goals v1: replacing the existing CashFusion client; hiding amounts (that is the shielded pool's job); stealth outputs (upstream disabled theirs — if (false && keys.stealthSpendPub)[cited · P2P-FUSION-DESIGN.md §1]).

04 · the shape

Everything is peer-side

The browser runs the round. Relays carry ciphertext and timing metadata; chain access reuses the existing Electrum proxy. No new server code.

┌─────────────────────────── browser ─────────────────────────────────────┐
│                                                                         │
│  fusion UI (not built)                                                  │
│        │                                                                │
│        ▼                                                                │
│  stores/p2pfusion/round.ts ── six-phase state machine                   │
│        │            │                 │                                 │
│        ▼            ▼                 ▼                                 │
│  relay.ts      txbuild.ts        giftwrap.ts                            │
│  Nostr WS      BCH tx +          NIP-59 seal/rumor                      │
│  pool          BCH Schnorr       + NIP-44 layer crypto                  │
│        │                              │                                 │
│        ▼                              ▼                                 │
│  Nostr relays (untrusted)        web/server/api/electrum.post.ts        │
│  ciphertext + timing             (existing JSON-RPC proxy)              │
└────────┼──────────────────────────────────┼─────────────────────────────┘
         ▼                                  ▼
   public relays                     Electrum / Fulcrum
                                     (chain data + broadcast)

round.ts

Six-phase state machine, election, blame/timeout, onion collection and signature assembly. 522 lines.

relay.ts

Nostr WebSocket pool: connect, rotate, dedupe, resubscribe, per-connection outbox, 80 ms publish pacing. 200 lines.

giftwrap.ts + nip44.ts

NIP-59 seal (kind 13) inside a kind-1059 gift wrap, with NIP-44 v2 layer encryption and ephemeral identities. 119 + 136 lines.

txbuild.ts

Transaction serialization, BIP143 sighash, P2PKH signing and BCH Schnorr sign/verify. 246 lines.

onion.ts

Layered output wrapping and peeling for the mix-net, with order rejection at the receiver. 72 lines.

cashaddr.ts + identity.ts

Token-aware CashAddr decoding and per-round ephemeral secp256k1 identities. 102 + 86 lines.

[measured · wc -l web/stores/p2pfusion/*.ts, 2026-11-20]

05 · the protocol

Six phases, one round

The design follows the upstream six-phase structure. The harness maps it to the wire as inputs → onion → outputs → tx → sign → broadcast.

01design

Announce

A peer publishes an ephemeral pubkey to a pool event (kind 22230 in the design). The harness currently starts from an explicit peer list — live pool discovery is not built yet.

02implemented

Election

Peers sort ephemeral pubkeys; the lowest becomes the round coordinator. There is no server — the coordinator is just the first peer in a deterministic order.

03implemented

Registration

Each peer sends its inputs {txid, vout, value} and output count as a NIP-59 gift wrap. The coordinator collects them for the round.

04implemented

Mixnet

Each peer onion-wraps its outputs through every peer in sorted order. Each hop peels one layer and shuffles; the last peer publishes the plaintext output set.

05implemented

Assembly + verify

The coordinator orders inputs and outputs. Every peer checks its outputs are present, no inflation (sumOut ≤ sumIn), and fee ≤ estBytes × 5 sat/B before signing only its own inputs.

06implemented

Broadcast

The coordinator assembles the fully signed transaction and broadcasts it. Any peer may also broadcast as a redundant relay — a proposed delta over the upstream design.

[measured · P2P-FUSION-DESIGN.md §4 + web/stores/p2pfusion/round.ts]

Run the interactive roundsimulation · no broadcast
constantvaluerationale
MIN_PARTICIPANTS5a 2-party round has near-zero mapping entropy; 5 is our floor
inputs per peer1–5, ≥546 sats, randomparity with upstream
outputs per peer2–4, random split, no change outputno-change kills the biggest re-link
fee modelper-peer nIn·148 + nOut·34 + ceil(10/peers)parity with upstream
phase timeout60 s + blameparity with upstream
token UTXOsexcluded from inputs v1plain P2PKH only in v1
broadcast path/api/electrum proxy + psf broadcast fallbackboth paths already exist and are verified

[proposed · P2P-FUSION-DESIGN.md §4 constants; upstream parity marked in the design doc]

P1        P2        P3(coordinator)   relays/chain
│ announce │                │              │
│─────────┼───────────────►│              │   kind 22230
│         │ announce       │              │
│         │───────────────►│              │
│  [lowest ephemeral pub = coordinator]   │
│◄────────┼────────────────┤ round_start  │   gift-wrap
│ inputs  │     inputs     │              │
│─────────┼───────────────►│              │   gift-wrap
│ onion(myOut) ── peel ── peel ── publish │   onion net
│◄────────┼─────── outputs set ───────────│
│ verify+sign own inputs                  │
│─────────┼───── signatures ──────────────│
│         broadcast assembled tx ─────────►│ chain

[design · P2P-FUSION-DESIGN.md §4 sequence diagram]

06 · the evidence

Measured gate by gate

Every number below comes from a reproducible harness in web/tests/. Only G2b touched the chain; the other gate transactions are dry-runs and are labelled as such.

G1passed

Relay + crypto roundtrip

  • 4/4 checks: NIP-44 v2 roundtrip + tamper reject; NIP-59 wrap/unwrap + outsider reject; 3-hop onion wrap/peel + order reject; live relay gift-wrap roundtrip.
  • Live relays: wss://relay.damus.io and wss://nos.lol (1/2 connected); delivery confirmed. The subscription window must cover NIP-59's 2-day created_at backdating.
G2apassed

Two-party round, dry-run

  • 3/3 deterministic runs; 4 inputs / 4 outputs; 4/4 BIP143 + BCH-Schnorr signatures independently verified; fee 3,000 sats; estimated size 738 B.
  • Transport: in-process NIP-01 relay fixture — deterministic by design. Live relays are covered by G1 and G3L.
G2bon chain

Real chipnet broadcast

  • Funding tx 253 B accepted; round tx 2 inputs / 4 outputs, 428 B, fee 2,000 sats ≈ 4.7 sat/B — accepted by the network and visible via Electrum.
  • This is the only gate in the set with real chain transactions; G3 and G3L are dry-runs with fixture UTXOs.
G3passed

N-party round (5 default, 7 tested)

  • 5-party: 10 inputs / 10 outputs, 1,760 B, fee 5,000 sats, 10/10 signatures independently verified.
  • 7-party: 14/14 signatures verified; the 2-party regression re-passed. Transport: local relay fixture.

harness txid · dry-run (not broadcast)

c23b441c65f0ff8e15198891944454284d63fd1e339a30326d30390012a0d19f

a91b695a…edd81 (7-party, truncated in the design record)

G3Lpassed

Same round over live public relays

  • 5-party full round over wss://relay.primal.net, wss://nostr.mom and wss://offchain.pub: 10/10 signatures verified.
  • A repeat run also passed. The round is still a dry-run — live relays, fixture UTXOs, no broadcast.

harness txid · dry-run (not broadcast)

13bc75cecaf0c6f845f8a6e6074c8b6f43909670c85f304b9f413d5989f70f0d

20d0c9b90571dd2ae11cd3a8d4de3219d02398c18aa42cc8a61f6bd52d8b9b6d

G4pending

Mainnet opt-in beta

  • Criterion: mainnet opt-in beta behind a settings flag.
  • Not built: no production fusion UI exists. The protocol modules and gate harnesses are in-repo; the production UI is the remaining step.

[measured · P2P-FUSION-DESIGN.md §5, runs 2026-11-20; chain links → Selene, network=chipnet]

07 · the lessons

What the gates taught us

The expensive findings are the point of publishing the research. These are the defects the harness found — and the fixes that made the round pass.

the expensive one

BCH Schnorr is not final BIP-340

The first real broadcast was rejected with NULLFAIL. The sighash and serializer matched libauth byte-for-byte; the signature was the problem. BCH's 2019 Schnorr is the BIP-340 draft, not the final BIP-340:

e = SHA256(r ‖ compressed_pubkey33 ‖ m)     // no BIP-0340 tag prefixes
R must be normalized to the QR Y root        // Jacobi symbol 1, not even-Y

Noble's schnorr produces final BIP-340 signatures, which the BCH VM rejects. txbuild.ts now implements bchSchnorrSign / bchSchnorrVerify per the 2019 spec; the signed tx passes libauth's BCH VM (error: none, stack: ['01']) and the network accepts it.

[measured · P2P-FUSION-DESIGN.md §5c; spec: bitcoincashorg/bitcoincash.org/2019-05-15-schnorr.md]

the expensive one

BCH Schnorr is not final BIP-340

BCH's 2019 Schnorr is the BIP-340 draft: the challenge is e = SHA256(r ‖ compressed_pubkey33 ‖ m) with no BIP-0340 tag prefixes, and R must be normalized to the quadratic-residue Y root (Jacobi symbol 1), not the even-Y root. Noble's schnorr produces final BIP-340 signatures — the BCH VM rejected them with NULLFAIL.

scriptCode

y-parity is per input

The P2PKH scriptCode must be derived from each input's own private key. Forcing an 02 prefix onto an x-only pubkey produced a second rejection — OP_EQUALVERIFY. The fix is per-input key material, not a shared x-only key.

relay behavior

Public relays do not echo

A relay does not send an event back to the connection that published it. With one shared socket for all peers, peers never receive each other's messages on real relays. The fix is one connection per peer — also the honest wallet model.

rate limits

Free relays throttle bursts

Observed verbatim: damus “banned: too many rate-limit violations, try again later”; nos.lol “rate-limited: slow down matey”. A 5-party round emits ~100+ gift wraps, so publishing is paced at one event per 80 ms per connection.

lossy relays

Origin retries + dedupe

Only forwarded onion layers were re-sent at first, so a dropped first hop stalled the round. All outbound layers are now re-sent while the onion phase is active, with hash-based dedupe at the receiver.

open gap

NIP-42 AUTH is not implemented

damus now advertises NIP-42 AUTH. The NIP-59 spec recommends supporting it; the current relay pool does not authenticate. This is tracked as an open item, not a solved one.

[measured · P2P-FUSION-DESIGN.md §5b–§5e, defect logs from the 2026-11-20 runs]

defect log · what broke before it passed

G2a — the dry-run

  • The first peeler never peeled its own onions; a unified processOnionLayer() fixed it.
  • The coordinator dropped outputs while still in the onion phase; it now accepts the set from the last peeler.
  • A participant dropped tx in the outputs phase; the phase gate now allows it.
  • Self was counted twice in expectedOnions; the round waited forever for onions that do not exist.
  • publish() silently dropped events before the socket opened; a per-relay outbox flushes on connect.
  • Messages arriving before their phase were lost; a per-phase pending queue flushes on phase entry.
  • The relay fixture overwrote subscriptions per connection; NIP-01 semantics now allow many subs keyed by subId.
  • Schnorr self-verify passed a 33-byte key; BIP-340 wants x-only (32).
  • NIP-44 padding must allocate prefix + calc_padded_len(L) bytes; powers-of-two plaintexts overflowed by the 2-byte prefix.

G2b / G3 / G3L — the chain and the relays

  • G2b: BCH Schnorr ≠ final BIP-340 — NULLFAIL on the first broadcast.
  • G2b: P2PKH scriptCode must use each input's own private key — a forced 02 prefix produced OP_EQUALVERIFY.
  • G3: intermediate peelers never left the onion phase; the outputs message now advances every peer.
  • G3L: relays do not echo to the publishing connection; one connection per peer is the fix.
  • G3L: free relays rate-limit bursts; publishing is paced at one event per 80 ms per connection.
  • G3L: relay selection matters — primal, nostr.mom and offchain.pub delivered; nostr.band and nostr.bg did not connect.
  • G3L: origin-side onion retries were missing; all outbound layers are re-sent while the onion phase is active, with hash dedupe at the receiver.

[measured · P2P-FUSION-DESIGN.md §5b–§5e]

08 · the boundary

What holds, what does not

What holds

  • A malicious coordinator cannot steal: it never holds signatures for inputs it does not own, and every peer verifies its outputs and the fee before signing.
  • A malicious last peeler learns the plaintext output set — which is public in the transaction anyway; it cannot map outputs to owners.
  • The round is peer-side: no new server code, and relays see NIP-59 gift wraps rather than plaintext round messages.
  • Chain access reuses the existing Electrum proxy cluster; the wallet keeps its own keys.
  • Relay rotation and multiple simultaneous rounds are the design response to relay-level DoS and eclipse attempts.

What does not (yet)

  • The 5-participant floor is a design constant, not enforced in round.ts; the harness tested 5 and 7.
  • Token UTXOs are excluded in v1 — plain P2PKH only.
  • Amounts remain public on chain. Amount privacy is the shielded pool's job, not this layer's.
  • Stealth outputs are disabled upstream (if (false && keys.stealthSpendPub)) — not part of this round.
  • NIP-42 AUTH is not implemented; damus advertises it. Live pool discovery (kind 22230) is design-only.

[measured · P2P-FUSION-DESIGN.md §1, §4 security analysis, §6; round.ts inspected 2026-11-20]

09 · what is next

Open questions

policyRelay set: default public relays vs a user-configured set (privacy-sensitive default = the user's own relay first).
designFixed denomination ladder (better set heuristics) vs pure random split — CashFusion uses random split.
cryptoNIP-44 vs AES-GCM for onion layers: NIP-44 gives standardization; AES-GCM gives parity with the upstream onionWrap.
integrationPost-fusion “shield into pool” button — the composition story already published on the CoinJoin page.
discoveryLive pool discovery (kind 22230) is design-only; the harness supplies the peer set explicitly.
gateG4 mainnet opt-in beta behind a settings flag — not built.

[open · P2P-FUSION-DESIGN.md §6 + the G4 gap recorded in §5]

10 · questions

Research FAQ

Short answers to the questions this research raises most often. Every answer is grounded in the sections above.

Is CashFusion the same as CoinJoin?

CashFusion is a CoinJoin-style protocol built for Bitcoin Cash. Participants contribute inputs and receive outputs, which breaks the direct input→output link. The classic implementation uses an external coordinator server and Tor covert channels; it is not a shielded pool.

Does the P2P round over Nostr hide amounts?

No. Amounts and the transaction graph remain public on chain. The round hides the mapping between inputs and outputs; amount privacy is the shielded pool's job, not this layer's.

Is the Nostr round live on mainnet?

No. G2b is a real round on chipnet (funding tx and round tx are linked above). G3 and G3L are dry-runs with fixture UTXOs. G4 — a mainnet opt-in beta behind a settings flag — is pending, and no production fusion UI exists yet.

What is the difference between classic CashFusion and P2P over Nostr?

Classic CashFusion trusts an external coordinator for round integrity and uses Tor covert channels. The P2P design removes the server: peers self-elect a coordinator per round, messages are NIP-59 gift-wrapped over Nostr relays, and outputs travel through an onion mix-net. Both have no backend in the app.

Why five participants?

Five is our design floor. A two-party round has near-zero mapping entropy; five gives a larger per-round anonymity set. The constant is proposed in P2P-FUSION-DESIGN.md §4 and is not enforced in round.ts — the harness tested 5 and 7.

Why did the first real broadcast fail?

BCH's 2019 Schnorr is the BIP-340 draft, not final BIP-340. The challenge uses a compressed 33-byte pubkey and no BIP-0340 tag prefixes, and R must be normalized to the quadratic-residue Y root. Noble's schnorr produces final BIP-340 signatures, which the BCH VM rejected with NULLFAIL. txbuild.ts now implements the 2019 variant.

Is the code open source?

The Hush Your Money repository is public. The 00-Protocol upstream repositories we studied have no LICENSE file — legally all rights reserved — so this design is a clean-room specification: we read and cite them, we do not copy code.

[answers · grounded in P2P-FUSION-DESIGN.md §1–§6 and the 2026-11-20 gate record]

11 · sources

Read the record