|
|
|
.TH "LIGHTNING-PAY" "7" "" "" "lightning-pay"
|
|
|
|
.SH NAME
|
|
|
|
lightning-pay - Command for sending a payment to a BOLT11 invoice
|
|
|
|
.SH SYNOPSIS
|
|
|
|
|
|
|
|
\fBpay\fR \fIbolt11\fR [\fImsatoshi\fR] [\fIlabel\fR] [\fIriskfactor\fR]
|
|
|
|
[\fImaxfeepercent\fR] [\fIretry_for\fR] [\fImaxdelay\fR] [\fIexemptfee\fR]
|
|
|
|
|
|
|
|
.SH DESCRIPTION
|
|
|
|
|
|
|
|
The \fBpay\fR RPC command attempts to find a route to the given
|
|
|
|
destination, and send the funds it asks for\. If the \fIbolt11\fR does not
|
|
|
|
contain an amount, \fImsatoshi\fR is required, otherwise if it is specified
|
|
|
|
it must be \fInull\fR\. \fImsatoshi\fR is in millisatoshi precision; it can be a
|
|
|
|
whole number, or a whole number with suffix \fImsat\fR or \fIsat\fR, or a three
|
|
|
|
decimal point number with suffix \fIsat\fR, or an 1 to 11 decimal point
|
|
|
|
number suffixed by \fIbtc\fR\.
|
|
|
|
|
|
|
|
|
|
|
|
The \fIlabel\fR field is used to attach a label to payments, and is returned
|
|
|
|
in \fBlightning-listpays\fR(7) and \fBlightning-listsendpays\fR(7)\. The \fIriskfactor\fR
|
|
|
|
is described in detail in \fBlightning-getroute\fR(7), and defaults to 10\. The
|
|
|
|
\fImaxfeepercent\fR limits the money paid in fees, and defaults to 0\.5\. The
|
|
|
|
\fBmaxfeepercent\fR is a percentage of the amount that is to be paid\. The \fBexemptfee\fR
|
|
|
|
option can be used for tiny payments which would be dominated by the fee
|
|
|
|
leveraged by forwarding nodes\. Setting \fBexemptfee\fR allows the
|
|
|
|
\fBmaxfeepercent\fR check to be skipped on fees that are smaller than
|
|
|
|
\fBexemptfee\fR (default: 5000 millisatoshi)\.
|
|
|
|
|
|
|
|
|
|
|
|
The response will occur when the payment fails or succeeds\. Once a
|
|
|
|
payment has succeeded, calls to \fBpay\fR with the same \fIbolt11\fR will
|
|
|
|
succeed immediately\.
|
|
|
|
|
|
|
|
|
|
|
|
Until \fIretry_for\fR seconds passes (default: 60), the command will keep
|
|
|
|
finding routes and retrying the payment\. However, a payment may be
|
|
|
|
delayed for up to \fBmaxdelay\fR blocks by another node; clients should be
|
|
|
|
prepared for this worst case\.
|
|
|
|
|
|
|
|
|
|
|
|
When using \fIlightning-cli\fR, you may skip optional parameters by using
|
|
|
|
\fInull\fR\. Alternatively, use \fB-k\fR option to provide parameters by name\.
|
|
|
|
|
|
|
|
.SH RANDOMIZATION
|
|
|
|
|
|
|
|
To protect user privacy, the payment algorithm performs some
|
|
|
|
randomization\.
|
|
|
|
|
|
|
|
|
|
|
|
1: Route Randomization
|
|
|
|
|
|
|
|
|
|
|
|
Route randomization means the payment algorithm does not always use the
|
|
|
|
lowest-fee or shortest route\. This prevents some highly-connected node
|
|
|
|
from learning all of the user payments by reducing their fees below the
|
|
|
|
network average\.
|
|
|
|
|
|
|
|
|
|
|
|
2: Shadow Route
|
|
|
|
|
|
|
|
|
|
|
|
Shadow route means the payment algorithm will virtually extend the route
|
|
|
|
by adding delays and fees along it, making it appear to intermediate nodes
|
|
|
|
that the route is longer than it actually is\. This prevents intermediate
|
|
|
|
nodes from reliably guessing their distance from the payee\.
|
|
|
|
|
|
|
|
|
|
|
|
Route randomization will never exceed \fImaxfeepercent\fR of the payment\.
|
|
|
|
Route randomization and shadow routing will not take routes that would
|
|
|
|
exceed \fImaxdelay\fR\.
|
|
|
|
|
|
|
|
.SH RETURN VALUE
|
|
|
|
|
|
|
|
On success, this returns the \fIpayment_preimage\fR which hashes to the
|
|
|
|
\fIpayment_hash\fR to prove that the payment was successful\. It will also
|
|
|
|
return, a \fIgetroute_tries\fR and a \fIsendpay_tries\fR statistics for the
|
|
|
|
number of times it internally called \fBgetroute\fR and \fBsendpay\fR\.
|
|
|
|
|
|
|
|
|
|
|
|
You can monitor the progress and retries of a payment using the
|
|
|
|
\fBlightning-paystatus\fR(7) command\.
|
|
|
|
|
|
|
|
|
|
|
|
The following error codes may occur:
|
|
|
|
|
|
|
|
.RS
|
|
|
|
.IP \[bu]
|
|
|
|
-1: Catchall nonspecific error\.
|
|
|
|
.IP \[bu]
|
|
|
|
201: Already paid with this \fIhash\fR using different amount or
|
|
|
|
destination\.
|
|
|
|
.IP \[bu]
|
|
|
|
203: Permanent failure at destination\. The \fIdata\fR field of the error
|
|
|
|
will be routing failure object\.
|
|
|
|
.IP \[bu]
|
|
|
|
205: Unable to find a route\.
|
|
|
|
.IP \[bu]
|
|
|
|
206: Route too expensive\. Either the fee or the needed total
|
|
|
|
locktime for the route exceeds your \fImaxfeepercent\fR or \fImaxdelay\fR
|
|
|
|
settings, respectively\. The \fIdata\fR field of the error will indicate
|
|
|
|
the actual \fIfee\fR as well as the \fIfeepercent\fR percentage that the fee
|
|
|
|
has of the destination payment amount\. It will also indicate the
|
|
|
|
actual \fIdelay\fR along the route\.
|
|
|
|
.IP \[bu]
|
|
|
|
207: Invoice expired\. Payment took too long before expiration, or
|
|
|
|
already expired at the time you initiated payment\. The \fIdata\fR field
|
|
|
|
of the error indicates \fInow\fR (the current time) and \fIexpiry\fR (the
|
|
|
|
invoice expiration) as UNIX epoch time in seconds\.
|
|
|
|
.IP \[bu]
|
|
|
|
210: Payment timed out without a payment in progress\.
|
|
|
|
|
|
|
|
.RE
|
|
|
|
|
|
|
|
Error codes 202 and 204 will only get reported at \fBsendpay\fR; in
|
|
|
|
\fBpay\fR we will keep retrying if we would have gotten those errors\.
|
|
|
|
|
|
|
|
|
|
|
|
A routing failure object has the fields below:
|
|
|
|
|
|
|
|
.RS
|
|
|
|
.IP \[bu]
|
|
|
|
\fIerring_index\fR: The index of the node along the route that reported
|
|
|
|
the error\. 0 for the local node, 1 for the first hop, and so on\.
|
|
|
|
.IP \[bu]
|
|
|
|
\fIerring_node\fR: The hex string of the pubkey id of the node that
|
|
|
|
reported the error\.
|
|
|
|
.IP \[bu]
|
|
|
|
\fIerring_channel\fR: The short channel ID of the channel that has the
|
|
|
|
error, or \fI0:0:0\fR if the destination node raised the error\.
|
|
|
|
.IP \[bu]
|
|
|
|
\fIfailcode\fR: The failure code, as per BOLT #4\.
|
|
|
|
.IP \[bu]
|
|
|
|
\fIchannel_update\fR\. The hex string of the \fIchannel_update\fR message
|
|
|
|
received from the remote node\. Only present if error is from the
|
|
|
|
remote node and the \fIfailcode\fR has the UPDATE bit set, as per BOLT #4\.
|
|
|
|
|
|
|
|
.RE
|
|
|
|
|
|
|
|
The \fIdata\fR field of errors will include statistics \fIgetroute_tries\fR and
|
|
|
|
\fIsendpay_tries\fR\. It will also contain a \fIfailures\fR field with detailed
|
|
|
|
data about routing errors\.
|
|
|
|
|
|
|
|
.SH AUTHOR
|
|
|
|
|
|
|
|
Rusty Russell \fI<rusty@rustcorp.com.au\fR> is mainly responsible\.
|
|
|
|
|
|
|
|
.SH SEE ALSO
|
|
|
|
|
|
|
|
\fBlightning-listpays\fR(7), \fBlightning-decodepay\fR(7), \fBlightning-listinvoice\fR(7),
|
|
|
|
\fBlightning-delinvoice\fR(7), \fBlightning-getroute\fR(7), \fBlightning-invoice\fR(7)\.
|
|
|
|
|
|
|
|
.SH RESOURCES
|
|
|
|
|
|
|
|
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
|
|
|
|
|
|
|
\" SHA256STAMP:5173cc560fec005800223eff786a5d36dd677524b50995ce21b2777fb6345084
|