Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sign_psbt_input #1219

Open
benthecarman opened this issue Nov 15, 2023 · 4 comments
Open

Add sign_psbt_input #1219

benthecarman opened this issue Nov 15, 2023 · 4 comments
Labels
api A breaking API change module-wallet new feature New feature or request

Comments

@benthecarman
Copy link
Contributor

Describe the enhancement
Currently there is a sign_psbt function that works great, however, it does not give us fine grained control over which inputs are signed, it just signs everything it can. This can be unsafe for multi-party protocols where they could give us one of our own inputs and we sign it for them. To get around this currently we need to sign the whole psbt and then just take the info from the input we wanted, which is inefficient.

@benthecarman benthecarman added the new feature New feature or request label Nov 15, 2023
@notmandatory notmandatory added this to BDK Nov 15, 2023
@notmandatory notmandatory added this to the 1.0.0-alpha.4 milestone Nov 15, 2023
@notmandatory
Copy link
Member

Added to alpha.4 for now so we make sure to discuss it before we wrap up our beta API. We may need to target this to a follow-up 1.1 release since it sounds like a non-breaking enhancement.

@notmandatory notmandatory moved this to Todo in BDK Nov 15, 2023
@benthecarman
Copy link
Contributor Author

benthecarman commented Nov 15, 2023

Thanks! The alternative isn't too bad just need to do this for now:

let mut to_sign = psbt.clone();
wallet.sign(&mut to_sign, sig_options)?;
psbt.inputs[input_index] = to_sign.inputs[input_index].clone();

@LLFourn
Copy link
Contributor

LLFourn commented Nov 16, 2023

FWIW I would love to remove "signers" from the wallet and just have a bunch of ways to sign PSBT inputs with fine grained control about what is signed. It needs some design work but I'd put it in a new crate like bdk_psbt. A good time to do this would be while integrating the miniscript planning module.

@nondiremanuel nondiremanuel modified the milestones: 1.0.0-alpha.4, 1.0.0 Jan 6, 2024
@notmandatory notmandatory added module-wallet api A breaking API change labels Mar 18, 2024
@notmandatory
Copy link
Member

Since this can be done as a non-breaking change I think we should push to post 1.0 milestone.

@nondiremanuel nondiremanuel removed this from the 1.0.0-alpha milestone Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api A breaking API change module-wallet new feature New feature or request
Projects
Status: Todo
Development

No branches or pull requests

4 participants