Skip to content

Consider allowing users to see transaction details before sending onchain payments #578

Open

Description

@tnull

We should consider to allow users to see transaction details before sending onchain payments. In particular, they might want to see the fee they are going to pay before they actually send the onchain payment.

We could consider an API where we allow to 'stage' a pending transaction first, and then have the user release/cancel it with another call. However, if we do this, we'll have to figure out when/how to prune pending transactions if the user doesn't end up releasing/cancelling them.

The latter part is especially important as we need to make sure that, once BDK allows us to, lock the used UTXOs when staging, and unlock them in the cancellation case, or after some timeout.

As this introduces quite some complication to our payment flow, I'm not fully sold on the idea, but it indeed seems like a pretty useful feature for users.

Activity

  1. Camillarhi commented on Nov 2, 2025

    @Camillarhi
    Contributor

    @tnull , I've been thinking about this. Do we need the full staged transaction complexity?
    The main goal seems to be showing users the fee before they commit. Could we instead expose a simpler estimate_onchain_fee(amount, address) API that:

    • Calculates fee with current feerates
    • Returns the estimate

    This avoids UTXO locking, timeouts, and state management. Fees are dynamic anyway, so staging doesn't guarantee accuracy if feerates change between preview and send.
    We could start with this simpler approach and only add transaction staging later if users specifically need to preview the complete transaction structure. What do you think?

  2. tnull commented on Nov 7, 2025

    @tnull
    CollaboratorAuthor

    @tnull , I've been thinking about this. Do we need the full staged transaction complexity? The main goal seems to be showing users the fee before they commit. Could we instead expose a simpler estimate_onchain_fee(amount, address) API that:

    • Calculates fee with current feerates
    • Returns the estimate

    This avoids UTXO locking, timeouts, and state management. Fees are dynamic anyway, so staging doesn't guarantee accuracy if feerates change between preview and send. We could start with this simpler approach and only add transaction staging later if users specifically need to preview the complete transaction structure. What do you think?

    Hmm, well, the issue there is that not only fees might change, but also your wallet state might change inbetween, meaning that the wallet might end up adding or removing a (e.g., change) output, which could considerably shift the fees in one or the other direction.

    Note that we'll also have the same issue for splicing (cf. #677 (comment)), so working out an API design that works similarly in all cases would be preferable. That's why I'm hesitant to just 'ship the simple thing' right away.

  3. Camillarhi commented on Nov 7, 2025

    @Camillarhi
    Contributor

    Hmm, well, the issue there is that not only fees might change, but also your wallet state might change inbetween, meaning that the wallet might end up adding or removing a (e.g., change) output, which could considerably shift the fees in one or the other direction.

    Note that we'll also have the same issue for splicing (cf. #677 (comment)), so working out an API design that works similarly in all cases would be preferable. That's why I'm hesitant to just 'ship the simple thing' right away.

    I see, I will go through #677 to understand it and see if I have any more thought on this.
    Thanks

  4. f3r10 commented on Jul 28, 2026

    @f3r10
    Contributor

    Hi @tnull is this issue open to work on? It seems challenging. I am going to investigate further and see if I can come up with a viable approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions