BIP: Trust minimized swaps using PSBT, SINGLE|ANYONECANPAY and nostr



Summary:

The author of a Bitcoin Improvement Proposal (BIP) suggests using partially signed bitcoin transactions (PSBTs) to swap inscriptions in a trust-minimized, efficient way. In contrast, two other approaches (joinpsbts and coinswap) allegedly degrade the user experience. The BIP's author recommends using the SINGLE|ANYONECANPAY flag to create a PSBT by the seller which is signed and published as the offer. The buyer then updates the PSBT with the appropriate inputs and outputs. The order of inputs and outputs is crucial because incorrect ordering can result in burnt inscriptions. The Ordinal theory uses an algorithm to determine how satoshis hop from the inputs of a transaction to its outputs, and the swap relies on this theory. A sequence diagram is presented that shows the steps for both the seller and buyer. The seller firstly creates a PSBT with an inscription UTXO input and a new address with the sell amount as output. They then sign the PSBT before publishing it as defined in the Network Implementation Plan (NIP). The buyer adds a new address as output in the PSBT to receive the inscription, creates a dummy UTXO if not available in the wallet, adds UTXOs to pay the seller and dummy UTXO as inputs in the PSBT, signs and broadcasts the transaction. Two functions used by Openordex for creating PSBTs are presented in pseudocode or implementation. The BIP provides links to additional resources, including an FAQ page explaining how the Ordinal theory works. The document concludes with examples of transactions that used the proposed approach.


Updated on: 2023-06-16T17:10:25.817795+00:00