<p>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 <code>bitcoind</code> 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.</p>

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

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

CC BY-SA 4.0
2020-02-26T20:12:32.717Z
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?
Pieter Wuille
CC BY-SA 4.0
2020-02-26T21:00:25.153Z
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
CC BY-SA 4.0
2020-02-26T21:20:49.277Z
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.
Pieter Wuille
<bitcoind><wallet><bip174-psbt>
Fund single output in PSBT with bitcoind
guggero
# Fund single output in PSBT with bitcoind

(Asked by: username_0 on 2020-02-26)

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"?

**Tags:** bitcoind, wallet, bip174-psbt

> **Comments:**
> **username_1**: 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?  
> **username_0**: 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.  
> **username_1**: 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.  

---

## 0 answers

