Description
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.
- PR: remove signers
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
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
ItoroD commentedon Jan 12, 2026
bitcoindevkit/book-of-bdk#159 (comment)
Additional PRs for context
Xprvwith key origin info rust-bitcoin/rust-miniscript#872derivation_pathfor keys with origin rust-bitcoin/rust-miniscript#867GetKeyimpl from #851 rust-bitcoin/rust-miniscript#860ItoroD commentedon Jun 30, 2026
FYI
Additional PRs for context
bdk-wallet 235 superseded by 505
ItoroD commentedon Jul 22, 2026
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
This is the closes to what we have in rust. I see now that we might not need
secpCtxas 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
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
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
Psbt::sign#1060 as a duplicate of this issue