![]()  | 
  
    Bitcoin Core 30.99.0
    
   P2P Digital Currency 
   | 
 
#include <common/types.h>#include <node/transaction.h>#include <policy/feerate.h>#include <primitives/transaction.h>#include <pubkey.h>#include <script/keyorigin.h>#include <script/sign.h>#include <script/signingprovider.h>#include <span.h>#include <streams.h>#include <optional>Go to the source code of this file.
Classes | |
| struct | PSBTProprietary | 
| A structure for PSBT proprietary types.  More... | |
| struct | PSBTInput | 
| A structure for PSBTs which contain per-input information.  More... | |
| struct | PSBTOutput | 
| A structure for PSBTs which contains per output information.  More... | |
| struct | PartiallySignedTransaction | 
| A version of CTransaction with the PSBT format.  More... | |
Namespaces | |
| namespace | node | 
Enumerations | |
| enum class | PSBTRole {  CREATOR , UPDATER , SIGNER , FINALIZER , EXTRACTOR }  | 
Functions | |
| template<typename Stream , typename... X> | |
| void | SerializeToVector (Stream &s, const X &... args) | 
| template<typename Stream , typename... X> | |
| void | UnserializeFromVector (Stream &s, X &&... args) | 
| template<typename Stream > | |
| KeyOriginInfo | DeserializeKeyOrigin (Stream &s, uint64_t length) | 
| template<typename Stream > | |
| void | DeserializeHDKeypath (Stream &s, KeyOriginInfo &hd_keypath) | 
| template<typename Stream > | |
| void | DeserializeHDKeypaths (Stream &s, const std::vector< unsigned char > &key, std::map< CPubKey, KeyOriginInfo > &hd_keypaths) | 
| template<typename Stream > | |
| void | SerializeKeyOrigin (Stream &s, KeyOriginInfo hd_keypath) | 
| template<typename Stream > | |
| void | SerializeHDKeypath (Stream &s, KeyOriginInfo hd_keypath) | 
| template<typename Stream > | |
| void | SerializeHDKeypaths (Stream &s, const std::map< CPubKey, KeyOriginInfo > &hd_keypaths, CompactSizeWriter type) | 
| template<typename Stream > | |
| void | DeserializeMuSig2ParticipantPubkeys (Stream &s, SpanReader &skey, std::map< CPubKey, std::vector< CPubKey > > &out, std::string context) | 
| template<typename Stream > | |
| void | DeserializeMuSig2ParticipantDataIdentifier (Stream &skey, CPubKey &agg_pub, CPubKey &part_pub, uint256 &leaf_hash) | 
| std::string | PSBTRoleName (PSBTRole role) | 
| PrecomputedTransactionData | PrecomputePSBTData (const PartiallySignedTransaction &psbt) | 
| Compute a PrecomputedTransactionData object from a psbt.  More... | |
| bool | PSBTInputSigned (const PSBTInput &input) | 
| Checks whether a PSBTInput is already signed by checking for non-null finalized fields.  More... | |
| bool | PSBTInputSignedAndVerified (const PartiallySignedTransaction psbt, unsigned int input_index, const PrecomputedTransactionData *txdata) | 
| Checks whether a PSBTInput is already signed by doing script verification using final fields.  More... | |
| PSBTError | SignPSBTInput (const SigningProvider &provider, PartiallySignedTransaction &psbt, int index, const PrecomputedTransactionData *txdata, std::optional< int > sighash=std::nullopt, SignatureData *out_sigdata=nullptr, bool finalize=true) | 
| Signs a PSBTInput, verifying that all provided data matches what is being signed.  More... | |
| void | RemoveUnnecessaryTransactions (PartiallySignedTransaction &psbtx) | 
Reduces the size of the PSBT by dropping unnecessary non_witness_utxos (i.e.  More... | |
| size_t | CountPSBTUnsignedInputs (const PartiallySignedTransaction &psbt) | 
| Counts the unsigned inputs of a PSBT.  More... | |
| void | UpdatePSBTOutput (const SigningProvider &provider, PartiallySignedTransaction &psbt, int index) | 
| Updates a PSBTOutput with information from provider.  More... | |
| bool | FinalizePSBT (PartiallySignedTransaction &psbtx) | 
| Finalizes a PSBT if possible, combining partial signatures.  More... | |
| bool | FinalizeAndExtractPSBT (PartiallySignedTransaction &psbtx, CMutableTransaction &result) | 
| Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.  More... | |
| bool | CombinePSBTs (PartiallySignedTransaction &out, const std::vector< PartiallySignedTransaction > &psbtxs) | 
| Combines PSBTs with the same underlying transaction, resulting in a single PSBT with all partial signatures from each input.  More... | |
| bool | DecodeBase64PSBT (PartiallySignedTransaction &decoded_psbt, const std::string &base64_psbt, std::string &error) | 
| Decode a base64ed PSBT into a PartiallySignedTransaction.  More... | |
| bool | DecodeRawPSBT (PartiallySignedTransaction &decoded_psbt, std::span< const std::byte > raw_psbt, std::string &error) | 
| Decode a raw (binary blob) PSBT into a PartiallySignedTransaction.  More... | |
Variables | |
| static constexpr uint8_t | PSBT_MAGIC_BYTES [5] = {'p', 's', 'b', 't', 0xff} | 
| static constexpr uint8_t | PSBT_GLOBAL_UNSIGNED_TX = 0x00 | 
| static constexpr uint8_t | PSBT_GLOBAL_XPUB = 0x01 | 
| static constexpr uint8_t | PSBT_GLOBAL_VERSION = 0xFB | 
| static constexpr uint8_t | PSBT_GLOBAL_PROPRIETARY = 0xFC | 
| static constexpr uint8_t | PSBT_IN_NON_WITNESS_UTXO = 0x00 | 
| static constexpr uint8_t | PSBT_IN_WITNESS_UTXO = 0x01 | 
| static constexpr uint8_t | PSBT_IN_PARTIAL_SIG = 0x02 | 
| static constexpr uint8_t | PSBT_IN_SIGHASH = 0x03 | 
| static constexpr uint8_t | PSBT_IN_REDEEMSCRIPT = 0x04 | 
| static constexpr uint8_t | PSBT_IN_WITNESSSCRIPT = 0x05 | 
| static constexpr uint8_t | PSBT_IN_BIP32_DERIVATION = 0x06 | 
| static constexpr uint8_t | PSBT_IN_SCRIPTSIG = 0x07 | 
| static constexpr uint8_t | PSBT_IN_SCRIPTWITNESS = 0x08 | 
| static constexpr uint8_t | PSBT_IN_RIPEMD160 = 0x0A | 
| static constexpr uint8_t | PSBT_IN_SHA256 = 0x0B | 
| static constexpr uint8_t | PSBT_IN_HASH160 = 0x0C | 
| static constexpr uint8_t | PSBT_IN_HASH256 = 0x0D | 
| static constexpr uint8_t | PSBT_IN_TAP_KEY_SIG = 0x13 | 
| static constexpr uint8_t | PSBT_IN_TAP_SCRIPT_SIG = 0x14 | 
| static constexpr uint8_t | PSBT_IN_TAP_LEAF_SCRIPT = 0x15 | 
| static constexpr uint8_t | PSBT_IN_TAP_BIP32_DERIVATION = 0x16 | 
| static constexpr uint8_t | PSBT_IN_TAP_INTERNAL_KEY = 0x17 | 
| static constexpr uint8_t | PSBT_IN_TAP_MERKLE_ROOT = 0x18 | 
| static constexpr uint8_t | PSBT_IN_MUSIG2_PARTICIPANT_PUBKEYS = 0x1a | 
| static constexpr uint8_t | PSBT_IN_MUSIG2_PUB_NONCE = 0x1b | 
| static constexpr uint8_t | PSBT_IN_MUSIG2_PARTIAL_SIG = 0x1c | 
| static constexpr uint8_t | PSBT_IN_PROPRIETARY = 0xFC | 
| static constexpr uint8_t | PSBT_OUT_REDEEMSCRIPT = 0x00 | 
| static constexpr uint8_t | PSBT_OUT_WITNESSSCRIPT = 0x01 | 
| static constexpr uint8_t | PSBT_OUT_BIP32_DERIVATION = 0x02 | 
| static constexpr uint8_t | PSBT_OUT_TAP_INTERNAL_KEY = 0x05 | 
| static constexpr uint8_t | PSBT_OUT_TAP_TREE = 0x06 | 
| static constexpr uint8_t | PSBT_OUT_TAP_BIP32_DERIVATION = 0x07 | 
| static constexpr uint8_t | PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS = 0x08 | 
| static constexpr uint8_t | PSBT_OUT_PROPRIETARY = 0xFC | 
| static constexpr uint8_t | PSBT_SEPARATOR = 0x00 | 
| const std::streamsize | MAX_FILE_SIZE_PSBT = 100000000 | 
| static constexpr uint32_t | PSBT_HIGHEST_VERSION = 0 | 
      
  | 
  strong | 
| bool CombinePSBTs | ( | PartiallySignedTransaction & | out, | 
| const std::vector< PartiallySignedTransaction > & | psbtxs | ||
| ) | 
Combines PSBTs with the same underlying transaction, resulting in a single PSBT with all partial signatures from each input.
| [out] | out | the combined PSBT, if successful | 
| [in] | psbtxs | the PSBTs to combine | 
Definition at line 583 of file psbt.cpp.
| size_t CountPSBTUnsignedInputs | ( | const PartiallySignedTransaction & | psbt | ) | 
| bool DecodeBase64PSBT | ( | PartiallySignedTransaction & | decoded_psbt, | 
| const std::string & | base64_psbt, | ||
| std::string & | error | ||
| ) | 
Decode a base64ed PSBT into a PartiallySignedTransaction.
Definition at line 608 of file psbt.cpp.
| bool DecodeRawPSBT | ( | PartiallySignedTransaction & | decoded_psbt, | 
| std::span< const std::byte > | raw_psbt, | ||
| std::string & | error | ||
| ) | 
Decode a raw (binary blob) PSBT into a PartiallySignedTransaction.
Definition at line 618 of file psbt.cpp.
| void DeserializeHDKeypath | ( | Stream & | s, | 
| KeyOriginInfo & | hd_keypath | ||
| ) | 
| void DeserializeHDKeypaths | ( | Stream & | s, | 
| const std::vector< unsigned char > & | key, | ||
| std::map< CPubKey, KeyOriginInfo > & | hd_keypaths | ||
| ) | 
| KeyOriginInfo DeserializeKeyOrigin | ( | Stream & | s, | 
| uint64_t | length | ||
| ) | 
| void DeserializeMuSig2ParticipantPubkeys | ( | Stream & | s, | 
| SpanReader & | skey, | ||
| std::map< CPubKey, std::vector< CPubKey > > & | out, | ||
| std::string | context | ||
| ) | 
| bool FinalizeAndExtractPSBT | ( | PartiallySignedTransaction & | psbtx, | 
| CMutableTransaction & | result | ||
| ) | 
Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.
| [in] | psbtx | PartiallySignedTransaction | 
| [out] | result | CMutableTransaction representing the complete transaction, if successful | 
Definition at line 567 of file psbt.cpp.
| bool FinalizePSBT | ( | PartiallySignedTransaction & | psbtx | ) | 
Finalizes a PSBT if possible, combining partial signatures.
| [in,out] | psbtx | PartiallySignedTransaction to finalize return True if the PSBT is now complete, false otherwise | 
Definition at line 551 of file psbt.cpp.
| PrecomputedTransactionData PrecomputePSBTData | ( | const PartiallySignedTransaction & | psbt | ) | 
Compute a PrecomputedTransactionData object from a psbt.
Definition at line 385 of file psbt.cpp.
| bool PSBTInputSigned | ( | const PSBTInput & | input | ) | 
| bool PSBTInputSignedAndVerified | ( | const PartiallySignedTransaction | psbt, | 
| unsigned int | input_index, | ||
| const PrecomputedTransactionData * | txdata | ||
| ) | 
| std::string PSBTRoleName | ( | PSBTRole | role | ) | 
| void RemoveUnnecessaryTransactions | ( | PartiallySignedTransaction & | psbtx | ) | 
| void SerializeHDKeypath | ( | Stream & | s, | 
| KeyOriginInfo | hd_keypath | ||
| ) | 
| void SerializeHDKeypaths | ( | Stream & | s, | 
| const std::map< CPubKey, KeyOriginInfo > & | hd_keypaths, | ||
| CompactSizeWriter | type | ||
| ) | 
| void SerializeKeyOrigin | ( | Stream & | s, | 
| KeyOriginInfo | hd_keypath | ||
| ) | 
| void SerializeToVector | ( | Stream & | s, | 
| const X &... | args | ||
| ) | 
| PSBTError SignPSBTInput | ( | const SigningProvider & | provider, | 
| PartiallySignedTransaction & | psbt, | ||
| int | index, | ||
| const PrecomputedTransactionData * | txdata, | ||
| std::optional< int > | sighash = std::nullopt,  | 
        ||
| SignatureData * | out_sigdata = nullptr,  | 
        ||
| bool | finalize = true  | 
        ||
| ) | 
Signs a PSBTInput, verifying that all provided data matches what is being signed.
txdata should be the output of PrecomputePSBTData (which can be shared across multiple SignPSBTInput calls). If it is nullptr, a dummy signature will be created.
Definition at line 402 of file psbt.cpp.
| void UnserializeFromVector | ( | Stream & | s, | 
| X &&... | args | ||
| ) | 
| void UpdatePSBTOutput | ( | const SigningProvider & | provider, | 
| PartiallySignedTransaction & | psbt, | ||
| int | index | ||
| ) | 
Updates a PSBTOutput with information from provider.
This fills in the redeem_script, witness_script, and hd_keypaths where possible.
Definition at line 365 of file psbt.cpp.
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr | 
      
  | 
  staticconstexpr |