Bitcoin ABC  0.24.7
P2P Digital Currency
psbt.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2019 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_PSBT_H
6 #define BITCOIN_PSBT_H
7 
8 #include <attributes.h>
9 #include <node/transaction.h>
10 #include <primitives/transaction.h>
11 #include <pubkey.h>
12 #include <script/sign.h>
13 #include <script/signingprovider.h>
14 
15 #include <optional>
16 
17 // Magic bytes
18 static constexpr uint8_t PSBT_MAGIC_BYTES[5] = {'p', 's', 'b', 't', 0xff};
19 
20 // Global types
21 static constexpr uint8_t PSBT_GLOBAL_UNSIGNED_TX = 0x00;
22 
23 // Input types
24 static constexpr uint8_t PSBT_IN_UTXO = 0x00;
25 static constexpr uint8_t PSBT_IN_PARTIAL_SIG = 0x02;
26 static constexpr uint8_t PSBT_IN_SIGHASH = 0x03;
27 static constexpr uint8_t PSBT_IN_REDEEMSCRIPT = 0x04;
28 static constexpr uint8_t PSBT_IN_BIP32_DERIVATION = 0x06;
29 static constexpr uint8_t PSBT_IN_SCRIPTSIG = 0x07;
30 
31 // Output types
32 static constexpr uint8_t PSBT_OUT_REDEEMSCRIPT = 0x00;
33 static constexpr uint8_t PSBT_OUT_BIP32_DERIVATION = 0x02;
34 
35 // The separator is 0x00. Reading this in means that the unserializer can
36 // interpret it as a 0 length key which indicates that this is the separator.
37 // The separator has no value.
38 static constexpr uint8_t PSBT_SEPARATOR = 0x00;
39 
40 // BIP 174 does not specify a maximum file size, but we set a limit anyway
41 // to prevent reading a stream indefinitely and running out of memory.
42 const std::streamsize MAX_FILE_SIZE_PSBT = 100000000; // 100 MiB
43 
45 struct PSBTInput {
49  std::map<CPubKey, KeyOriginInfo> hd_keypaths;
50  std::map<CKeyID, SigPair> partial_sigs;
51  std::map<std::vector<uint8_t>, std::vector<uint8_t>> unknown;
53 
54  bool IsNull() const;
55  void FillSignatureData(SignatureData &sigdata) const;
56  void FromSignatureData(const SignatureData &sigdata);
57  void Merge(const PSBTInput &input);
58  PSBTInput() {}
59 
60  template <typename Stream> inline void Serialize(Stream &s) const {
61  // Write the utxo
62  if (!utxo.IsNull()) {
65  }
66 
67  if (final_script_sig.empty()) {
68  // Write any partial signatures
69  for (auto sig_pair : partial_sigs) {
71  MakeSpan(sig_pair.second.first));
72  s << sig_pair.second.second;
73  }
74 
75  // Write the sighash type
76  if (sighash_type.getRawSigHashType() != 0) {
79  }
80 
81  // Write the redeem script
82  if (!redeem_script.empty()) {
84  s << redeem_script;
85  }
86 
87  // Write any hd keypaths
89  }
90 
91  // Write script sig
92  if (!final_script_sig.empty()) {
94  s << final_script_sig;
95  }
96 
97  // Write unknown things
98  for (auto &entry : unknown) {
99  s << entry.first;
100  s << entry.second;
101  }
102 
103  s << PSBT_SEPARATOR;
104  }
105 
106  template <typename Stream> inline void Unserialize(Stream &s) {
107  // Used for duplicate key detection
108  std::set<std::vector<uint8_t>> key_lookup;
109 
110  // Read loop
111  bool found_sep = false;
112  while (!s.empty()) {
113  // Read
114  std::vector<uint8_t> key;
115  s >> key;
116 
117  // the key is empty if that was actually a separator byte
118  // This is a special case for key lengths 0 as those are not allowed
119  // (except for separator)
120  if (key.empty()) {
121  found_sep = true;
122  break;
123  }
124 
125  // First byte of key is the type
126  uint8_t type = key[0];
127 
128  // Do stuff based on type
129  switch (type) {
130  case PSBT_IN_UTXO:
131  if (!key_lookup.emplace(key).second) {
132  throw std::ios_base::failure(
133  "Duplicate Key, input utxo already provided");
134  } else if (key.size() != 1) {
135  throw std::ios_base::failure(
136  "utxo key is more than one byte type");
137  }
139  break;
140  case PSBT_IN_PARTIAL_SIG: {
141  // Make sure that the key is the size of pubkey + 1
142  if (key.size() != CPubKey::SIZE + 1 &&
143  key.size() != CPubKey::COMPRESSED_SIZE + 1) {
144  throw std::ios_base::failure(
145  "Size of key was not the expected size for the "
146  "type partial signature pubkey");
147  }
148  // Read in the pubkey from key
149  CPubKey pubkey(key.begin() + 1, key.end());
150  if (!pubkey.IsFullyValid()) {
151  throw std::ios_base::failure("Invalid pubkey");
152  }
153  if (partial_sigs.count(pubkey.GetID()) > 0) {
154  throw std::ios_base::failure(
155  "Duplicate Key, input partial signature for pubkey "
156  "already provided");
157  }
158 
159  // Read in the signature from value
160  std::vector<uint8_t> sig;
161  s >> sig;
162 
163  // Add to list
164  partial_sigs.emplace(pubkey.GetID(),
165  SigPair(pubkey, std::move(sig)));
166  break;
167  }
168  case PSBT_IN_SIGHASH:
169  if (!key_lookup.emplace(key).second) {
170  throw std::ios_base::failure(
171  "Duplicate Key, input sighash type already "
172  "provided");
173  } else if (key.size() != 1) {
174  throw std::ios_base::failure(
175  "Sighash type key is more than one byte type");
176  }
178  break;
179  case PSBT_IN_REDEEMSCRIPT: {
180  if (!key_lookup.emplace(key).second) {
181  throw std::ios_base::failure(
182  "Duplicate Key, input redeemScript already "
183  "provided");
184  } else if (key.size() != 1) {
185  throw std::ios_base::failure(
186  "Input redeemScript key is more than one byte "
187  "type");
188  }
189  s >> redeem_script;
190  break;
191  }
194  break;
195  }
196  case PSBT_IN_SCRIPTSIG: {
197  if (!key_lookup.emplace(key).second) {
198  throw std::ios_base::failure(
199  "Duplicate Key, input final scriptSig already "
200  "provided");
201  } else if (key.size() != 1) {
202  throw std::ios_base::failure(
203  "Final scriptSig key is more than one byte type");
204  }
205  s >> final_script_sig;
206  break;
207  }
208  // Unknown stuff
209  default:
210  if (unknown.count(key) > 0) {
211  throw std::ios_base::failure(
212  "Duplicate Key, key for unknown value already "
213  "provided");
214  }
215  // Read in the value
216  std::vector<uint8_t> val_bytes;
217  s >> val_bytes;
218  unknown.emplace(std::move(key), std::move(val_bytes));
219  break;
220  }
221  }
222  if (!found_sep) {
223  throw std::ios_base::failure(
224  "Separator is missing at the end of an input map");
225  }
226  }
227 
228  template <typename Stream> PSBTInput(deserialize_type, Stream &s) {
229  Unserialize(s);
230  }
231 };
232 
234 struct PSBTOutput {
236  std::map<CPubKey, KeyOriginInfo> hd_keypaths;
237  std::map<std::vector<uint8_t>, std::vector<uint8_t>> unknown;
238 
239  bool IsNull() const;
240  void FillSignatureData(SignatureData &sigdata) const;
241  void FromSignatureData(const SignatureData &sigdata);
242  void Merge(const PSBTOutput &output);
244 
245  template <typename Stream> inline void Serialize(Stream &s) const {
246  // Write the redeem script
247  if (!redeem_script.empty()) {
249  s << redeem_script;
250  }
251 
252  // Write any hd keypaths
254 
255  // Write unknown things
256  for (auto &entry : unknown) {
257  s << entry.first;
258  s << entry.second;
259  }
260 
261  s << PSBT_SEPARATOR;
262  }
263 
264  template <typename Stream> inline void Unserialize(Stream &s) {
265  // Used for duplicate key detection
266  std::set<std::vector<uint8_t>> key_lookup;
267 
268  // Read loop
269  bool found_sep = false;
270  while (!s.empty()) {
271  // Read
272  std::vector<uint8_t> key;
273  s >> key;
274 
275  // the key is empty if that was actually a separator byte
276  // This is a special case for key lengths 0 as those are not allowed
277  // (except for separator)
278  if (key.empty()) {
279  found_sep = true;
280  break;
281  }
282 
283  // First byte of key is the type
284  uint8_t type = key[0];
285 
286  // Do stuff based on type
287  switch (type) {
288  case PSBT_OUT_REDEEMSCRIPT: {
289  if (!key_lookup.emplace(key).second) {
290  throw std::ios_base::failure(
291  "Duplicate Key, output redeemScript already "
292  "provided");
293  } else if (key.size() != 1) {
294  throw std::ios_base::failure(
295  "Output redeemScript key is more than one byte "
296  "type");
297  }
298  s >> redeem_script;
299  break;
300  }
303  break;
304  }
305  // Unknown stuff
306  default: {
307  if (unknown.count(key) > 0) {
308  throw std::ios_base::failure(
309  "Duplicate Key, key for unknown value already "
310  "provided");
311  }
312  // Read in the value
313  std::vector<uint8_t> val_bytes;
314  s >> val_bytes;
315  unknown.emplace(std::move(key), std::move(val_bytes));
316  break;
317  }
318  }
319  }
320 
321  if (!found_sep) {
322  throw std::ios_base::failure(
323  "Separator is missing at the end of an output map");
324  }
325  }
326 
327  template <typename Stream> PSBTOutput(deserialize_type, Stream &s) {
328  Unserialize(s);
329  }
330 };
331 
336  std::optional<CMutableTransaction> tx;
337  std::vector<PSBTInput> inputs;
338  std::vector<PSBTOutput> outputs;
339  std::map<std::vector<uint8_t>, std::vector<uint8_t>> unknown;
340 
341  bool IsNull() const;
342 
348  NODISCARD bool Merge(const PartiallySignedTransaction &psbt);
349  bool AddInput(const CTxIn &txin, PSBTInput &psbtin);
350  bool AddOutput(const CTxOut &txout, const PSBTOutput &psbtout);
352  explicit PartiallySignedTransaction(const CMutableTransaction &txIn);
360  bool GetInputUTXO(CTxOut &utxo, int input_index) const;
361 
362  template <typename Stream> inline void Serialize(Stream &s) const {
363  // magic bytes
364  s << PSBT_MAGIC_BYTES;
365 
366  // unsigned tx flag
368 
369  // Write serialized tx to a stream
370  SerializeToVector(s, *tx);
371 
372  // Write the unknown things
373  for (auto &entry : unknown) {
374  s << entry.first;
375  s << entry.second;
376  }
377 
378  // Separator
379  s << PSBT_SEPARATOR;
380 
381  // Write inputs
382  for (const PSBTInput &input : inputs) {
383  s << input;
384  }
385 
386  // Write outputs
387  for (const PSBTOutput &output : outputs) {
388  s << output;
389  }
390  }
391 
392  template <typename Stream> inline void Unserialize(Stream &s) {
393  // Read the magic bytes
394  uint8_t magic[5];
395  s >> magic;
396  if (!std::equal(magic, magic + 5, PSBT_MAGIC_BYTES)) {
397  throw std::ios_base::failure("Invalid PSBT magic bytes");
398  }
399 
400  // Used for duplicate key detection
401  std::set<std::vector<uint8_t>> key_lookup;
402 
403  // Read global data
404  bool found_sep = false;
405  while (!s.empty()) {
406  // Read
407  std::vector<uint8_t> key;
408  s >> key;
409 
410  // the key is empty if that was actually a separator byte
411  // This is a special case for key lengths 0 as those are not allowed
412  // (except for separator)
413  if (key.empty()) {
414  found_sep = true;
415  break;
416  }
417 
418  // First byte of key is the type
419  uint8_t type = key[0];
420 
421  // Do stuff based on type
422  switch (type) {
424  if (!key_lookup.emplace(key).second) {
425  throw std::ios_base::failure(
426  "Duplicate Key, unsigned tx already provided");
427  } else if (key.size() != 1) {
428  throw std::ios_base::failure(
429  "Global unsigned tx key is more than one byte "
430  "type");
431  }
433  UnserializeFromVector(s, mtx);
434  tx = std::move(mtx);
435  // Make sure that all scriptSigs are empty.
436  for (const CTxIn &txin : tx->vin) {
437  if (!txin.scriptSig.empty()) {
438  throw std::ios_base::failure(
439  "Unsigned tx does not have empty scriptSigs.");
440  }
441  }
442  break;
443  }
444  // Unknown stuff
445  default: {
446  if (unknown.count(key) > 0) {
447  throw std::ios_base::failure(
448  "Duplicate Key, key for unknown value already "
449  "provided");
450  }
451  // Read in the value
452  std::vector<uint8_t> val_bytes;
453  s >> val_bytes;
454  unknown.emplace(std::move(key), std::move(val_bytes));
455  }
456  }
457  }
458 
459  if (!found_sep) {
460  throw std::ios_base::failure(
461  "Separator is missing at the end of the global map");
462  }
463 
464  // Make sure that we got an unsigned tx
465  if (!tx) {
466  throw std::ios_base::failure(
467  "No unsigned transcation was provided");
468  }
469 
470  // Read input data
471  size_t i = 0;
472  while (!s.empty() && i < tx->vin.size()) {
473  PSBTInput input;
474  s >> input;
475  inputs.push_back(input);
476  ++i;
477  }
478  // Make sure that the number of inputs matches the number of inputs in
479  // the transaction
480  if (inputs.size() != tx->vin.size()) {
481  throw std::ios_base::failure("Inputs provided does not match the "
482  "number of inputs in transaction.");
483  }
484 
485  // Read output data
486  i = 0;
487  while (!s.empty() && i < tx->vout.size()) {
488  PSBTOutput output;
489  s >> output;
490  outputs.push_back(output);
491  ++i;
492  }
493  // Make sure that the number of outputs matches the number of outputs in
494  // the transaction
495  if (outputs.size() != tx->vout.size()) {
496  throw std::ios_base::failure("Outputs provided does not match the "
497  "number of outputs in transaction.");
498  }
499  }
500 
501  template <typename Stream>
503  Unserialize(s);
504  }
505 };
506 
507 enum class PSBTRole {
508  CREATOR,
509  UPDATER,
510  SIGNER,
511  FINALIZER,
512  EXTRACTOR,
513 };
514 
515 std::string PSBTRoleName(PSBTRole role);
516 
518 bool PSBTInputSigned(const PSBTInput &input);
519 
524 bool SignPSBTInput(const SigningProvider &provider,
525  PartiallySignedTransaction &psbt, int index,
526  SigHashType sighash = SigHashType(),
527  SignatureData *out_sigdata = nullptr,
528  bool use_dummy = false);
529 
536 void UpdatePSBTOutput(const SigningProvider &provider,
537  PartiallySignedTransaction &psbt, int index);
538 
546 
557  CMutableTransaction &result);
558 
570  const std::vector<PartiallySignedTransaction> &psbtxs);
571 
574  const std::string &base64_psbt,
575  std::string &error);
578  const std::string &raw_psbt, std::string &error);
579 
580 #endif // BITCOIN_PSBT_H
CTxIn
An input of a transaction.
Definition: transaction.h:61
deserialize_type
Dummy data type to identify deserializing constructors.
Definition: serialize.h:48
PSBTInput::partial_sigs
std::map< CKeyID, SigPair > partial_sigs
Definition: psbt.h:50
FinalizePSBT
bool FinalizePSBT(PartiallySignedTransaction &psbtx)
Finalizes a PSBT if possible, combining partial signatures.
Definition: psbt.cpp:231
PSBTInput::PSBTInput
PSBTInput()
Definition: psbt.h:58
PartiallySignedTransaction::IsNull
bool IsNull() const
Definition: psbt.cpp:16
transaction.h
PSBTOutput::PSBTOutput
PSBTOutput()
Definition: psbt.h:243
PSBTOutput::FillSignatureData
void FillSignatureData(SignatureData &sigdata) const
Definition: psbt.cpp:128
CPubKey::SIZE
static constexpr unsigned int SIZE
secp256k1:
Definition: pubkey.h:36
PSBT_IN_REDEEMSCRIPT
static constexpr uint8_t PSBT_IN_REDEEMSCRIPT
Definition: psbt.h:27
PSBTRole::UPDATER
@ UPDATER
PartiallySignedTransaction::inputs
std::vector< PSBTInput > inputs
Definition: psbt.h:337
PartiallySignedTransaction::AddInput
bool AddInput(const CTxIn &txin, PSBTInput &psbtin)
Definition: psbt.cpp:37
PSBT_GLOBAL_UNSIGNED_TX
static constexpr uint8_t PSBT_GLOBAL_UNSIGNED_TX
Definition: psbt.h:21
SigningProvider
An interface to be implemented by keystores that support signing.
Definition: signingprovider.h:20
PSBTOutput::redeem_script
CScript redeem_script
Definition: psbt.h:235
NODISCARD
#define NODISCARD
Definition: attributes.h:18
PSBTOutput::Unserialize
void Unserialize(Stream &s)
Definition: psbt.h:264
PSBTInputSigned
bool PSBTInputSigned(const PSBTInput &input)
Checks whether a PSBTInput is already signed.
Definition: psbt.cpp:159
pubkey.h
PSBTOutput::PSBTOutput
PSBTOutput(deserialize_type, Stream &s)
Definition: psbt.h:327
PSBT_IN_SIGHASH
static constexpr uint8_t PSBT_IN_SIGHASH
Definition: psbt.h:26
PSBT_IN_UTXO
static constexpr uint8_t PSBT_IN_UTXO
Definition: psbt.h:24
SigPair
std::pair< CPubKey, std::vector< uint8_t > > SigPair
Definition: sign.h:60
UpdatePSBTOutput
void UpdatePSBTOutput(const SigningProvider &provider, PartiallySignedTransaction &psbt, int index)
Updates a PSBTOutput with information from provider.
Definition: psbt.cpp:163
CombinePSBTs
NODISCARD TransactionError CombinePSBTs(PartiallySignedTransaction &out, const std::vector< PartiallySignedTransaction > &psbtxs)
Combines PSBTs with the same underlying transaction, resulting in a single PSBT with all partial sign...
Definition: psbt.cpp:263
transaction.h
signingprovider.h
CTxOut::IsNull
bool IsNull() const
Definition: transaction.h:147
PSBT_MAGIC_BYTES
static constexpr uint8_t PSBT_MAGIC_BYTES[5]
Definition: psbt.h:18
TransactionError
TransactionError
Definition: error.h:22
sig
SchnorrSig sig
Definition: processor.cpp:322
PartiallySignedTransaction::PartiallySignedTransaction
PartiallySignedTransaction()
Definition: psbt.h:351
PSBTInput::unknown
std::map< std::vector< uint8_t >, std::vector< uint8_t > > unknown
Definition: psbt.h:51
PSBTInput::final_script_sig
CScript final_script_sig
Definition: psbt.h:48
SignatureData
Definition: sign.h:66
PartiallySignedTransaction::Merge
NODISCARD bool Merge(const PartiallySignedTransaction &psbt)
Merge psbt into this.
Definition: psbt.cpp:20
PSBTInput::hd_keypaths
std::map< CPubKey, KeyOriginInfo > hd_keypaths
Definition: psbt.h:49
CTxOut
An output of a transaction.
Definition: transaction.h:130
PartiallySignedTransaction::Unserialize
void Unserialize(Stream &s)
Definition: psbt.h:392
PSBTInput::Unserialize
void Unserialize(Stream &s)
Definition: psbt.h:106
PSBTRole::SIGNER
@ SIGNER
PSBT_IN_PARTIAL_SIG
static constexpr uint8_t PSBT_IN_PARTIAL_SIG
Definition: psbt.h:25
PartiallySignedTransaction::GetInputUTXO
bool GetInputUTXO(CTxOut &utxo, int input_index) const
Finds the UTXO for a given input index.
Definition: psbt.cpp:56
DeserializeHDKeypaths
void DeserializeHDKeypaths(Stream &s, const std::vector< uint8_t > &key, std::map< CPubKey, KeyOriginInfo > &hd_keypaths)
Definition: sign.h:115
PSBTRole::CREATOR
@ CREATOR
PSBTRoleName
std::string PSBTRoleName(PSBTRole role)
Definition: psbt.cpp:278
PSBTOutput::IsNull
bool IsNull() const
Definition: psbt.cpp:146
UnserializeFromVector
void UnserializeFromVector(Stream &s, X &... args)
Definition: sign.h:103
PSBTOutput::unknown
std::map< std::vector< uint8_t >, std::vector< uint8_t > > unknown
Definition: psbt.h:237
sign.h
PartiallySignedTransaction::tx
std::optional< CMutableTransaction > tx
Definition: psbt.h:336
PSBTInput::Merge
void Merge(const PSBTInput &input)
Definition: psbt.cpp:111
SigHashType
Signature hash type wrapper class.
Definition: sighashtype.h:37
PSBTOutput
A structure for PSBTs which contains per output information.
Definition: psbt.h:234
CPubKey::COMPRESSED_SIZE
static constexpr unsigned int COMPRESSED_SIZE
Definition: pubkey.h:37
PSBTInput::sighash_type
SigHashType sighash_type
Definition: psbt.h:52
PSBT_OUT_BIP32_DERIVATION
static constexpr uint8_t PSBT_OUT_BIP32_DERIVATION
Definition: psbt.h:33
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:430
PartiallySignedTransaction::AddOutput
bool AddOutput(const CTxOut &txout, const PSBTOutput &psbtout)
Definition: psbt.cpp:49
PSBT_IN_BIP32_DERIVATION
static constexpr uint8_t PSBT_IN_BIP32_DERIVATION
Definition: psbt.h:28
SigHashType::getRawSigHashType
uint32_t getRawSigHashType() const
Definition: sighashtype.h:83
PSBTRole::EXTRACTOR
@ EXTRACTOR
FinalizeAndExtractPSBT
bool FinalizeAndExtractPSBT(PartiallySignedTransaction &psbtx, CMutableTransaction &result)
Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.
Definition: psbt.cpp:246
SignPSBTInput
bool SignPSBTInput(const SigningProvider &provider, PartiallySignedTransaction &psbt, int index, SigHashType sighash=SigHashType(), SignatureData *out_sigdata=nullptr, bool use_dummy=false)
Signs a PSBTInput, verifying that all provided data matches what is being signed.
Definition: psbt.cpp:185
attributes.h
PSBT_IN_SCRIPTSIG
static constexpr uint8_t PSBT_IN_SCRIPTSIG
Definition: psbt.h:29
PSBTInput::FillSignatureData
void FillSignatureData(SignatureData &sigdata) const
Definition: psbt.cpp:72
PSBTOutput::Merge
void Merge(const PSBTOutput &output)
Definition: psbt.cpp:150
CPubKey
An encapsulated public key.
Definition: pubkey.h:31
DecodeBase64PSBT
NODISCARD bool DecodeBase64PSBT(PartiallySignedTransaction &decoded_psbt, const std::string &base64_psbt, std::string &error)
Decode a base64ed PSBT into a PartiallySignedTransaction.
Definition: psbt.cpp:295
PSBTInput
A structure for PSBTs which contain per-input information.
Definition: psbt.h:45
PartiallySignedTransaction::unknown
std::map< std::vector< uint8_t >, std::vector< uint8_t > > unknown
Definition: psbt.h:339
PSBTRole::FINALIZER
@ FINALIZER
PSBTInput::FromSignatureData
void FromSignatureData(const SignatureData &sigdata)
Definition: psbt.cpp:90
PartiallySignedTransaction
A version of CTransaction with the PSBT format.
Definition: psbt.h:335
PSBTOutput::Serialize
void Serialize(Stream &s) const
Definition: psbt.h:245
PSBT_OUT_REDEEMSCRIPT
static constexpr uint8_t PSBT_OUT_REDEEMSCRIPT
Definition: psbt.h:32
PSBTInput::PSBTInput
PSBTInput(deserialize_type, Stream &s)
Definition: psbt.h:228
PSBTInput::utxo
CTxOut utxo
Definition: psbt.h:46
PSBTRole
PSBTRole
Definition: psbt.h:507
CTxIn::scriptSig
CScript scriptSig
Definition: transaction.h:64
PartiallySignedTransaction::outputs
std::vector< PSBTOutput > outputs
Definition: psbt.h:338
CPubKey::IsFullyValid
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid())
Definition: pubkey.cpp:257
PSBTInput::Serialize
void Serialize(Stream &s) const
Definition: psbt.h:60
prevector::empty
bool empty() const
Definition: prevector.h:388
PartiallySignedTransaction::PartiallySignedTransaction
PartiallySignedTransaction(deserialize_type, Stream &s)
Definition: psbt.h:502
MAX_FILE_SIZE_PSBT
const std::streamsize MAX_FILE_SIZE_PSBT
Definition: psbt.h:42
PSBT_SEPARATOR
static constexpr uint8_t PSBT_SEPARATOR
Definition: psbt.h:38
PSBTInput::redeem_script
CScript redeem_script
Definition: psbt.h:47
SerializeToVector
void SerializeToVector(Stream &s, const X &... args)
Definition: sign.h:95
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:48
PSBTInput::IsNull
bool IsNull() const
Definition: psbt.cpp:67
PSBTOutput::FromSignatureData
void FromSignatureData(const SignatureData &sigdata)
Definition: psbt.cpp:137
MakeSpan
constexpr Span< A > MakeSpan(A(&a)[N])
MakeSpan for arrays:
Definition: span.h:229
DecodeRawPSBT
NODISCARD bool DecodeRawPSBT(PartiallySignedTransaction &decoded_psbt, const std::string &raw_psbt, std::string &error)
Decode a raw (binary blob) PSBT into a PartiallySignedTransaction.
Definition: psbt.cpp:306
PSBTOutput::hd_keypaths
std::map< CPubKey, KeyOriginInfo > hd_keypaths
Definition: psbt.h:236
PartiallySignedTransaction::Serialize
void Serialize(Stream &s) const
Definition: psbt.h:362
CPubKey::GetID
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
Definition: pubkey.h:140
CMutableTransaction
A mutable version of CTransaction.
Definition: transaction.h:278
SerializeHDKeypaths
void SerializeHDKeypaths(Stream &s, const std::map< CPubKey, KeyOriginInfo > &hd_keypaths, uint8_t type)
Definition: sign.h:153