Monday, December 23, 2024

transactions – Is it potential to mix two PSBTs whereas retaining the prevailing signatures?

If in case you have two PSBTs of the identical transaction, you’ll be able to mix signatures from them to finish a transaction. Nonetheless, it appears to me that you’re speaking about two PSBTs of completely different transactions.

Typically signatures decide to the whole transaction utilizing the SIGHASH_ALL sighash flag. In that case, you can not switch a signature from one transaction to a special one. As the brand new transaction has completely different inputs or outputs, the signature from the unique transaction would now not decide to the brand new transaction’s set of inputs and outputs and can be invalid within the context of the brand new transaction.

The exception is when you could have a signature that doesn’t decide to different inputs and simply to at least one output (SIGHASH_SINGLE|SIGHASH_ANYONECANPAY) or no output (SIGHASH_NONE|SIGHASH_ANYONECANPAY). Within the first case, you’ll be able to transfer one particular enter and output pair to a brand new transaction, or within the second case even use the enter on any transaction you want. Provided that the previous has very restricted functions and the latter is outright signing your cash away to anybody that wishes it, these signature hash varieties get used sometimes.

Subsequently, you shouldn’t count on that combining two separate PSBTs to be potential with out redoing all signatures, as all inputs shall be signed virtually completely with SIGHASH_ALL.

You possibly can learn extra about Bitcoin’s signature hash varieties in Raghav Sood’s wonderful weblog put up on that subject, or within the Signatures chapter of Mastering Bitcoin third Version.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles