This Pull Request fully implements the updated BIP 174 specification. It is based upon #13425 which implements the majority of the signing logic.
BIP 174 specifies a binary transaction format which contains the information necessary for a signer to produce signatures for the transaction and holds the signatures for an input while the input does not have a complete set of signatures.
This PR contains structs for PSBT, serialization, and deserialzation code. Some changes to SignatureData
have been made to support detection of UTXO type and storing public keys.
Many RPCs have been added to handle PSBTs.
walletprocesspsbt
takes a PSBT format transaction, updates the PSBT with any inputs related to this wallet, signs, and finalizes the transaction. There is also an option to not sign and just update.
walletcreatefundedpsbt
creates a PSBT from user provided data in the same form as createrawtransaction. It also funds the transaction and takes an options argument in the same form as fundrawtransaction
. The resulting PSBT is blank with no input or output data filled in. It is analogous to a combination of createrawtransaction
and fundrawtransaction
decodepsbt
takes a PSBT and decodes it to JSON. It is analogous to decoderawtransaction
combinepsbt
takes multiple PSBTs for the same tx and combines them. It is analogous to combinerawtransaction
finalizepsbt
takes a PSBT and finalizes the inputs. If all inputs are final, it extracts the network serialized transaction and returns that instead of a PSBT unless instructed otherwise.
createpsbt
is like createrawtransaction
but for PSBTs instead of raw transactions.
convertpsbt
takes a network serialized transaction and converts it into a psbt. The resulting psbt will lose all signature data and an explicit flag must be set to allow transactions with signature data to be converted.
This supersedes #12136