Skip to content

Add Psbt::sign API to Psbt type #866

Open
0 of 1 issue completed
Open

Description

@ItoroD

Describe the enhancement

Psbt::sign is yet to exposed in our Psbt type. This allows you to sign a Psbt be simply calling the sign method from rust-bitcoin Psbt::sign on the psbt you would like to sign.

Use case

  • To sign a psbt

Additional context

In preparation for bdk-wallet 3.0 migration, Signers will be removed from bdk-wallet as described here. Having this feature serves as a replacement and enhancement of how we sign psbt's.

Using the sign method requires as parameters a type that impelements GetKey and a Secp256k1. For GetKey it is important to note that types like KeyMap and DescriptorSecretKey have implemented GetKey in rust-miniscript and there might be no need to create any extra types here in FFI. KeyMap and DescriptorSecretKey are existing types in FFI which will have access to implemented GetKey;

  • once bdk-wallet updates to rust-miniscript version that has GetKey implementation for those types,
  • and then bdk-ffi updates to updated bdk-wallet version.

Once psbt sign method is exposed, and the above conditions fulfilled, using psbt.sign will be as simple as passing the Descriptor's KeyMap as param. Below is the PR to watch/wait for, for this issue to be completed.

Note: In order to see how sign from psbt will work here in FFI even before all above conditions are satisfied, one can use a SignerWrapper from testutils like in PR: remove signers

Activity

  1. ItoroD commented on Jun 30, 2026

    @ItoroD
    ContributorAuthor

    FYI

    Additional PRs for context

    bdk-wallet 235 superseded by 505

  2. ItoroD commented on Jul 22, 2026

    @ItoroD
    ContributorAuthor

    Current status of this is putting together how the API for psbt sign should be revealed in the bindings. What parameters do we want the user to input? what return type should the user get ? Below are a few iterations and what we have come up with.

    Option 1

    psbt.sign(keyMapWrapper, secpCtx);

    This is the closes to what we have in rust. I see now that we might not need secpCtx as we can use it under the hood in bdk-ffi rust side when creating psbt sign method (Thanks to input from Thunder). Which leads to next iteration.

    Option 2

    psbt.sign(keyMapWrapper);

    Here, secpCtx has been taken out and only keyMapWrapper remains. Now I am thinking we can also just pass keyMap itself instead of exposing another type called KeyMapWrapper because all it does it implements getKey and wraps keyMap. We can handle the wrapping under the hood like we do with secpCtx once keyMap has been passed.

    Option 2

    psbt.sign(keyMap);

    One thing to also note is that our users have never had access to keyMap from the descriptor type. I have done a draft PR here that allows keymap in the bindings with option 2 for now. I am trying to add a test in our android test showing psbt.sign works. I will push that to the draft as well.

    cc @thunderbiscuit @reez

  3. marked Expose Psbt::sign #1060 as a duplicate of this issue on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions