2020-08-18 04:22:53 +02:00
lightning-utxopsbt -- Command to populate PSBT inputs from given UTXOs
================================================================
SYNOPSIS
--------
2022-11-11 02:44:56 +01:00
**utxopsbt** *satoshi* *feerate* *startweight* *utxos* [*reserve*] [*reservedok*] [*locktime*] [*min\_witness\_weight*] [*excess\_as\_change*]
2020-08-18 04:22:53 +02:00
DESCRIPTION
-----------
*utxopsbt* is a low-level RPC command which creates a PSBT using unreserved
inputs in the wallet, optionally reserving them as well.
It deliberately mirrors the parameters and output of
lightning-fundpsbt(7) except instead of an optional *minconf*
parameter to select unreserved outputs from the wallet, it takes a
compulsory list of outputs to use.
*utxos* must be an array of "txid:vout", each of which must be
reserved or available: the total amount must be sufficient to pay for
the resulting transaction plus *startweight* at the given *feerate* ,
with at least *satoshi* left over (unless *satoshi* is **all** , which
is equivalent to setting it to zero).
2020-08-18 04:22:55 +02:00
2022-04-01 06:12:45 +02:00
If *reserve* if not zero, then *reserveinputs* is called (successfully, with
*exclusive* true) on the returned PSBT for this number of blocks (default
72 blocks if unspecified).
2021-05-26 03:19:37 +02:00
2020-08-18 04:22:55 +02:00
Unless *reservedok* is set to true (default is false) it will also fail
if any of the *utxos* are already reserved.
2020-08-18 06:25:52 +02:00
*locktime* is an optional locktime: if not set, it is set to a recent
block height.
2020-08-18 04:22:53 +02:00
2022-11-11 02:44:56 +01:00
*min\_witness\_weight* is an optional minimum weight to use for a UTXO's
2020-11-18 02:45:23 +01:00
witness. If the actual witness weight is greater than the provided minimum,
the actual witness weight will be used.
2022-11-11 02:44:56 +01:00
*excess\_as\_change* is an optional boolean to flag to add a change output
2021-02-02 20:43:15 +01:00
for the excess sats.
2020-08-18 04:22:53 +02:00
RETURN VALUE
------------
2021-06-16 03:10:17 +02:00
[comment]: # (GENERATE-FROM-SCHEMA-START)
On success, an object is returned, containing:
2022-09-05 23:33:09 +02:00
2021-06-16 03:10:17 +02:00
- **psbt** (string): Unsigned PSBT which fulfills the parameters given
2022-09-05 23:45:06 +02:00
- **feerate\_per\_kw** (u32): The feerate used to create the PSBT, in satoshis-per-kiloweight
- **estimated\_final\_weight** (u32): The estimated weight of the transaction once fully signed
2022-11-11 03:03:13 +01:00
- **excess\_msat** (msat): The amount above *satoshi* which is available. This could be zero, or dust; it will be zero if *change\_outnum* is also returned
- **change\_outnum** (u32, optional): The 0-based output number where change was placed (only if parameter *excess\_as\_change* was true and there was sufficient funds)
2021-06-16 03:10:17 +02:00
- **reservations** (array of objects, optional): If *reserve* was true or a non-zero number, just as per lightning-reserveinputs(7):
- **txid** (txid): The txid of the transaction
- **vout** (u32): The 0-based output number
2022-09-05 23:45:06 +02:00
- **was\_reserved** (boolean): Whether this output was previously reserved
2021-06-16 03:10:17 +02:00
- **reserved** (boolean): Whether this output is now reserved (always *true* )
2022-09-05 23:45:06 +02:00
- **reserved\_to\_block** (u32): The blockheight the reservation will expire
2021-09-03 12:07:59 +02:00
2021-06-16 03:10:17 +02:00
[comment]: # (GENERATE-FROM-SCHEMA-END)
2021-05-10 19:47:27 +02:00
On success, returns the *psbt* it created, containing the inputs,
2022-11-11 02:44:56 +01:00
*feerate\_per\_kw* showing the exact numeric feerate it used,
*estimated\_final\_weight* for the estimated weight of the transaction
once fully signed, and *excess\_msat* containing the amount above *satoshi*
2021-05-10 19:47:27 +02:00
which is available. This could be zero, or dust. If *satoshi* was "all",
2022-11-11 02:44:56 +01:00
then *excess\_msat* is the entire amount once fees are subtracted
2020-08-18 04:22:53 +02:00
for the weights of the inputs and *startweight* .
2021-05-26 03:19:37 +02:00
If *reserve* was *true* or a non-zero number, then a *reservations*
array is returned, exactly like *reserveinputs* .
2020-08-18 04:22:53 +02:00
2022-11-11 02:44:56 +01:00
If *excess\_as\_change* is true and the excess is enough to cover
2021-02-02 20:43:15 +01:00
an additional output above the `dust_limit` , then an output is
2022-11-11 02:44:56 +01:00
added to the PSBT for the excess amount. The *excess\_msat* will
be zero. A *change\_outnum* will be returned with the index of
2021-02-02 20:43:15 +01:00
the change output.
2020-08-18 04:22:53 +02:00
On error the returned object will contain `code` and `message` properties,
with `code` being one of the following:
- -32602: If the given parameters are wrong.
- -1: Catchall nonspecific error.
- 301: Insufficient UTXOs to meet *satoshi* value.
AUTHOR
------
Rusty Russell < < rusty @ rustcorp . com . au > > is mainly responsible.
SEE ALSO
--------
lightning-fundpsbt(7).
RESOURCES
---------
Main web site: < https: / / github . com / ElementsProject / lightning >
2020-08-25 03:33:16 +02:00
2023-01-30 07:24:16 +01:00
[comment]: # ( SHA256STAMP:818cccd0ff2ed3398ceb036dd4034484f965220844de916a846cd6cf17a14fd3)