Skip to content

Conversation

@lcovar
Copy link
Contributor

@lcovar lcovar commented Dec 22, 2025

commit: ea36e1b

Add opt-in PSBT support for legacy v1 wallet transactions. When
usePsbt: true is passed to createTransaction, the function now
returns a PSBT hex in the transactionHex field instead of a legacy
unsigned transaction hex.

Key changes:

  • Add buildPsbt function in transactionBuilder.ts that constructs
    a PSBT with embedded signing metadata (BIP32 derivation paths,
    redeem/witness scripts, global xpubs)
  • Add createRootWalletKeysFromV1Keychains helper to convert v1
    keychain format to utxo-lib's RootWalletKeys
  • Update signTransaction in wallet.ts to auto-detect PSBT format
    using utxolib.bitgo.isPsbt() and route to appropriate signing
  • Add comprehensive tests verifying PSBT output matches legacy tx
    structure

The PSBT format embeds all signing metadata directly in the
transaction, eliminating the need for a separate unspents array.
This prepares v1 wallets for gradual migration to PSBT-based signing.

Default behavior remains legacy format for backward compatibility.
Use usePsbt: true to opt-in to PSBT format.

commit: 8d81f4c

Add PSBT transaction building capability for legacy v1 wallets with
gradual rollout:

  • 10% of mainnet transactions use PSBT format
  • 100% of testnet transactions use PSBT format
  • Explicit usePsbt: true/false always takes precedence

commit: 8f512a1

Add fallback mechanism for PSBT transactions in the SDK. When PSBT
is requested but fails, automatically retry with legacy transaction
format and record the error details for reporting.

@lcovar lcovar requested a review from a team as a code owner December 22, 2025 21:36
@lcovar lcovar marked this pull request as draft December 22, 2025 21:44
Add opt-in PSBT support for legacy v1 wallet transactions. When
`usePsbt: true` is passed to `createTransaction`, the function now
returns a PSBT hex in the `transactionHex` field instead of a legacy
unsigned transaction hex.

Key changes:
- Add `buildPsbt` function in transactionBuilder.ts that constructs
  a PSBT with embedded signing metadata (BIP32 derivation paths,
  redeem/witness scripts, global xpubs)
- Add `createRootWalletKeysFromV1Keychains` helper to convert v1
  keychain format to utxo-lib's RootWalletKeys
- Update `signTransaction` in wallet.ts to auto-detect PSBT format
  using `utxolib.bitgo.isPsbt()` and route to appropriate signing
- Add comprehensive tests verifying PSBT output matches legacy tx
  structure

The PSBT format embeds all signing metadata directly in the
transaction, eliminating the need for a separate `unspents` array.
This prepares v1 wallets for gradual migration to PSBT-based signing.

Default behavior remains legacy format for backward compatibility.
Use `usePsbt: true` to opt-in to PSBT format.

TICKET: BTC-2894

TICKET: BTC-2894
Add PSBT transaction building capability for legacy v1 wallets with
gradual rollout:
- 10% of mainnet transactions use PSBT format
- 100% of testnet transactions use PSBT format
- Explicit usePsbt: true/false always takes precedence

TICKET: BTC-2894
Add fallback mechanism for PSBT transactions in the SDK. When PSBT
is requested but fails, automatically retry with legacy transaction
format and record the error details for reporting.

Co-authored-by: llm-git <llm-git@ttll.de>

Ticket: BTC-2894

TICKET: BTC-2894
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants