Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › Bitcoin

How Lightning Payments Find a Route—and Settle Atomically

By Freedom251 Team · · 8 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A Lightning payment is a treasure hunt through a network of payment channels. Your wallet searches for a path with enough usable liquidity, wraps instructions so each hop sees only its next destination, and locks every hop to the same cryptographic secret. If the recipient reveals that secret, the payment settles backward across the path; if not, timelocks let the conditional transfers expire and the funds return.

Start with an invoice and a secret

The recipient begins by generating a random value, commonly called R. The recipient hashes it to produce H, then places the payment hash and routing details in a Lightning invoice. The sender receives the invoice but does not learn R.

As an Amazon Associate I earn from qualifying purchases.

That asymmetry is deliberate. The payment can be offered to every hop using the same hash H, while only the recipient initially knows the preimage R. A hop cannot claim its incoming conditional payment merely by seeing the hash; it must present the matching preimage before its timeout.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How the sender hunts for a route

The public channel graph

Lightning nodes announce channels, their peers, fee policies, and timelock requirements. A sending node builds a local view of this graph and looks for a sequence of channels from itself to the recipient. LND describes its route search as a modified Dijkstra shortest-path problem: instead of minimizing only distance, the algorithm weighs fees, delay, and policy constraints.

#1 Best Overall
Bitkey Bitcoin Hardware Wallet, No Screen - Self-Custody, No Seed Phrase
  • BITCOIN EXCLUSIVE, PHONE VERIFICATION: Bitkey is designed from the ground up exclusively for bitcoin — a dedicated hardware wallet for secure bitcoin storage. Approve transactions with a tap using your phone and NFC. No device screen is required.
  • SELF-CUSTODY, NO EXCHANGE OR CUSTODIAN REQUIRED: You hold two of the three keys in the Bitkey system – one on your phone and one on your Bitkey device. The third is stored on Bitkey’s server and cannot move your bitcoin on its own.
  • NO SEED PHRASE: Set up and use Bitkey without creating or storing a seed phrase.
  • 2-of-3 MULTISIG: Three keys are stored separately across your phone, Bitkey device, and Bitkey’s server. Any two keys are required to move your bitcoin.
  • BUILT-IN RECOVERY: Encrypted backup and recovery tools can help you regain access if you lose your phone or Bitkey device. You can also designate a Recovery Contact.

The graph tells a node that channels exist, but it does not reveal each channel’s exact directional balance. A channel may advertise substantial total capacity while having little or no spendable liquidity in the direction your payment needs. This distinction is the central reason a route that looks valid can still fail.

What a candidate route must satisfy

  • Amount: Every hop must be able to forward the payment amount plus the fee required by downstream hops.
  • Direction: Liquidity must be available from the sender toward the recipient, not merely somewhere in the channel.
  • Fees: The sender must cover each forwarding node’s fee policy, which can include a base fee and a proportional fee.
  • Timelocks: Each upstream hop receives a longer expiry than the hop after it, leaving time to claim with the preimage or recover after a downstream timeout.
  • Policy: Channel minimums, maximums, required features, and forwarding rules can disqualify an otherwise attractive path.

Because balances are private and can change between route calculation and forwarding, route selection is probabilistic. A wallet may try one route, receive a failure, update its local knowledge, and try another path or split the payment into several parts when its implementation supports that behavior.

How onion routing hides the path

Layered instructions, one hop at a time

After choosing a route, the origin node constructs an onion packet as specified by BOLT #4. It uses elliptic-curve Diffie–Hellman (ECDH) to derive a shared secret for each hop. Those secrets create encrypted layers containing the forwarding instruction that each node needs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The first node removes one layer and learns the identity of its next peer, the amount and expiry it should forward, and the remaining packet. It passes that remainder onward. The next node repeats the operation. No intermediate node receives the complete route from sender to recipient, and a forwarding node cannot normally tell which earlier node originated the packet or which later nodes remain.

Rank #2
Trezor Safe 3 Crypto Hardware Wallet with Secure Element | Cosmic Black, Cold Storage for Bitcoin & Other Digital Assets, EAL6+ Secure Chip, PIN & Passphrase, Open-Source, Easy Setup
  • Unparalleled Security: Protect your assets NDA-free EAL 6+ Secure Element, offering robust defense and complete transparency
  • Simple & Secure Interface: Manage your digital assets easily with a clear OLED screen for secure on-device confirmations
  • Supports 1000s of Coins & Tokens: Securely handle thousands of assets, including Bitcoin, Ethereum, and more, all in one wallet
  • Effortless Asset Management: Monitor and transact seamlessly with Trezor Suite, our intuitive desktop and mobile app
  • Enhanced Backup Solution: Rest assured with Multi-share Backup, eliminating single points of failure for secure cold wallet recovery

BOLT #4 also makes the privacy boundary explicit: a node can verify packet integrity and learn which peer should receive the packet next, but onion routing does not prevent every form of observation. An attacker able to watch timing, packet size, or activity at multiple points may associate otherwise separate hops through traffic analysis.

HTLCs make every hop conditional

The same hash links the chain

For each hop, the sender offers a hashed time-locked contract (HTLC). The HTLC says, in effect: “You may claim this amount only by revealing the preimage of H before the deadline.” Every hop uses the same payment hash, while each successive hop has a shorter expiry.

Suppose the route is sender → A → B → recipient. The sender offers A an HTLC that expires latest. A offers B a matching HTLC with an earlier expiry, and B offers the recipient another with an earlier expiry still. The staggered deadlines give a node enough time to learn the preimage downstream and use it to claim its own incoming amount before its upstream obligation expires.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Forwarding is not taking custody

A routing node does not receive unrestricted possession of the principal. Its channel balance is encumbered by the HTLC’s cryptographic condition and timeout. It can settle the incoming side only after the downstream side has revealed the valid preimage, or recover after the appropriate timeout path. This time-limited cryptographic script is what lets a node operate without custody of a third party’s funds.

Rank #3
Trezor Safe 3 Crypto Hardware Wallet with Secure Element | Solar Gold, Cold Storage for Bitcoin & Other Digital Assets, EAL6+ Secure Chip, PIN & Passphrase, Open-Source, Easy Setup
  • Unparalleled Security: Protect your assets with EAL 6+ Secure Element, offering robust defense and complete transparency
  • Simple & Secure Interface: Manage your digital assets easily with a clear OLED screen for secure on-device confirmations
  • Supports 1000s of Coins & Tokens: Securely handle thousands of assets, including Bitcoin, Ethereum, and more, all in one wallet
  • Effortless Asset Management: Monitor and transact seamlessly with Trezor Suite, our intuitive desktop and mobile app
  • Enhanced Backup Solution: Multi-share Backup eliminates single points of failure for secure cold wallet recovery

What happens when the recipient reveals the preimage

  1. Recipient claims its incoming HTLC. The recipient presents R, which hashes to H, to the final channel counterparty.
  2. The revelation moves backward. The final forwarding node now knows R and uses it to claim its incoming HTLC from the previous node.
  3. Each earlier hop settles. The preimage continues backward until the sender’s first channel update is resolved.
  4. Balances update off-chain. Successful settlement normally changes the latest channel states rather than publishing a blockchain transaction for every hop.

Because every conditional claim depends on the same preimage, the route cannot permanently settle only part of the payment under normal protocol operation. Lightning Labs describes individual payments as atomic: they either arrive at the destination in full or never leave the sender’s accounts.

What happens if the preimage never appears

If the recipient is offline, rejects the payment, or a later step cannot complete, the preimage is not revealed. The HTLCs then follow their timeout branches. The downstream contract reaches its deadline first; upstream contracts have later deadlines, so each party has time to remove its corresponding conditional balance and restore funds.

On-chain transactions are the fallback for an unresponsive or disputing peer. They are not required for every successful payment, but the channel protocols preserve timeout and settlement paths that can be enforced on the blockchain. This is why a failed payment may briefly show pending HTLCs before a channel returns to its normal balance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why a payment can fail even when a route looks available

Directional liquidity is unknown

Channel capacity is a structural limit, not a live promise that the required amount can travel in either direction. LND’s sending documentation identifies lack of knowledge about node balances as the primary reason payments fail. A recent payment, rebalancing operation, or concurrent transfer may have consumed the exact outbound liquidity your route needed.

Rank #4
Trezor Safe 7 Crypto Hardware Wallet with Bluetooth for Android/iOS/Desktop | Charcoal Black, Aluminum Unibody, 2,5" TouchScreen, Wireless Charging, Quantum-Ready, IP54, Long-Lasting LiFePO? Battery
  • Dual-chip architecture for maximum protection: The next-gen, fully auditable TROPIC01 chip works alongside a certified EAL6+ Secure Element—completely NDA-free—to deliver radically transparent, industry-leading defense against physical attacks.
  • Quantum-ready security: Get protection against future threats with the first-ever hardware wallet designed with quantum-ready architecture.
  • See every detail with confidence: Our largest high-resolution color touchscreen makes it easy to navigate your assets, review transactions and manage your coins with clarity.
  • Wireless freedom with encrypted Bluetooth control: Manage, buy, swap and stake securely using Trezor Suite on desktop or mobile. Qi2-compatible wireless charging keeps your Trezor powered up. No cables required—security meets convenience.
  • Works seamlessly with Android, iOS and desktop: Connect wirelessly or via USB-C to your phone or computer. Manage your crypto anywhere with our companion Trezor Suite app.

A peer or channel is unavailable

A node can be offline, a channel can be temporarily disabled, or a connection can drop while the payment is being attempted. The public graph may lag behind that operational state.

Fees or timelocks violate policy

A route may have enough apparent capacity but exceed a node’s fee limit, minimum HTLC amount, maximum HTLC amount, or acceptable total delay. Implementations reject paths that cannot satisfy the required expiry differences.

The failure occurs after partial forwarding

A forwarding failure does not mean an intermediary kept the principal. Without the preimage, the conditional claims cannot complete; the protocol returns the funds through timeout or cancellation handling. The sender’s wallet may mark a specific route as failed and retry using different channels or peers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A practical retry checklist

  • Verify that the invoice is unexpired and has not already been paid.
  • Retry after a short delay if the failure indicates a transient connection problem.
  • Use a smaller amount to test whether the issue is available liquidity rather than the destination.
  • Allow the wallet to select a different route instead of repeatedly forcing the same path.
  • Check whether the wallet reports a policy, fee, channel-disabled, or insufficient-liquidity failure; each points to a different bottleneck.
  • If an HTLC remains pending, wait for normal resolution before closing a channel or force-closing unless you understand the fee and confirmation consequences.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Can an intermediate node steal the sats?

Not simply by forwarding the payment. The node receives an HTLC, not an unconditional transfer. It can claim the incoming amount only with the preimage, and the preimage is revealed by the recipient’s successful claim. If the node withholds forwarding or tries to alter the packet, it cannot satisfy the cryptographic condition and risks losing the opportunity to settle before its timeout.

Best Value
Ledger Nano X - Classic Crypto Wallet with Bluetooth | Compact, go anywhere, 1.1" display. Desktop & iOS/Android compatible
  • Effortlessly build your crypto portfolio via the all in one Ledger Wallet app: buy, sell, send, receive, swap, stake and more across popular blockchains. 15,000+ coins & tokens in a single dashboard. Keep a close eye on the market. Compare service providers. Track performance. Get timely alerts. Build your portfolio with confidence.
  • Enjoy Bluetooth connectivity, iOS access, and hours of battery use with this mobile-first, secure backup signer. Freedom you can depend on.
  • Genuine Check: confirm your signer is authentic during setup with the Ledger Wallet app.
  • Protect your signer: keep it in mint condition at all times with a bespoke Pod or Case to avoid scratches and everyday wear and tear.

This protection assumes the channel software and keys are functioning correctly and that users honor the protocol’s on-chain remedies. A node can still cause inconvenience by going offline, refusing a policy-compliant payment, or forcing a timeout delay; atomicity protects the funds, not guaranteed delivery on the first attempt.

Does onion routing make Lightning anonymous?

It provides a strong privacy boundary between individual forwarding hops. Each intermediary learns its neighboring peers and the forwarding instructions relevant to it, rather than the entire route. The recipient does not need to learn the sender’s identity from the payment packet, and a middle hop does not automatically learn both endpoints.

That is not the same as perfect anonymity. Observers who control or monitor multiple points may correlate timing, amounts, channel activity, or repeated attempts. BOLT #4 explicitly warns that packet association through traffic analysis remains possible. Wallet logs, invoice reuse, network-level metadata, and identifiable communication patterns can also reveal information outside the onion packet itself.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which design choices matter when comparing Lightning implementations?

Different node and wallet implementations can produce different payment experiences even though they follow the same core HTLC and onion principles. Use these axes when evaluating an implementation or diagnosing behavior:

Decision area Questions to ask Why it matters
Route finding Does it use a modified shortest-path search, mission control data, multi-part payments, or other heuristics? Better estimates and retries can improve success when public graph data is incomplete.
Fee and timelock policy How does it price forwarding and limit total delay? A cheaper route may be slower or fail a peer’s policy; a faster route may cost more.
Liquidity visibility How does it learn from failed attempts and manage channel balances? Private directional liquidity is the largest source of uncertainty in route selection.
Privacy boundary What does each hop learn, and what metadata does the wallet or node retain? Onion encryption hides the full path but does not eliminate traffic-analysis or endpoint leaks.
Failure and retry behavior Does the wallet classify failures and select alternatives automatically? Useful diagnostics prevent repeated attempts over a route that is already known to be unsuitable.
Settlement mode Does the payment normally remain off-chain, and how are timeout or force-close paths handled? Off-chain settlement is quick; on-chain recovery is slower and incurs blockchain fees when a peer is unresponsive.

The shortest accurate mental model

Think of a Lightning payment as a sealed relay race with a single key. The sender maps a route using imperfect information, gives each runner only the next handoff, and places a conditional claim at every exchange. The recipient owns the key that unlocks the finish. Showing that key at the end unlocks every earlier claim in reverse order; never showing it causes the timed locks to expire.

This model explains the protocol’s three notable trade-offs at once: payments can settle quickly without putting every transfer on-chain, intermediaries can forward without taking custody, and successful routing depends on liquidity that the public graph cannot fully reveal. The protocol details cited here reflect the BOLT specifications and Lightning documentation accessed October 14, 2026; implementations and policies can change, so operational behavior should be checked against the version you run.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

BitcoinHTLCLightning Networkonion routingpayment channels

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.