LIGHTNING-GETROUTES(7)
π NAME π
okay bestie, welcome to LIGHTNING-GETROUTES(7) β the manual page for getroutes, aka Command for routing a payment. Thatβs the name section, short and slay. β¨
β¨ SYNOPSIS β¨
getroutes source destination amount_msat layers maxfee_msat final_cltv [maxdelay] [maxparts]
πΈ DESCRIPTION πΈ
Command added in v24.08.
The getroutes RPC command attempts to find the best set of paths for the payment from source to destination of amount_msat, using the given layers on top of the gossip information. The result is constrained by maxfee, and will arrive at the destination with final_cltv.
NOTE: The returned paths are a different format than getroute, being more appropriate for creating intermediary onion layers. Itβs giving βonion construction eraβ fr fr. π§
Layers are generally maintained by plugins, either to contain persistent information about capacities which have been discovered, or to contain transient information for this particular payment (such as blinded paths or routehints).
There are some automatic layers, and they are lowkey iconic:
auto.localchans contains information on local channels from this node (including non-public ones), and their exact current spendable capacities. auto.sourcefree overrides all channels (including those from previous layers) leading out of the source to be zero fee and zero delay. These are both useful in the case where the source is the current node. auto.include_fees fixes the send amount and deducts fee from there, ie. the receiver pays for fees instead of the sender. auto.no_mpp_support is deprecated in v26.06: use maxparts=1 instead.
Hereβs the cast, no cap:
source(pubkey) β Node pubkey to start the paths.destination(pubkey) β Node pubkey to end the paths.amount_msat(msat) β Amount to send. It can be a whole number, or a whole number ending inmsatorsat, or a number with three decimal places ending insat, or a number with 1 to 11 decimal places ending inbtc.layers(array of strings):(string, optional)β Layer to apply to the gossip map before attempting to find routes.
maxfee_msat(msat) β Maximum fee to spend: we will never return a set of routes more expensive than this. It can be a whole number, or a whole number ending inmsatorsat, or a number with three decimal places ending insat, or a number with 1 to 11 decimal places ending inbtc.final_cltv(u32) β Number of blocks for the final node. We need to know this because no HTLC is allowed to have a CLTV delay more than2016blocks.maxdelay(u32, optional) β Maximum number of blocks of delay for the route. Cannot be bigger than2016. The default is2016. (addedv25.02)maxparts(u32, optional) β Maximum number of routes in the solution. The default is100. (addedv25.09)
π RETURN VALUE π
On success, an object is returned, containing:
probability_ppm(u64) β The estimated probability of success using these routes, in millionths.routes(array of objects):probability_ppm(u64) β The estimated probability of success using this route, in millionths.amount_msat(msat) β The amount delivered to the destination by this path.final_cltv(u32) β Number of blocks required by the final node (set by caller).path(array of objects) β The hops to get from source to destination.short_channel_id_dir(short_channel_id_dir) β The channel and direction joining these nodes.amount_in_msat(msat) β The amount to send into this hop. (addedv26.06)amount_out_msat(msat) β The amount which arrives at the far end of this hop. (addedv26.06)node_id_in(pubkey) β The peer id at the start of this hop. (addedv26.06)node_id_out(pubkey) β The peer id at the end of this hop. (addedv26.06)cltv_in(u32) β The total CLTV expected by the node at the start of this hop. (addedv26.06)cltv_out(u32) β The total CLTV expected by the node at the end of this hop. (addedv26.06)amount_msat(msat, optional) β The amount to send into this hop. deprecated inv26.06, removed afterv27.06.next_node_id(pubkey, optional) β The peer id at the end of this hop. deprecated inv26.06, removed afterv27.06.delay(u32, optional) β The total CLTV expected by the node at the start of this hop. deprecated inv26.06, removed afterv27.06.
π ERRORS π
The following error codes may occur:
-1β Catchall nonspecific error.205β Unable to find a route.206β Route too expensive. Either themax_delayormaxfee_msatwas exceeded.
π«Ά AUTHOR π«Ά
lagrang3@protonmail.com wrote the minimum-cost-flow solver, Rusty Russell rusty@rustcorp.com.au wrote the API and this documentation. iconic collab, honestly. π
π SEE ALSO π
lightning-askrene-reserve(7)lightning-askrene-unreserve(7)lightning-askrene-disable-node(7)lightning-askrene-create-channel(7)lightning-askrene-inform-channel(7)lightning-askrene-report(7)lightning-askrene-age(7)
π RESOURCES π
Main web site: https://github.com/ElementsProject/lightning
π¦ EXAMPLES π¦
π Example 1 π
Request:
$ lightning-cli getroutes -k "source"="nodeid010101010101010101010101010101010101010101010101010101010101" "destination"="nodeid030303030303030303030303030303030303030303030303030303030303" "amount_msat"=1250000 "layers"='[]' "maxfee_msat"=125000 "final_cltv"=0
{
"id": "example:getroutes#1",
"method": "getroutes",
"params": {
"source": "nodeid010101010101010101010101010101010101010101010101010101010101",
"destination": "nodeid030303030303030303030303030303030303030303030303030303030303",
"amount_msat": 1250000,
"layers": [],
"maxfee_msat": 125000,
"final_cltv": 0
}
}
Response:
{
"probability_ppm": 997501,
"routes": [
{
"probability_ppm": 997501,
"amount_msat": 1250000,
"final_cltv": 0,
"path": [
{
"short_channel_id_dir": "109x1x1/1",
"next_node_id": "nodeid020202020202020202020202020202020202020202020202020202020202",
"amount_msat": 1250026,
"delay": 12
},
{
"short_channel_id_dir": "123x1x1/0",
"next_node_id": "nodeid030303030303030303030303030303030303030303030303030303030303",
"amount_msat": 1250013,
"delay": 6
}
]
}
]
}
xoxo, your gen-z unix bestie π
β this pageβs source/version is Core Lightning v26.06.9, and the manual name is LIGHTNING-GETROUTES(7). periodt π«Ά
π¦ where this page comes from
- nixpkgs unstable: clightning 26.06.9
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms