How Lightning Routing Actually Works
Every Lightning payment traverses a path from sender to receiver through a series of intermediate nodes. If you are just getting started with your own node, see our complete guide to running a Lightning node first. Finding that path — quickly, reliably, and cheaply — is one of the hardest problems in the Lightning Network. Unlike traditional payment networks where a central authority routes transactions, Lightning relies on each node independently constructing routes using its local view of the network graph.
This guide explains the routing algorithms, the practical strategies for improving your node’s routing performance, and the protocol developments that are reshaping how payments find their way across the network.
The Pathfinding Problem
Lightning pathfinding faces a unique challenge: the network graph is public (node connections and channel capacities are broadcast), but the distribution of funds within each channel is private. Your node knows that a channel between Alice and Bob has 2,000,000 sats total capacity, but it does not know whether Alice has 1,800,000 and Bob has 200,000 or the reverse.
This means pathfinding is inherently probabilistic. Your node must estimate the likelihood that each channel along a potential route has sufficient liquidity to forward the payment. Incorrect estimates lead to payment failures, retries, and delays.
How LND Routes Payments
LND uses a modified Dijkstra’s shortest-path algorithm with a cost function that considers:
- Fee cost: Base fee + proportional fee for each hop (see our Lightning Network fees guide for details). Lower total fees are preferred.
- CLTV (timelock) cost: Each hop adds a timelock delay. Longer total timelocks increase capital lockup risk and are penalized in the cost function.
- Probability estimate: Based on historical success/failure data (mission control), the algorithm estimates the likelihood of each channel having sufficient liquidity.
- Channel capacity: Larger channels are preferred because they have a higher probability of being able to forward the requested amount.
The algorithm explores the graph starting from the destination and working backward to the sender, computing the cheapest viable path that has a reasonable probability of success.
Mission Control: Learning from Failures
LND’s mission control system records the outcome of every payment attempt — which channels succeeded and which failed. This historical data feeds back into the pathfinding algorithm:
- A failed attempt through channel X at time T establishes a temporary constraint: “channel X had less than Y sats of outbound liquidity at time T.”
- This constraint decays over time (liquidity moves constantly), so mission control data has a configurable half-life (default: 1 hour in LND).
- Successful payments through a channel increase its probability estimate for future routing attempts.
The result is an adaptive system that improves routing accuracy over time. A node that has been running for weeks has significantly better routing success rates than a freshly started node because its mission control database contains thousands of observations about channel liquidity states.
Optimizing Your Node’s Routing Performance
1. Graph Quality and Update Speed
Your node’s routing decisions are only as good as its view of the network graph. Ensure your graph is current:
# Check graph sync status in LND
lncli getinfo | jq '.synced_to_graph'
This should return true. If your node is not synced to the graph, routing decisions are based on stale data. Common causes of desync include insufficient memory, slow storage, or prolonged disconnection from peers.
For faster graph updates, maintain connections to multiple well-connected peers. Each peer gossips channel updates, and more connections mean faster propagation of changes.
2. Channel Topology Optimization
Your position in the network graph determines which payments can route through you. Optimal positioning requires connecting to nodes that bridge different clusters of the network:
- Connect across communities: If most of your channels connect to North American nodes, adding channels to European or Asian nodes opens routing paths that others in your neighborhood cannot provide.
- Bridge different ecosystems: Connect to both exchange nodes (Kraken, Bitfinex) and service nodes (Bitrefill, ACINQ) to route payments between them.
- Avoid redundancy: Two channels to the same hub provide failover but not additional routing reach. Diversify your peers to cover different parts of the network.
Analyze your node’s position using network analysis tools like Amboss or by examining the shortest-path distances from your node to popular destinations. If many destinations are more than 3 hops away, you need better-connected peers.
3. Liquidity Management for Routing
A channel with all its capacity on one side is useless for routing in the depleted direction. Maintaining balanced channels is essential for bidirectional routing. For comprehensive channel management strategies, see our masterclass guide.
Key practices for routing-optimized liquidity:
- Keep channels between 25% and 75% local balance for maximum routing flexibility.
- Use fee-based steering (higher fees on depleted channels) to naturally manage liquidity without manual rebalancing.
- Rebalance proactively during low on-chain fee periods rather than waiting for channels to fully deplete — submarine swaps via Lightning Loop are one effective method.
4. Fee Policy for Routing Attraction
Your fee policy determines whether payments route through your node or around it. Setting fees requires balancing two competing objectives:
- Low enough to attract routing: If your fees exceed alternative paths, payments go elsewhere.
- High enough to sustain operations: Routing at zero margin drains channels without compensation, leading to rebalancing costs that exceed revenue.
Research competitive fee rates for channels similar to yours using Amboss or by querying the network graph. If a direct competitor charges 100 ppm for a similar channel, pricing at 150 ppm puts you at a disadvantage. Match or slightly undercut competitors while ensuring profitability after rebalancing costs.
Multi-Path Payments (MPP)
Multi-Path Payments split a single payment across multiple routes simultaneously. Instead of finding one path with enough liquidity for the full amount, MPP finds several paths with smaller amounts that sum to the total.
How MPP Works
- The sender determines the total payment amount.
- The pathfinding algorithm identifies multiple viable routes with partial capacity.
- The payment is split into shards, each routed independently.
- The receiver collects all shards and releases the preimage only when the full amount arrives.
- All shards use the same payment hash, ensuring atomicity — either all shards complete or none do.
Impact on Routing Optimization
MPP changes the routing landscape in several ways:
- Larger payments become possible: Instead of requiring a single channel with 1,000,000 sats of liquidity, MPP can split across four channels with 250,000 sats each.
- Smaller channels become useful: Channels that are too small for large single-path payments can still contribute to MPP shards.
- Network capacity utilization improves: MPP distributes load across more channels, reducing the concentration of traffic through a few large channels.
As a node operator, MPP means your smaller channels have more routing value than they would in a single-path-only network. However, each shard still requires sufficient liquidity in the specific channel used, so channel management remains important.
Trampoline Routing
Trampoline routing is a protocol extension primarily implemented in Eclair (and used by Phoenix wallet) that delegates pathfinding to intermediate “trampoline nodes.” Instead of the sender computing the entire route, the sender identifies a trampoline node and asks it to find the remaining path to the destination.
Why Trampoline Matters
- Mobile wallet feasibility: Full pathfinding requires the entire network graph (hundreds of megabytes) and significant CPU time. Mobile devices struggle with this. Trampoline routing offloads the computation to a well-connected server.
- Privacy trade-off: The trampoline node learns more about the payment destination than a standard routing node would, but the sender’s privacy is maintained through onion encryption at the trampoline level.
- Routing success rates: Well-connected trampoline nodes with current liquidity data can often find routes that a mobile wallet with a stale graph would miss.
For routing node operators, supporting trampoline routing requires no special configuration but being well-connected and well-capitalized makes your node a natural trampoline candidate. ACINQ’s node is currently the primary trampoline node on the network. Understanding how trampoline routing interacts with Lightning’s broader scaling challenges is important for long-term node strategy.
BOLT 12 and Blinded Paths
BOLT 12 (Offers) introduces a new payment request format that includes blinded paths — routes where the last few hops to the receiver are encrypted. The sender can complete the payment without knowing the receiver’s node public key or the exact channels used for the final hops.
Impact on Routing
- Enhanced receiver privacy: Blinded paths prevent the sender (and routing intermediaries) from identifying the receiver’s node. This is a significant privacy improvement over BOLT 11 invoices, which include the receiver’s node ID.
- Route hints evolve: Instead of revealing the receiver’s channels as route hints, blinded paths provide encrypted routing instructions. Routing nodes process these instructions without learning the final destination.
- Recurring payments: BOLT 12 Offers enable reusable payment codes — a single offer can generate unlimited invoices. This simplifies subscription-style payments and reduces the operational overhead of generating new invoices.
Core Lightning has the most mature BOLT 12 implementation. Eclair supports it in Phoenix wallet. LND support is in active development. As BOLT 12 adoption increases, routing nodes will process blinded-path payments without changes to their configuration — the protocol handles blinding at the routing level.
Common Routing Failures and Fixes
| Error | Cause | Solution |
|---|---|---|
| TEMPORARY_CHANNEL_FAILURE | Insufficient liquidity in a routing channel | Payment retries automatically via another route. If persistent, rebalance affected channels. |
| FEE_INSUFFICIENT | Fee changed after route was computed | Update graph data, retry. Usually resolves automatically. |
| CHANNEL_DISABLED | Routing channel has been disabled by operator | Route around it. Graph update will eventually reflect the disabled state. |
| EXPIRY_TOO_SOON | CLTV delta too tight for remaining route | Retry with longer timelock. May indicate a long route — consider adding channels to shorten paths. |
| NO_ROUTE | No path exists with sufficient capacity | Open new channels closer to the destination. Check if the destination node is offline. |
Future of Lightning Routing
Channel Factories
Channel factories allow multiple parties to share a single on-chain UTXO while maintaining individual payment channels. This reduces the on-chain footprint of channel creation and could enable dramatically more channels per on-chain transaction, expanding the network graph and routing possibilities.
PTLCs (Point Time-Locked Contracts)
PTLCs replace HTLCs with contracts based on adaptor signatures rather than hash preimages. The key routing improvement: each hop in a PTLC-based route uses a different point, making it impossible for routing nodes to correlate hops of the same payment. This eliminates the payment correlation attack possible with HTLCs (where all hops share the same hash) and significantly improves routing privacy.
Gossip Protocol Improvements
The current gossip protocol broadcasts channel updates to all nodes, consuming bandwidth and processing time. Proposed improvements include minisketch-based set reconciliation (reducing gossip bandwidth by 90%+) and local-only gossip for private channels. These improvements would allow nodes to maintain more accurate graph data with less overhead.
Lightning Channels and Routing from the
Lightning Network & Bitcoin Nodes course.
FAQ
Why do my Lightning payments sometimes take multiple attempts to succeed?
Because your node cannot see the balance distribution inside remote channels, it estimates liquidity probabilistically. The first route attempt may hit a channel with insufficient liquidity, causing a TEMPORARY_CHANNEL_FAILURE. Your node then updates its mission control data (marking that channel as having limited liquidity) and retries with a different route. Modern implementations typically succeed within 1-3 attempts for well-connected nodes. Persistent failures suggest either poor connectivity or an attempt to route more sats than the network can handle along available paths.
Does running a routing node expose my financial information?
Your channel capacities are public (broadcast in the network graph), but your channel balances are private. Routing nodes see individual payment hops but not complete payment paths — onion routing prevents any single intermediary from learning both the sender and receiver. However, sophisticated analysis of routing patterns over time could reveal statistical information about your payment flows. Using privacy-enhancing techniques like running over Tor and using multiple routing paths mitigates these risks.
How can I tell if my node is well-positioned for routing?
Check three indicators: (1) Your betweenness centrality score on Amboss or similar tools — higher scores mean more shortest paths run through your node. (2) Your routing volume — if payments are actually flowing through your channels, your position is working. (3) Your average hop count to popular destinations — if you can reach major nodes in 1-2 hops, you are well-positioned. If most destinations require 4+ hops, consider opening channels to better-connected nodes.
What is the optimal number of channels for a routing node?
There is no universal answer, but 10-20 well-chosen channels provide strong routing capability for a home node. The key is diversity of connections rather than raw channel count. Ten channels connecting to nodes across different network clusters outperform fifty channels to nodes in the same cluster. Choose your Lightning wallet and node software carefully to support your routing goals. Scale channel count with your available capital — each channel should have at least 1,000,000 sats to be useful for routing.
For a broader perspective, explore our running your own Bitcoin node guide.
{“@context”: “https://schema.org”, “@type”: “FAQPage”, “mainEntity”: [{“@type”: “Question”, “name”: “Why do my Lightning payments sometimes take multiple attempts to succeed?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Because your node cannot see the balance distribution inside remote channels, it estimates liquidity probabilistically. The first route attempt may hit a channel with insufficient liquidity, causing a TEMPORARY_CHANNEL_FAILURE. Your node then updates its mission control data (marking that channel as having limited liquidity) and retries with a different route. Modern implementations typically succeed within 1-3 attempts for well-connected nodes. Persistent failures suggest either poor connect…”}}, {“@type”: “Question”, “name”: “Does running a routing node expose my financial information?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Your channel capacities are public (broadcast in the network graph), but your channel balances are private. Routing nodes see individual payment hops but not complete payment paths — onion routing prevents any single intermediary from learning both the sender and receiver. However, sophisticated analysis of routing patterns over time could reveal statistical information about your payment flows. Using privacy-enhancing techniques like running over Tor and using multiple routing paths mitigate…”}}, {“@type”: “Question”, “name”: “How can I tell if my node is well-positioned for routing?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Check three indicators: (1) Your betweenness centrality score on Amboss or similar tools — higher scores mean more shortest paths run through your node. (2) Your routing volume — if payments are actually flowing through your channels, your position is working. (3) Your average hop count to popular destinations — if you can reach major nodes in 1-2 hops, you are well-positioned. If most destinations require 4+ hops, consider opening channels to better-connected nodes.”}}, {“@type”: “Question”, “name”: “What is the optimal number of channels for a routing node?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “There is no universal answer, but 10-20 well-chosen channels provide strong routing capability for a home node. The key is diversity of connections rather than raw channel count. Ten channels connecting to nodes across different network clusters outperform fifty channels to nodes in the same cluster. Choose your Lightning wallet and node software carefully to support your routing goals. Scale channel count with your available capital — each channel should have at least 1,000,000 sats to be us…”}}]}