LearnBitcoin

Bitcoin Dev Archive 2025

Who uses or wants to use PSBTv2 (BIP370)

6 messages, 17 Jan 2025. Started by Sjors Provoost.

Salvatore Ingala (2), Kalle Rosenbaum (2), Sjors Provoost, Andrew Toth

Permalink Original thread on gnusha.org

Sjors Provoost permalink original

Dear list,

It's been a few years since BIP370 was proposed [0]. It's a backwards compatible change to the PSBT standard defined by BIP174 [1]. Its main benefit is the ability to add new inputs and outputs to a transaction.

There's a Bitcoin Core pull request #21283 implements support [2], but has seen very little review so far. Being able to test it against other implementation would aid in review.

So which projects are using PSBTv2 or would very much like to?

So far I've learned that Core Lightning uses it. They convert it back to v0 when interacting with Bitcoin Core, which they find suboptimal [3].

Feel free to answer here on Stack Exchange [4].

Kind regards,

Sjors Provoost

[0] https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki
[1] https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
[2] https://github.com/bitcoin/bitcoin/pull/21283
[3] https://github.com/bitcoin/bitcoin/pull/21283#issuecomment-2597171643
[4] https://bitcoin.stackexchange.com/questions/125384/who-uses-or-wants-to-use-psbtv2-bip370
Salvatore Ingala in reply to Sjors Provoost permalink original

Hi Sjors,

The Ledger Bitcoin app uses PSBTv2 since version 2.0.0 in 2021 [0], quite possibly the first adopter - although for somewhat unusual reasons.

Working with embedded devices with just a few kb of RAM, even sending the entire PSBT is not generally feasible. Therefore, the client instead sends a 'merkleized' commitment to the entire PSBT at the beginning of the signing process. This enables the device to obtain random access to the PSBT by querying the client (who provides the data - and the Merkle proof - on demand).

In PsbtV0, the unsigned transaction is a binary blob, which was a huge headache because the device had to parse it while streaming it (and therefore, no RAM access to the individual transaction fields is possible). PsbtV2 fixed this by having the transaction already 'parsed' into individual fields.

The companion client libraries of the Ledger Bitcoin app support both versions, and PsbtV0 is converted to PsbtV2 on the fly. Broader support would certainly be useful.

Best, Salvatore Ingala

[0] https://www.ledger.com/blog/bitcoin-2
Kalle Rosenbaum in reply to Sjors Provoost permalink original

Sjors,

Ledger has a PSBTv2 implementation since a number of years back. It's used for communication between their Ledger Live software and the hardware wallet. https://github.com/LedgerHQ/ledger-live/blob/03b94dae50b1177801c57d9cee14cb5b4752b075/libs/ledgerjs/packages/hw-app-btc/src/newops/psbtv2.ts

/Kalle

On Fri, 17 Jan 2025 at 10:17, Sjors Provoost <sjors@sprovoost•nl> wrote:

Quoted text (37 lines)
> Dear list,
>
> It's been a few years since BIP370 was proposed [0]. It's a backwards
> compatible change to the PSBT standard defined by BIP174 [1]. Its main
> benefit is the ability to add new inputs and outputs to a transaction.
>
> There's a Bitcoin Core pull request #21283 implements support [2], but has
> seen very little review so far. Being able to test it against other
> implementation would aid in review.
>
> So which projects are using PSBTv2 or would very much like to?
>
> So far I've learned that Core Lightning uses it. They convert it back to
> v0 when interacting with Bitcoin Core, which they find suboptimal [3].
>
> Feel free to answer here on Stack Exchange [4].
>
> Kind regards,
>
> Sjors Provoost
>
> [0] https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki
> [1] https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
> [2] https://github.com/bitcoin/bitcoin/pull/21283
> [3] https://github.com/bitcoin/bitcoin/pull/21283#issuecomment-2597171643
> [4]
> https://bitcoin.stackexchange.com/questions/125384/who-uses-or-wants-to-use-psbtv2-bip370
>
> --
> You received this message because you are subscribed to the Google Groups
> "Bitcoin Development Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bitcoindev+unsubscribe@googlegroups•com.
> To view this discussion visit
> https://groups.google.com/d/msgid/bitcoindev/6FDAD97F-7C5F-474B-9EE6-82092C9073C5%40sprovoost.nl
> .
>
Kalle Rosenbaum in reply to Salvatore Ingala permalink original

I might have linked to a slightly outdated version of ledger's psbtv2. I haven't been involved lately. The correct one could be https://github.com/LedgerHQ/app-bitcoin-new/blob/53dfd1727ab55182f9e365747b26b862e48b7b8b/bitcoin_client_js/src/lib/psbtv2.ts. Is that right, Salvatore?

/Kalle

On Fri, 17 Jan 2025 at 11:03, Salvatore Ingala <salvatore.ingala@gmail•com> wrote:

Quoted text (37 lines)
> Hi Sjors,
>
> The Ledger Bitcoin app uses PSBTv2 since version 2.0.0 in 2021 [0], quite
> possibly the first adopter - although for somewhat unusual reasons.
>
> Working with embedded devices with just a few kb of RAM, even sending the
> entire PSBT is not generally feasible.
> Therefore, the client instead sends a 'merkleized' commitment to the
> entire PSBT at the beginning of the signing process.
> This enables the device to obtain random access to the PSBT by querying
> the client (who provides the data - and the Merkle proof - on demand).
>
> In PsbtV0, the unsigned transaction is a binary blob, which was a huge
> headache because the device had to parse it while streaming it (and
> therefore, no RAM access to the individual transaction fields is possible).
> PsbtV2 fixed this by having the transaction already 'parsed' into
> individual fields.
>
> The companion client libraries of the Ledger Bitcoin app support both
> versions, and PsbtV0 is converted to PsbtV2 on the fly.
> Broader support would certainly be useful.
>
> Best,
> Salvatore Ingala
>
> [0] https://www.ledger.com/blog/bitcoin-2
>
> --
> You received this message because you are subscribed to the Google Groups
> "Bitcoin Development Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bitcoindev+unsubscribe@googlegroups•com.
> To view this discussion visit
> https://groups.google.com/d/msgid/bitcoindev/CAMhCMoGONKFok_SuZkic%2BT%3DyoWZs5eeVxtwJL6Ei%3DyysvA8rrg%40mail.gmail.com
> <https://groups.google.com/d/msgid/bitcoindev/CAMhCMoGONKFok_SuZkic%2BT%3DyoWZs5eeVxtwJL6Ei%3DyysvA8rrg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
Salvatore Ingala in reply to Kalle Rosenbaum permalink original

Yes, but it is to be noted that all the Psbt implementations in the various Ledger client libraries are bare bones, containing just what's needed for the communication protocol. They are not general purpose and not otherwise complete (nor planned to become so).

Best, Salvatore Ingala

On Fri, 17 Jan 2025 at 11:38, Kalle Rosenbaum <kalle@rosenbaum•se> wrote:

Quoted text (48 lines)
> I might have linked to a slightly outdated version of ledger's psbtv2. I
> haven't been involved lately. The correct one could be
> https://github.com/LedgerHQ/app-bitcoin-new/blob/53dfd1727ab55182f9e365747b26b862e48b7b8b/bitcoin_client_js/src/lib/psbtv2.ts.
> Is that right, Salvatore?
>
> /Kalle
>
> On Fri, 17 Jan 2025 at 11:03, Salvatore Ingala <salvatore.ingala@gmail•com>
> wrote:
>
>> Hi Sjors,
>>
>> The Ledger Bitcoin app uses PSBTv2 since version 2.0.0 in 2021 [0], quite
>> possibly the first adopter - although for somewhat unusual reasons.
>>
>> Working with embedded devices with just a few kb of RAM, even sending the
>> entire PSBT is not generally feasible.
>> Therefore, the client instead sends a 'merkleized' commitment to the
>> entire PSBT at the beginning of the signing process.
>> This enables the device to obtain random access to the PSBT by querying
>> the client (who provides the data - and the Merkle proof - on demand).
>>
>> In PsbtV0, the unsigned transaction is a binary blob, which was a huge
>> headache because the device had to parse it while streaming it (and
>> therefore, no RAM access to the individual transaction fields is possible).
>> PsbtV2 fixed this by having the transaction already 'parsed' into
>> individual fields.
>>
>> The companion client libraries of the Ledger Bitcoin app support both
>> versions, and PsbtV0 is converted to PsbtV2 on the fly.
>> Broader support would certainly be useful.
>>
>> Best,
>> Salvatore Ingala
>>
>> [0] https://www.ledger.com/blog/bitcoin-2
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Bitcoin Development Mailing List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to bitcoindev+unsubscribe@googlegroups•com.
>> To view this discussion visit
>> https://groups.google.com/d/msgid/bitcoindev/CAMhCMoGONKFok_SuZkic%2BT%3DyoWZs5eeVxtwJL6Ei%3DyysvA8rrg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/bitcoindev/CAMhCMoGONKFok_SuZkic%2BT%3DyoWZs5eeVxtwJL6Ei%3DyysvA8rrg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
Andrew Toth in reply to Sjors Provoost permalink original

BIP375 Sending Silent Payments with PSBTs uses PSBTv2, specifically the PSBT_OUT_SCRIPT field.

For silent payments, the output script is not known at the time of creation, so it's not possible to create an unsigned transaction with an output script as required in v0.

On Friday, January 17, 2025 at 4:17:49 AM UTC-5 Sjors Provoost wrote:

Quoted text (27 lines)
> Dear list,
>
> It's been a few years since BIP370 was proposed [0]. It's a backwards
> compatible change to the PSBT standard defined by BIP174 [1]. Its main
> benefit is the ability to add new inputs and outputs to a transaction.
>
> There's a Bitcoin Core pull request #21283 implements support [2], but has
> seen very little review so far. Being able to test it against other
> implementation would aid in review.
>
> So which projects are using PSBTv2 or would very much like to?
>
> So far I've learned that Core Lightning uses it. They convert it back to
> v0 when interacting with Bitcoin Core, which they find suboptimal [3].
>
> Feel free to answer here on Stack Exchange [4].
>
> Kind regards,
>
> Sjors Provoost
>
> [0] https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki
> [1] https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki
> [2] https://github.com/bitcoin/bitcoin/pull/21283
> [3] https://github.com/bitcoin/bitcoin/pull/21283#issuecomment-2597171643
> [4]
> https://bitcoin.stackexchange.com/questions/125384/who-uses-or-wants-to-use-psbtv2-bip370