2019-08-10 02:12:44 +02:00
.TH "LIGHTNING-TXPREPARE" "7" "" "" "lightning-txprepare"
.SH NAME
2020-02-17 17:34:29 +01:00
lightning-txprepare - Command to prepare to withdraw funds from the internal wallet
2019-08-10 02:12:44 +02:00
.SH SYNOPSIS
2019-08-28 05:35:29 +02:00
\fB txprepare\fR \fI outputs\fR [\fI feerate\fR ] [\fI minconf\fR ] [\fI utxos\fR ]
2019-08-10 02:12:44 +02:00
.SH DESCRIPTION
The \fB txprepare\fR RPC command creates an unsigned transaction which
2019-08-22 20:47:24 +02:00
spends funds from c-lightning’ s internal wallet to the outputs specified
in \fI outputs\fR \.
2019-08-28 05:35:29 +02:00
2019-08-22 20:47:24 +02:00
The \fI outputs\fR is the array of output that include \fI destination\fR
and \fI amount\fR ({\fI destination\fR : \fI amount\fR })\. Its format is like:
[{address1: amount1}, {address2: amount2}]
or
[{address: \fI all\fR }]\.
2020-02-17 17:34:29 +01:00
It supports any number of \fB confirmed\fR outputs\.
2019-08-22 20:47:24 +02:00
2019-08-28 05:35:29 +02:00
2019-08-22 20:47:24 +02:00
The \fI destination\fR of output is the address which can be of any Bitcoin accepted
type, including bech32\.
2019-08-28 05:35:29 +02:00
2019-08-22 20:47:24 +02:00
The \fI amount\fR of output is the amount to be sent from the internal wallet
(expressed, as name suggests, in amount)\. The string \fI all\fR can be used to specify
all available funds\. Otherwise, it is in amount precision; it can be a whole
number, a whole number ending in \fI sat\fR , a whole number ending in \fI 000msat\fR ,
2019-08-28 05:35:29 +02:00
or a number with 1 to 8 decimal places ending in \fI btc\fR \.
2019-08-22 20:47:24 +02:00
2019-10-07 17:02:57 +02:00
\fI feerate\fR is an optional feerate to use\. It can be one of the strings
\fI urgent\fR (aim for next block), \fI normal\fR (next 4 blocks or so) or \fI slow\fR
(next 100 blocks or so) to use lightningd’ s internal estimates: \fI normal\fR
is the default\.
Otherwise, \fI feerate\fR is a number, with an optional suffix: \fI perkw\fR means
the number is interpreted as satoshi-per-kilosipa (weight), and \fI perkb\fR
means it is interpreted bitcoind-style as satoshi-per-kilobyte\. Omitting
the suffix is equivalent to \fI perkb\fR \.
\fI minconf\fR specifies the minimum number of confirmations that used
outputs should have\. Default is 1\.
2019-08-10 02:12:44 +02:00
2019-08-28 05:35:29 +02:00
\fI utxos\fR specifies the utxos to be used to fund the transaction, as an array
of "txid:vout"\. These must be drawn from the node's available UTXO set\.
2019-10-07 17:02:57 +02:00
\fB txprepare\fR is similar to the first part of a \fB withdraw\fR command, but
supports multiple outputs and uses \fI outputs\fR as parameter\. The second part
is provided by \fB txsend\fR \.
2019-08-10 02:12:44 +02:00
.SH RETURN VALUE
2021-06-16 03:10:17 +02:00
On success, an object is returned, containing:
2019-08-10 02:12:44 +02:00
2021-06-16 03:10:17 +02:00
.RS
.IP \[ bu]
\fB psbt\fR (string): the PSBT representing the unsigned transaction
.IP \[ bu]
\fB unsigned_tx\fR (hex): the unsigned transaction
.IP \[ bu]
\fB txid\fR (txid): the transaction id of \fI unsigned_tx\fR ; you hand this to \fB lightning-txsend\fR (7) or \fB lightning-txdiscard\fR (7), as the inputs of this transaction are reserved\.
2019-08-10 02:12:44 +02:00
2021-06-16 03:10:17 +02:00
.RE
2019-08-10 02:12:44 +02:00
On failure, an error is reported and the transaction is not created\.
2019-06-05 09:00:05 +02:00
The following error codes may occur:
2019-08-10 02:12:44 +02:00
2019-08-28 05:35:29 +02:00
.RS
2019-08-10 02:12:44 +02:00
.IP \[ bu]
-1: Catchall nonspecific error\.
.IP \[ bu]
301: There are not enough funds in the internal wallet (including
fees) to create the transaction\.
.IP \[ bu]
302: The dust limit is not met\.
2019-08-28 05:35:29 +02:00
.RE
2019-08-10 02:12:44 +02:00
.SH AUTHOR
2020-02-17 17:34:29 +01:00
Rusty Russell \fI <rusty@rustcorp.com.au\fR > is mainly responsible\.
2019-08-10 02:12:44 +02:00
.SH SEE ALSO
2020-07-13 04:18:38 +02:00
\fB lightning-withdraw\fR (7), \fB lightning-txsend\fR (7), \fB lightning-txdiscard\fR (7),
\fB lightning-feerates\fR (7)
2019-08-10 02:12:44 +02:00
.SH RESOURCES
2020-02-17 17:34:29 +01:00
Main web site: \fI https://github.com/ElementsProject/lightning\fR
2019-08-10 02:12:44 +02:00
2021-06-16 03:10:17 +02:00
\" SHA256STAMP:7a2b2f0bbadde70507b72a88355c4c41817a37e9f8e3211db3e9cb5b678c1b20