bitcoin-qt fails to parse binary psbt file #27697

issue kallerosenbaum opened this issue on May 18, 2023
  1. kallerosenbaum commented at 11:28 AM on May 18, 2023: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    I run bitcoin-qt in regtest mode. The wallet is created blank and I've imported descriptors to it. I have a total of 30 BTC in two outputs. I create a new transaction and save it as a PSBT for offline signing. When I try to read this file into bitcoin-qt again, it shows an error dialog with the message:

    Unable to decode PSBT
    CDataStream::read(): end of data: iostream error
    

    I've used this exact scenario successfully before, but with different wallets and with a different regtest blockchain.

    I've packed the full directory of my setup so that you can test what's going on. It was a bit too big to upload here so I put in on Google Drive: https://drive.google.com/file/d/1ILaYwsXuj3nG62UbGIh1k7q91fzcSbSG/view?usp=sharing

    I've tested this tar.tz on another laptop with the same result, so you should be able to reproduce it by following the instructions below.

    Expected behaviour

    The PSBT should be loaded with no issues.

    Steps to reproduce

    Using that tar.gz file provided in this issue:

    unpack the tar.gz file, This will create a folder called online cd online ./bitcoin-24.0.1/bin/bitcoin-qt -datadir=.bitcoin

    Go to the Send tab and enter the address bcrt1qm24myvzr3fv53q6cx3aghfp44x4r6let80sn5j and amount 25 BTC Click "Create Unsigned" Clich "Create Unsigned" Enter a file name and Click "Save"

    The PSBT is now saved on disk

    In the same Bitcoin Core instance open the PSBT by:

    File -> Load PSBT From File Browse to the PSBT file you saved and click Open

    An error box appears saying:

    Unable to decode PSBT CDataStream::read(): end of data: iostream error

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Pre-built binaries

    What version of Bitcoin Core are you using?

    24.0.1

    Operating system and version

    Debian 11

    Machine specifications

    No response

  2. kallerosenbaum commented at 12:14 PM on May 18, 2023: none

    Tested on version 25.0rc2. It works there.

  3. fanquake commented at 12:15 PM on May 18, 2023: member

    Tested on version 25.0rc2. It works there.

    Ok. We can close this then.

    Maybe fixed with https://github.com/bitcoin-core/gui/pull/469 ?

  4. fanquake closed this on May 18, 2023

  5. kallerosenbaum commented at 12:25 PM on May 18, 2023: none

    A psbt file that's saved in 24.0.1 and that failed to open in 24.0.1, could successfully be opened in 25.0rc2. I guess this means that the saved psbt file is valid and that it's the parsing of the psbt file that is buggy.

  6. kallerosenbaum commented at 12:30 PM on May 18, 2023: none

    However, I'm not sure https://github.com/bitcoin-core/gui/pull/469 fixed it, because the saved psbt is binary. Attaching my psbt file (renamed to *.txt to circumvent upload restrictions) test3.psbt.txt

  7. kallerosenbaum commented at 12:55 PM on May 18, 2023: none

    If I convert the test3.psbt.txt (binary) file to a base64 file, I can then read the base64 into bitcoin core.

    $ cat test3.psbt.txt|base64 -w0 > test3.psbt
    $ cat test3.psbt
    cHNidP8BAJoCAAAAAsr82qqLowOgFHTVg3kKwsdL2HgrQ1EiWtncwJloXmKjAQAAAAD9////oJF6FZAH0GnMiJ1jeS4V3CS+v5uwWgZiq+ZW6kdpVgIAAAAAAP3///8CL2TNHQAAAAAWABSO8ytBoDopRn6vDO0wscKgmbV81QD5ApUAAAAAFgAU2quyMEOKWUiDWDR6i6Q1qao9fytqAAAAAAEAcQIAAAABoJF6FZAH0GnMiJ1jeS4V3CS+v5uwWgZiq+ZW6kdpVgIBAAAAAP3///8CspA1dwAAAAAWABQNmCj4+PwF5coaKwhDApykNhOZ3ACUNXcAAAAAFgAUwrVLa1ySW/8gbd8SGpXWFYdOTPNoAAAAAQEfAJQ1dwAAAAAWABTCtUtrXJJb/yBt3xIaldYVh05M8yIGA26fHxUVYZSOqcmMZeXL7VlkysZbEhE2gCkvjJJRgvnUGJl4PLxUAACAAQAAgAAAAIAAAAAAAQAAAAABAHECAAAAAXKe8IfRhYEeM0LI9X5Ewrd6vcSidaDx2n+opkIYBMurAAAAAAD9////AgDKmjsAAAAAFgAUi0hDKNwqd7uaumZhB+Cq+NRG7GZZJmvuAAAAABYAFNZw70A6a0EukW3JJmzbUms/8nQeZQAAAAEBHwDKmjsAAAAAFgAUi0hDKNwqd7uaumZhB+Cq+NRG7GYiBgN7sIgFGoOglZJQwmxpYYeKyQsJq2/VTZbDHyawMTKeAxiZeDy8VAAAgAEAAIAAAACAAAAAAAAAAAAAIgID3WqdkmLLB9YhCW420/dbXqRiZc5YX9UGnLU/kaVhSs0YmXg8vFQAAIABAACAAAAAgAEAAAALAAAAAAA=
    
  8. fanquake commented at 1:05 PM on May 18, 2023: member

    Ok. Could continue discussion with an issue in https://github.com/bitcoin-core/gui if still relevant?

    cc @achow101

  9. achow101 commented at 2:48 PM on May 18, 2023: member
  10. fanquake commented at 2:52 PM on May 18, 2023: member

    I think https://github.com/bitcoin-core/gui/pull/687 was the fix.

    Right. So fixed in 24.1 as well.

  11. maflcko commented at 3:00 PM on May 18, 2023: member

    Backported in 0da38b6b0e74ee4479553d2bf611593fa51d54b3

  12. kallerosenbaum renamed this:
    bitcoin-qt generates bad psbt
    bitcoin-qt fails to parse binary psbt file
    on May 18, 2023
  13. kallerosenbaum commented at 3:05 PM on May 18, 2023: none

    Thanks for you quick responses. Will use 25rc2 instead then.

  14. bitcoin locked this on May 17, 2024

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-03 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me