Skip to content

refactor(withdrawals): enforce preview-then-execute workflow to prevent duplicate signing#4

Open
CharlVS wants to merge 2 commits intoKomodo-Community:devfrom
GLEECBTC:fix/avoid-multi-signing-withdraws
Open

refactor(withdrawals): enforce preview-then-execute workflow to prevent duplicate signing#4
CharlVS wants to merge 2 commits intoKomodo-Community:devfrom
GLEECBTC:fix/avoid-multi-signing-withdraws

Conversation

@CharlVS
Copy link
Copy Markdown
Collaborator

@CharlVS CharlVS commented Nov 26, 2025

Copied from upstream PR GLEECBTC#276

Overview

Refactored SDK withdrawals to enforce a secure preview-then-execute workflow, ensuring transactions are signed only once and users always review what they're signing.

Problem

Previously, when a user previewed a withdrawal and then executed it, the transaction was being signed twice:

  1. Preview Phase: Transaction was signed and created
  2. Execute Phase: A NEW transaction was signed and created (discarding the preview)

Solution

Enforced a secure two-step withdrawal workflow:

  1. Preview - Signs the transaction and shows details to user
  2. Execute - Broadcasts the already-signed transaction

Benefits

  1. Security: User ALWAYS sees and confirms the EXACT transaction before broadcast
  2. No Duplicate Signing: Transaction is signed only once, saving resources
  3. Hardware Wallet Friendly: Only one hardware wallet interaction per withdrawal
  4. Better UX: Users can review fees, amounts, and addresses before confirming

CharlVS and others added 2 commits October 31, 2025 15:32
…nt duplicate signing

- Add executeWithdrawal() method to broadcast pre-signed transactions
- Deprecate withdraw() method in favor of two-step preview-execute flow
- Update example app to use new executeWithdrawal() method
- Prevents transactions from being signed multiple times
- Ensures users always review transaction details before broadcast

Breaking Changes:
- withdraw() is now deprecated (still functional but not recommended)
- Recommended flow: previewWithdrawal() → executeWithdrawal()
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.

1 participant