What is it, how does it work, and how to perform a Payjoin transaction?
Payjoin, or Pay-to-EndPoint (P2EP), is a Bitcoin transaction protocol that enhances user privacy and reduces fees. Unlike standard transactions, where only the sender provides inputs, a Payjoin transaction involves the recipient contributing their inputs as well. This confuses external observers and makes it harder for blockchain surveillance companies to trace transactions, offering benefits in both privacy and scalability.
How Payjoin works
In a standard transaction, the sender transfers funds to the recipient using inputs from their wallet. In a Payjoin transaction, both the sender and the recipient contribute inputs. As a result, external parties cannot easily distinguish who sent or received funds, enhancing the privacy of both participants.
From a technical perspective, Payjoin leverages a feature of the Bitcoin protocol that allows multiple inputs from different sources. This breaks the common-input-ownership heuristic, which assumes that all inputs in a transaction belong to the same entity.
Benefits of Payjoin
- Privacy: It becomes difficult to determine the sender, the recipient, and the amount sent in a transaction, making it indistinguishable from a standard Bitcoin transaction.
- Fee Savings: Payjoin allows transaction batching, reducing block space usage and lowering fees by up to 16% compared to standard transactions.
- Lightning Network: Payjoin simplifies channel opening in the Lightning Network. Users only need one transaction instead of two (if you have a LN node, you first need to send a transaction to the node’s empty on-chain wallet and then perform another on-chain transaction to open the channel), making the process faster (only one confirmation needed) and cheaper (only one fee paid).
How to perform a Payjoin transaction
To execute a Payjoin transaction, both the sender and the recipient must use wallets that support the Payjoin protocol. You can find a list of compatible wallets here.
Steps to perform a Payjoin transaction
For this example, we’ll use the wallet within BTCPay Server, which supports Payjoin for both sending and receiving transactions.
- Wallet creation:
- Create a Payjoin-compatible wallet on BTCPay Server by first setting up a store.Navigate to Bitcoin > Create a new wallet > Hot wallet. Enable the Payjoin option and click Create.Save the seed phrase displayed on the screen and click Done. To complete the transaction, you’ll need to create two stores and two wallets: one for sending and one for receiving.
- Creating a payment request:
- Generate an on-chain payment request via the Point of Sale or Invoices sections.
- Once created, view the invoice and copy the BIP21 payment link by clicking the Pay in wallet button.
- Sending the transaction:
- In the wallet from which you want to send funds, click Send and paste the previously copied link.
- Signing and broadcasting the transaction:
- Click Sign transaction to sign the transaction and then Broadcast (Payjoin) to send it to the Bitcoin network.