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
|
|
|
|
\fBtxprepare\fR \fIoutputs\fR [\fIfeerate\fR] [\fIminconf\fR] [\fIutxos\fR]
|
2019-08-10 02:12:44 +02:00
|
|
|
|
|
|
|
|
|
.SH DESCRIPTION
|
|
|
|
|
|
|
|
|
|
The \fBtxprepare\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 \fIoutputs\fR\.
|
|
|
|
|
|
2019-08-28 05:35:29 +02:00
|
|
|
|
|
2019-08-22 20:47:24 +02:00
|
|
|
|
The \fIoutputs\fR is the array of output that include \fIdestination\fR
|
|
|
|
|
and \fIamount\fR({\fIdestination\fR: \fIamount\fR})\. Its format is like:
|
|
|
|
|
[{address1: amount1}, {address2: amount2}]
|
|
|
|
|
or
|
|
|
|
|
[{address: \fIall\fR}]\.
|
2020-02-17 17:34:29 +01:00
|
|
|
|
It supports any number of \fBconfirmed\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 \fIdestination\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 \fIamount\fR of output is the amount to be sent from the internal wallet
|
|
|
|
|
(expressed, as name suggests, in amount)\. The string \fIall\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 \fIsat\fR, a whole number ending in \fI000msat\fR,
|
2019-08-28 05:35:29 +02:00
|
|
|
|
or a number with 1 to 8 decimal places ending in \fIbtc\fR\.
|
|
|
|
|
|
2019-08-22 20:47:24 +02:00
|
|
|
|
|
2019-10-07 17:02:57 +02:00
|
|
|
|
\fIfeerate\fR is an optional feerate to use\. It can be one of the strings
|
|
|
|
|
\fIurgent\fR (aim for next block), \fInormal\fR (next 4 blocks or so) or \fIslow\fR
|
|
|
|
|
(next 100 blocks or so) to use lightningd’s internal estimates: \fInormal\fR
|
|
|
|
|
is the default\.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Otherwise, \fIfeerate\fR is a number, with an optional suffix: \fIperkw\fR means
|
|
|
|
|
the number is interpreted as satoshi-per-kilosipa (weight), and \fIperkb\fR
|
|
|
|
|
means it is interpreted bitcoind-style as satoshi-per-kilobyte\. Omitting
|
|
|
|
|
the suffix is equivalent to \fIperkb\fR\.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\fIminconf\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
|
|
|
|
|
|
|
|
|
\fIutxos\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
|
|
|
|
|
|
|
|
|
\fBtxprepare\fR is similar to the first part of a \fBwithdraw\fR command, but
|
|
|
|
|
supports multiple outputs and uses \fIoutputs\fR as parameter\. The second part
|
|
|
|
|
is provided by \fBtxsend\fR\.
|
|
|
|
|
|
2019-08-10 02:12:44 +02:00
|
|
|
|
.SH RETURN VALUE
|
|
|
|
|
|
|
|
|
|
On success, an object with attributes \fIunsigned_tx\fR and \fItxid\fR will be
|
|
|
|
|
returned\. You need to hand \fItxid\fR to \fBtxsend\fR or \fBtxdiscard\fR, as the
|
|
|
|
|
inputs of this transaction are reserved until then, or until the daemon
|
|
|
|
|
restarts\.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\fIunsigned_tx\fR represents the raw bitcoin transaction (not yet signed)
|
|
|
|
|
and \fItxid\fR represent the bitcoin transaction id\.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
\fBlightning-withdraw\fR(7), \fBlightning-txsend\fR(7), \fBlightning-txdiscard\fR(7)
|
|
|
|
|
|
|
|
|
|
.SH RESOURCES
|
|
|
|
|
|
2020-02-17 17:34:29 +01:00
|
|
|
|
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
2019-08-10 02:12:44 +02:00
|
|
|
|
|