1

They seem to do pretty much the same thing. The only apparent difference being that combinepsbt seems more for updating the same psbt with imcremental signatures while joinpsbts seems more for joining different transactions but given in combinepsbt you can also add different inputs and outputs I don't see the difference.

  • What makes you think that combinepsbt can add inputs and outputs? It is not supposed to, and if it does, that is a bug and should be fixed. – Andrew Chow Mar 26 at 14:54
  • I think I got confused between "input data" and transaction "inputs". Now I get that combinepsbt combines only transactions that have the same inputs and outputs but different "input data". – Gabriele Domenichini Mar 28 at 14:50
3

combinepsbt takes multiple PSBTs that have different input data and merges them. The base transaction must be exactly the same, i.e. the same inputs are consumed and the same outputs are created. The information for each input is combined into the same input. Inputs and outputs cannot be added or removed. This allows for people to send the same PSBT to be signed by multiple different people and then merge the resulting the PSBTs back together.

For example, suppose you have a PSBT that consumes 2 inputs, with input 1 requiring person A to sign and input 2 requiring person B to sign. You give both person A and person B copies of that PSBT to sign. Person A returns you a PSBT which has input 1 signed (i.e. they fill in input information like UTXO, partial signatures, final scriptSig, etc.) but input 2 is not. Person B returns you a PSBT which does not have input 1 signed but input 2 is signed. combinepsbt allows you to merge the PSBTs from both person A and person B into a single one which has both inputs signed.

joinpsbts is very different from this. joinpsbts joins multiple PSBTs that have different underlying transactions into one transaction. It requires that the inputs of those underlying transactions be different from each other. Furthermore, joinpsbts will discard any signatures and finalized input fields from the original PSBTs (meaning the resulting PSBT will contain no signatures) as those signatures will likely be invalidated when joining.

joinpsbts lets you make transactions which has other people involved in them (such as CoinJoins) more easily. Each person can specify the inputs and outputs they want in a PSBT and then all of these PSBTs with different inputs and outputs are merged together using joinpsbts.

  • So A performs a walletcreatefundedpsbt. B perform a walletcreatefundedpsbt as well. B sends his transaction to A. A perform a joinpsbts with the two transactions. A perform walletprocesspsbt signing the unsigned transaction. B perform walletprocesspsbt signing the unsigned transaction as well. A or B perform a combinepsbt of the two transactions, a finalizepsbt and broadcast? Thank you for your huge work and for answering. – Gabriele Domenichini Mar 26 at 15:15
  • 1
    Yes, that is a possible workflow. – Andrew Chow Mar 26 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.