Home › Glossary › Payjoin

Payjoin

Also called: PayJoin, P2EP, pay-to-endpoint, BIP78, BIP 78, async payjoin, Payjoin v2.

Payjoin is a payment where the receiver adds their own input to the sender's transaction, breaking the assumption that all inputs belong to the payer.

Payjoin is a way of paying someone in which the receiver also contributes an input to the transaction. The result looks like an ordinary payment, but it breaks a key assumption of chain analysis: that all inputs of a transaction belong to the same person.

How it works (BIP 78)

BIP 78, by Nicolas Dorier, describes the original protocol:

  1. The receiver shares a Bitcoin URI (BIP 21) with a pj= parameter pointing to their payjoin endpoint.
  2. The sender builds and signs a normal transaction as a PSBT, called the original, and posts it to the endpoint.
  3. The receiver adds one or more of their own inputs, adjusts their output, signs and returns a payjoin proposal.
  4. The sender checks the proposal, signs their inputs again and broadcasts it.

The original transaction is valid on its own, so if the sender never completes the payjoin, the receiver can broadcast the original and still get paid.

Why it matters

BIP 78 names three heuristics payjoin defeats: common input ownership, spotting change by its script type, and spotting change by round amounts. Because payjoins look like normal payments, BIP 78 argues their existence makes these heuristics unreliable for everyone, not only for users. Receivers can also consolidate a UTXO in the same transaction, saving fees.

Async payjoin

BIP 78 requires the receiver to run an always-online HTTPS or onion endpoint. BIP 77, by Dan Gould and Yuval Kogman, proposes a version 2 in which an untrusted directory server relays encrypted messages over Oblivious HTTP, so sender and receiver don't need to be online at the same time.

Payjoin is a two-party form of CoinJoin. An earlier proposal with the same goal, Bustapay (BIP 79), did not use PSBTs.

BIPs that define Payjoin

  • BIP 78: A Simple Payjoin Proposal: Deployed. Defines Payjoin, a way for the payer and the recipient to both contribute coins to a single payment transaction. Because the result looks like an ordinary payment but breaks common assumptions used…
  • BIP 77: Async Payjoin: Draft. Introduces a second version of Payjoin that works asynchronously, so sender and receiver do not need to be online at the same moment. An untrusted relay called a directory server passes encrypted…
  • BIP 21: URI Scheme: Closed. Defines the "bitcoin:" link format that packages an address, amount, label and message into one string, often shown as a QR code. Wallets read these links to fill in payment details automatically,…
  • BIP 174 (PSBT): Partially Signed Bitcoin Transaction Format: Deployed. Defines PSBT (Partially Signed Bitcoin Transaction), a standard file format for a transaction that is still collecting signatures. It lets different wallets, hardware devices, and co-signers pass a…
  • BIP 79: Bustapay :: a practical coinjoin protocol: Closed. Describes Bustapay, a simple protocol in which the sender and receiver of a payment jointly build and sign the transaction, each adding their own coins. Mixing ownership this way undermines the…

Related terms

  • CoinJoin: A CoinJoin is one transaction that combines inputs from several people, usually with equal-value outputs, so observers can't tell who paid whom.
  • PSBT: A PSBT (Partially Signed Bitcoin Transaction) is the standard format, from BIP 174, for passing a not-yet-signed transaction between wallets and signers.
  • Bitcoin URI: A Bitcoin URI is a bitcoin: link, defined in BIP 21 and BIP 321, that packs an address, amount and label into one clickable or scannable string.
  • UTXO: A UTXO (unspent transaction output) is an amount of bitcoin locked to a script and not yet spent. A wallet's balance is the sum of its UTXOs.

Learn more

Guides