I would like to create a PSBT with a single output (P2WSH with a given/predefined amount) in an app and give that to the user. The user should then be able to fund this PSBT with the help of bitcoind and/or a hardware wallet. With "fund" I mean add an input with sufficient balance, perform fee estimation and add a change output if necessary. The fully funded and finalized (all inputs signed/witnesses added) PSBT would then be given back to the app to continue the workflow.

My question: Is there a workflow with bitcoind that allows that? I have tried walletprocesspsbt but that only adds an input, no change output. And there are no parameters for fee estimation.

An alternative workflow that would fit my use case would be to use walletcreatefundedpsbt where the user would specify the amount of the output to fund but leave the address/PK script to be defined. But as I understand the walletcreatefundedpsbt command, the address has to be given for an output. Or could the data part be used to mark an output as "incomplete"/"to be defined"?

  • You should have the user call walletcreatefundedpsbt with the address/amount you want, which will then add inputs and change. If that's what you mean by the "alternative workflow", what is the problem with it? Feb 26, 2020 at 20:12
  • That's what I currently do as a workaround. But I was wondering if there was a way to transport the parameters in a PSBT directly instead of the user copy/pasting individual values and potentially mistyping the amount. So it's probably just a question about user experience at this point. I just wanted to make sure there isn't something obvious I missed in any of the PSBT commands/options.
    – guggero
    Feb 26, 2020 at 21:00
  • Ah, PSBT only functions in the pipeline as of the stage where you have an actual transaction (ignoring witness/scriptSigs), so you need to know the inputs/outputs before you can talk about a PSBT. Feb 26, 2020 at 21:20
  • Ok, that makes sense. Thank you!
    – guggero
    Feb 26, 2020 at 21:23


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.