[BIP 174] Implement serialization support for GLOBAL_XPUB field. #16463

pull achow101 wants to merge 8 commits into bitcoin:master from achow101:bip174-xpub changing 9 files +225 −75
  1. achow101 commented at 5:45 PM on July 25, 2019: member

    https://github.com/bitcoin/bips/pull/784 added a new global field GLOBAL_XPUB to BIP 174. This PR adds support for (de)serializing this field and displaying it in decodepsbt.

  2. DrahtBot added the label RPC/REST/ZMQ on Jul 25, 2019
  3. DrahtBot added the label Tests on Jul 25, 2019
  4. DrahtBot commented at 8:27 PM on July 25, 2019: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #17034 (Bip174 extensions by achow101)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  5. achow101 force-pushed on Jul 31, 2019
  6. laanwj added this to the milestone 0.20.0 on Oct 4, 2019
  7. DrahtBot added the label Needs rebase on Oct 9, 2019
  8. achow101 force-pushed on Oct 9, 2019
  9. achow101 force-pushed on Oct 9, 2019
  10. DrahtBot removed the label Needs rebase on Oct 9, 2019
  11. jonatack cross-referenced this on Oct 10, 2019 from issue Future PRs by jnewbery
  12. DrahtBot added the label Needs rebase on Oct 30, 2019
  13. achow101 force-pushed on Oct 31, 2019
  14. DrahtBot removed the label Needs rebase on Oct 31, 2019
  15. DrahtBot added the label Needs rebase on Nov 20, 2019
  16. achow101 force-pushed on Nov 20, 2019
  17. DrahtBot removed the label Needs rebase on Nov 20, 2019
  18. DrahtBot cross-referenced this on Feb 11, 2020 from issue rpc: Auto-format RPCResult by MarcoFalke
  19. DrahtBot cross-referenced this on Feb 11, 2020 from issue [BIP 174] PSBT version, proprietary, and xpub fields by achow101
  20. DrahtBot cross-referenced this on Feb 25, 2020 from issue descriptors: improve descriptor cache and cache xpubs by achow101
  21. DrahtBot cross-referenced this on Feb 27, 2020 from issue Native Descriptor Wallets using DescriptorScriptPubKeyMan by achow101
  22. DrahtBot added the label Needs rebase on Mar 4, 2020
  23. achow101 force-pushed on Mar 4, 2020
  24. DrahtBot removed the label Needs rebase on Mar 5, 2020
  25. DrahtBot cross-referenced this on Mar 11, 2020 from issue Serialization improvements step 6 (all except wallet/gui) by sipa
  26. in src/psbt.h:521 in 63f705bb9d outdated
     515 | @@ -424,6 +516,18 @@ struct PartiallySignedTransaction
     516 |          OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion() | SERIALIZE_TRANSACTION_NO_WITNESS);
     517 |          SerializeToVector(os, *tx);
     518 |  
     519 | +        // Write xpubs
     520 | +        for (const auto xpub_pair : xpubs) {
     521 | +            for (const auto xpub : xpub_pair.second) {
    


    jonatack commented at 5:54 PM on March 24, 2020:

    suggested change to reference instead of copy in range loops:

    -        for (const auto xpub_pair : xpubs) {
    -            for (const auto xpub : xpub_pair.second) {
    +        for (const auto& xpub_pair : xpubs) {
    +            for (const auto& xpub : xpub_pair.second) {
    

    jonatack commented at 5:59 PM on March 24, 2020:

    (this also fixes warnings if you build with -Wrange-loop-analysis)


    achow101 commented at 6:57 PM on March 26, 2020:

    Done, also in a few other places.

  27. laanwj removed this from the milestone 0.20.0 on Mar 26, 2020
  28. laanwj added this to the milestone 0.21.0 on Mar 26, 2020
  29. laanwj added the label Feature on Mar 26, 2020
  30. DrahtBot cross-referenced this on Mar 26, 2020 from issue gui: save and load PSBT by Sjors
  31. achow101 force-pushed on Mar 26, 2020
  32. DrahtBot cross-referenced this on Mar 27, 2020 from issue "PSBT Operations" dialog by gwillen
  33. DrahtBot cross-referenced this on Mar 27, 2020 from issue UI external signer support (e.g. hardware wallet) by Sjors
  34. DrahtBot cross-referenced this on Mar 27, 2020 from issue External signer support - Wallet Box edition by Sjors
  35. DrahtBot cross-referenced this on Apr 13, 2020 from issue rpc: gui: Don't change behavior based on private keys disabled, instead add new buttons/rpcs/menu items by achow101
  36. DrahtBot cross-referenced this on Apr 15, 2020 from issue gui: Add a `Make unsigned` button next to `Send` by achow101
  37. DrahtBot added the label Needs rebase on Apr 23, 2020
  38. achow101 force-pushed on Apr 23, 2020
  39. DrahtBot removed the label Needs rebase on Apr 23, 2020
  40. DrahtBot added the label Needs rebase on Apr 27, 2020
  41. achow101 force-pushed on Apr 27, 2020
  42. DrahtBot removed the label Needs rebase on Apr 27, 2020
  43. DrahtBot cross-referenced this on May 20, 2020 from issue net: Use C++11 member initialization in protocol by MarcoFalke
  44. DrahtBot added the label Needs rebase on May 20, 2020
  45. achow101 force-pushed on May 20, 2020
  46. DrahtBot removed the label Needs rebase on May 20, 2020
  47. luke-jr referenced this in commit 93bde8969b on Jun 9, 2020
  48. luke-jr referenced this in commit 596415fa60 on Jun 9, 2020
  49. luke-jr referenced this in commit 82ceb28258 on Jun 9, 2020
  50. luke-jr referenced this in commit 51d9a2c365 on Jun 9, 2020
  51. luke-jr referenced this in commit 717793f4d6 on Jun 9, 2020
  52. luke-jr referenced this in commit b8e1e58a5c on Jun 9, 2020
  53. luke-jr referenced this in commit 847d2c4d63 on Jun 9, 2020
  54. luke-jr referenced this in commit efd999d85c on Jun 12, 2020
  55. luke-jr referenced this in commit 8250efa76c on Jun 12, 2020
  56. luke-jr referenced this in commit 3e8b22baae on Jun 12, 2020
  57. luke-jr referenced this in commit 38466f0407 on Jun 12, 2020
  58. luke-jr referenced this in commit 3ed04658c4 on Jun 12, 2020
  59. luke-jr referenced this in commit 9b0cdc3212 on Jun 12, 2020
  60. luke-jr referenced this in commit 1090a9cb93 on Jun 12, 2020
  61. laanwj removed this from the milestone 0.21.0 on Oct 8, 2020
  62. achow101 cross-referenced this on Nov 30, 2020 from issue PSBT is not handling PSBT_GLOBAL_XPUB by benma
  63. achow101 force-pushed on Jan 4, 2021
  64. in src/script/sign.h:103 in 10e209e778 outdated
      98 | -    }
      99 | -}
     100 | -
     101 | -// Deserialize HD keypaths into a map
     102 | -template<typename Stream>
     103 | -void DeserializeHDKeypaths(Stream& s, const std::vector<unsigned char>& key, std::map<CPubKey, KeyOriginInfo>& hd_keypaths)
    


    adamjonas commented at 4:56 PM on January 12, 2021:

    This move appears to be messing with the fuzzer in /fuzz/script.cpp which is looking for these functions.


    achow101 commented at 8:41 PM on January 12, 2021:

    Fixed I think

  65. moveonly: Move (Un)Serialize(To/From)Vector, (De)SerializeHDKeypaths to psbt module
    SerializeToVector, UnserializeFromVector, DeserializeHDKeypaths, and SerializeHDKeypaths
    were in sign.h where PSBT was originally implemented. Since all of the PSBT serialization
    has moved to its own file, these functions should follow.
    30a9b28d8e
  66. Store version bytes and be able to serialize them in CExtPubKey
    CExtPubKey does not store the version bytes for the extended public key.
    We store these so that a CExtPubKey can be serialized and deserialized with
    the same version bytes.
    f8a078d9bf
  67. Separate individual HD Keypath serialization into separate functions 868281d1dc
  68. Implement operator< for KeyOriginInfo and CExtPubKey 22e7161feb
  69. Implement serializations for PSBT_GLOBAL_XPUB 6c121791b9
  70. Add global_xpubs to decodepsbt ebb194838d
  71. Add global xpub test vectors from BIP 4bf66a3743
  72. Merge global xpubs in joinpsbts and combinepsbts 9926a387ea
  73. achow101 force-pushed on Jan 12, 2021
  74. achow101 commented at 10:07 PM on January 25, 2021: member

    Combining this PR with #17034

  75. achow101 closed this on Jan 25, 2021

  76. laanwj referenced this in commit 50c502f54a on Dec 10, 2021
  77. sidhujag referenced this in commit 525d6c6f49 on Dec 11, 2021
  78. bitcoin locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:54 UTC