How the Lightning Network Works: Channels, HTLCs and Routing
This article was translated from Japanese with AI. Read the original (日本語) · Report a translation issue
From a coffee in New York to a New Year's gift for the kids back home, Bitcoin is money you can use anywhere in the world, for almost anything. There was a time when people said Bitcoin was slow to send and expensive to use, but the arrival of a technology called the "Lightning Network" has made trustless, permissionless payments possible with a far better payment experience.
To start with a quick summary of the history: the Lightning Network was proposed in February 2015, when Joseph Poon and Thaddeus Dryja published their co-authored initial draft (0.5). The final version 0.5.9.2 was released on January 14, 2016.
Thaddeus Dryja, one of the Lightning Network's authors, worked at Mie University in Japan around 2011.
Satoshi Nakamoto, Bitcoin's inventor, also has a name that sounds Japanese (their true identity remains unknown to this day). Bitcoin turns out to have some unexpected ties to Japan.

The Lightning Network has no reference implementation the way Bitcoin has Bitcoin Core, meaning there is no single codebase that serves as the standard. Technical specifications are therefore needed so that different development teams can build software that works together.
These standards are discussed by developers around the world and documented as a specification called BOLT (Basis of Lightning Technology). As of October 2026, it consists of 12 sections, BOLT #0 through #12 (excluding #6).
For details on each BOLT, follow the links in the table below.
| BOLT #0 | Terminology |
|---|---|
| BOLT #1 | Base protocol |
| BOLT #2 | Peer protocol |
| BOLT #3 | Transactions and scripts |
| BOLT #4 | Onion routing |
| BOLT #5 | Recommendations for on-chain handling |
| BOLT #6 | (Removed) |
| BOLT #7 | Node and channel discovery |
| BOLT #8 | Encrypted transport |
| BOLT #9 | Feature flags |
| BOLT #10 | DNS bootstrap |
| BOLT #11 | Invoices |
| BOLT #12 | Offers |
If you scroll all the way to the bottom of BOLT #0, you'll find a section called "Theme Song" with lyrics written by Anthony Towns. Take a look if you're curious.
Based on the BOLT specification, the Lightning Network has been developed by multiple teams since around 2016, and it came into real use on mainnet around 2018. One advantage of having multiple implementations is that users are free to pick whichever one they prefer.
There are three major implementations: LND (Lightning Network Daemon), CLN (Core Lightning) and Eclair.
| Implementation | Developer | Language |
|---|---|---|
| LND | Lightning Labs | Go |
| CLN | Blockstream | C |
| Eclair | ACINQ | Scala |
As of October 2026, these two implementations dominate the market, with LND and CLN reportedly accounting for about 98% of all Lightning nodes. Eclair is used by the large routing node that ACINQ operates, but you rarely see individuals running Eclair.
If you want to build a Lightning node or wallet into your own app, another option is LDK (Lightning Development Kit), a library provided by Spiral.
In this article, we dig deeper and explain how the Lightning Network actually works.
If you're a beginner or a business, we also recommend the articles below, which explain how the Lightning Network solved the problems Bitcoin used to face, along with real-world use cases and its potential in Japan.
Why was the Lightning Network created?
Let's start with a question: why was the Lightning Network created in the first place?
Before the Lightning Network, Bitcoin payments could only happen on the blockchain, which came with a number of problems.
Two of the biggest were:
- Slow transfers (funds usually take around 10 minutes to arrive)
- High fees (which vary with how congested the network is)
The Lightning Network was created to solve these problems as "a system that moves payments off the blockchain and records only the end result on it."
Bitcoin's scalability problem
Around 2017, the number of Bitcoin users surged, and more transactions were being created than could fit into blocks. As a result, transfers were delayed and fees spiked. This is known as the scalability problem.

For a more detailed explanation, see this article
The chart below shows the situation at the time, plotting fees per block over the years.

The chart shows fees reaching a temporary peak in late 2017. At the time, it was common for a transfer to take tens of minutes and cost several thousand yen in fees.
The main cause was that blocks were limited to 1 MB. This sparked the block size debate over whether the block size should be increased to accommodate the growing number of transactions.
In the end, rather than a hard fork that would simply increase the block size, Bitcoin chose to activate a soft fork called "SegWit" in August 2017.
The Lightning Network itself had been proposed in 2015, but SegWit's activation laid the groundwork for implementing it safely, and serious development began on it as a system for making payments on a separate layer from on-chain.
Bitcoin is called digital gold, but one feature Bitcoin has that gold lacks is that it's easy to verify. Telling whether gold is genuine requires expensive specialized equipment, whereas Bitcoin can be verified with nothing more than the computer you already own. Making blocks much bigger, however, would eat heavily into the storage of the computers doing the verifying, making it hard for just anyone to verify the chain.
So in August 2017, Bitcoin rolled out an upgrade called "SegWit (Segregated Witness)." SegWit effectively expands block size by counting signature data and similar parts of a transaction at one quarter of their size.
In other words, Bitcoin didn't refuse to grow blocks at all. It expanded capacity through a soft fork that stays compatible with older nodes, within limits that keep verification easy. Beyond that, it chose to handle further growth in payments on separate layers such as the Lightning Network.
Meanwhile, the camp that increased the block size through a hard fork split off from Bitcoin in August 2017, and that chain is now known as Bitcoin Cash.
How the Lightning Network works

The diagram above is a visualization of the Lightning Network. In this section, we introduce the terms you need to understand it.
The Lightning Network forms a network like the one shown above, on a layer separate from the blockchain (on-chain). Computers around the world run the software, and each of these computers is called a "node." The lines connecting nodes are called "payment channels (channels)," and bitcoin is sent and received through them.
Payment channels
We'll start with the "payment channel," the path used to send bitcoin off the blockchain (off-chain).
Take a look at the following diagram.

This diagram shows a simplified flow of a channel in the Lightning Network. The area above the dotted line is off-chain, meaning the Lightning Network, and the area below it is on-chain.
The main Lightning Network cycle can be summarized as follows.
- Opening a channel
- Updating the state
- Recording the final state (closing)
Opening a channel
In the first step, a channel is opened to move bitcoin from on-chain to off-chain.

As the diagram shows, the channel is opened by sending on-chain bitcoin to a 2-of-2 multisig address, locking it there. Put another way, the bitcoin is placed in a safe that can only be opened when both parties sign. The basic idea of the Lightning Network is that the funds themselves stay on-chain, while only how they are split between the two parties is exchanged off-chain.
Because the party opening the channel has to deposit the bitcoin (funding), in the diagram the channel is filled entirely with A's bitcoin.
Normally in the Lightning Network, the node opening a channel has to fund it. "Dual-funded channels," in which both nodes contribute funds, have been proposed for some time, but as of October 2026 only CLN and Eclair have implemented them.
Updating the state
When a payment is made, the bitcoin in the channel shifts, a bit like beads sliding on an abacus, and the state is updated.

In the diagram, you can see that when A sends bitcoin, the bitcoin in the channel is redistributed. This means a key characteristic of Lightning payments is that you fundamentally cannot send more than the funds in the channel.
Now for some terminology. The total amount of bitcoin in a channel is called its "capacity." From A's point of view, the amount A can send is called "outbound liquidity (local balance)," and the amount A can receive is called "inbound liquidity (remote balance)."
Note, however, that adding up capacity does not give you a metric that captures the Lightning Network as a whole. That's because not every channel is public: it's possible to open "private channels" whose existence is hidden.
For more details, see the article by Landon, who has been involved in developing the BOLTs.
Recording the final state (closing)
Finally, in the Lightning Network, closing a channel returns the bitcoin in it to on-chain.

There are two main ways to close a channel and return the bitcoin on-chain: a "cooperative close" and a "force close."
Cooperative close
A cooperative close is used when both nodes are online and agree to close the channel. A and B create a new "closing transaction" based on their final balances, both sign it, and broadcast it.
Force close
A force close lets one node close the channel on its own when the other node is offline and unresponsive, or when the two can't reach agreement.
A distinctive feature is that the balance of the party initiating the force close can't be spent until a set period (to_self_delay) has passed, while the other party's balance is available immediately. This delay gives the other party time to respond if the party force-closing is trying to cheat.
A force close also requires broadcasting a more complex transaction than a cooperative close, so it tends to cost more in fees. It is carried out at a fee rate agreed on in advance.
Commitment transactions and penalties
Here we take a closer look at how a channel's state changes as payments are made, and explain what to watch out for.
First, suppose A funds the channel with 20,000 sats. At this point, A can send up to 20,000 sats to B, but B doesn't yet have any funds to send to A.
A payment from A to B means redistributing the channel's balance, and the transactions that carry out these state changes are called "commitment transactions."

In the diagram, three payments have been made in total, so there are commitment transactions numbered 0 through 3. In Bitcoin, transactions don't expire, so all four commitment transactions are valid. That means a transaction reflecting an old state could still be recorded on-chain.
To deal with this, whenever a new commitment transaction is created, each party gives the other a secret value called a "revocation secret" corresponding to the old state. If an old transaction is recorded on-chain, the other party can use this secret to derive the revocation key and claim all the bitcoin in the channel. Because using an old state means risking the loss of everything, there's no incentive to cheat.
As an example, consider a case where B goes offline for some reason.

In the current state, A's balance is 6,000 sats. Since B is offline, A could cheat by recording on-chain the earlier transaction in which A owned 20,000 sats, withdrawing 14,000 sats more than A is entitled to.
Because B is offline, A performs a force close. A force close comes with a grace period (generally somewhere between one day and two weeks), so A can't withdraw their share right away. If B comes back online within that period and notices the fraud, B can broadcast a penalty transaction and receive all the bitcoin in the channel.
For these reasons, Lightning nodes need to stay online at all times.
As insurance in case you do go offline, you can also set up a watchtower that monitors the blockchain for cheating.
For a detailed explanation of watchtowers, see the article below.


HTLCs (Hashed Time-Locked Contracts) and payments
Next, we'll unpack what is exchanged between nodes during a payment, and why bitcoin is safely refunded if a payment fails.
The following diagram shows the flow of a payment on the Lightning Network.

A, the sender, asks B for an "invoice" that includes the amount and other details. This is similar to how an online store shows a QR code (a bill) when you press the purchase button.
B, for their part, creates the invoice using a "preimage hash," which is the hash of a secret value called the "preimage," and gives only the invoice to A. At this stage, the preimage must not be revealed to anyone.
For a detailed explanation of invoices, see the article below.
After receiving the invoice, A locks the payment amount using a cryptographic mechanism called an HTLC (Hashed Time-Locked Contract). At this point, the payment is not yet complete.

If the amount on the invoice is 10,000 sats, A locks 10,000 sats with the HTLC. The HTLC can then be unlocked in one of two ways:
1. If B reveals the preimage:
If the hash of the preimage matches the preimage hash, the HTLC is unlocked and the bitcoin goes to B. This condition is enforced by Bitcoin Script, so A cannot refuse to pay. The preimage A receives also serves as proof that the payment was completed (a receipt).
2. If the preimage isn't revealed before the specified time has passed:
The payment is treated as failed, the HTLC is unlocked, and the bitcoin is refunded to A. In practice, when a payment fails it is usually canceled right away without waiting for the timelock, which serves as a final safety mechanism.
From 1 and 2, a Lightning payment can only either succeed or fail: it never sends a partial amount or comes up short. This property is called atomicity.
Payments can be sent and received trustlessly because the HTLC's cryptographic mechanism makes cheating impossible.
Onion routing
So far, we've looked at payments between nodes that share a direct channel.
There are about 16,000 nodes and 32,500 channels around the world, though, and of course you can't open channels to all of them. So how does the Lightning Network send bitcoin to a node you have no channel with?
The answer is simple: several nodes in between relay the payment, a process called "routing," so the bitcoin can reach a distant node.
You might worry that the relaying nodes could skim off some of the bitcoin, but HTLCs combined with a mechanism called "onion routing" guarantee atomicity.
As an example, consider sending a payment from A to D via B and C.

The nested, matryoshka-like data structure here is called an "onion." Cryptography ensures each node can only see its own outer layer of data, so relaying nodes only learn about the hops immediately before and after them. This gives the payment a certain degree of privacy.
With onion routing, relaying nodes only know about the hops immediately before and after them. But what about C, the last relaying node? If D, the recipient, is using a mobile wallet, mobile wallets don't route payments, so C can easily infer that D is the final recipient.
And because each payment between individual nodes is made atomic by HTLCs, just like a regular direct payment, the payment as a whole is atomic as well.
Routing fees
Now let's look at the fees for making a payment on the Lightning Network.
Broadly speaking, there are two types of fees:
- Base fee (Base_fee)
- Fee rate (Fee_rate)
The base fee is a fixed fee, while the fee rate varies with the amount being relayed. Relaying nodes charge these fees in return for moving their own channel balance (the funds in the channel). For that reason, each node can set its fees on a per-channel basis.
Base fee (Base_fee)
The base fee is a fixed fee charged regardless of the amount being relayed. It is denominated in msat (millisatoshis), a unit equal to one thousandth of a sat. In our experience, almost every node charges a base fee of only 0–1,000 msat, or 0–1 sats, so it's very low.
Fee rate (Fee_rate)
Fee_rate is a proportional fee whose value depends on the amount being relayed. It is expressed in ppm (parts per million), indicating how much is charged per 1 million sats. For example, ppm = 500 means a fee of 500 sats (0.05%) for every 1 million sats sent.
On the Lightning Network, the sum of these two fees is charged for each relay.

The sender (A in the diagram) calculates the payment fees starting from the recipient's end.
For C→D, 10,000 sats are relayed, so node C requires a 7-sat fee. For B→C, 10,007 sats are relayed, so node B requires a 6-sat fee. So in the diagram, sending 10,000 sats from A to D costs 13 sats in fees.
Fees on the Lightning Network can be set channel by channel, but because low-fee routes get chosen, payments can be made relatively cheaply.
For a more detailed explanation of fees, see the following article.
The fees we've described so far are set on the "outgoing" channel when relaying a payment. Fees set on the "incoming" channel, by contrast, are called inbound routing fees.
This is a mechanism LND introduced on its own and is not part of the BOLT specification. It's mainly used to discount fees (by setting a negative value). Implementations that don't support it simply ignore the discount and pay the normal fee, so the payment itself still succeeds.
Pathfinding
The sending node wants to keep fees as low as possible. So the sender's computer calculates a payment route to the recipient that minimizes fees.
On the Lightning Network, this calculation is generally called "pathfinding," and many implementations use a mathematical method called Dijkstra's algorithm.
Pathfinding actually isn't specified in the BOLTs. As a result, each implementation finds paths differently, each with its own characteristics. We'll add a link here once we've written an article on how each implementation handles pathfinding.

There are two points to keep in mind here. Suppose the red route in the diagram above has the lowest fees. This route sends the payment over 4 hops (passing through 4 channels).
However, the shortest route, going in a straight line from sender to recipient, is only 3 hops, which shows that pathfinding doesn't necessarily choose the shortest route.
Now take a look at the next diagram.

As the diagram shows, the sender knows the balances of their own connected channels but cannot know the balances of other channels in the network. If, on the channel to the next node, the relaying node's balance is smaller than the payment amount, it can't relay the payment and the payment fails. So even after finding a low-fee route, sending a payment ultimately comes down to trial and error.
To improve the chance of success, there's also a mechanism that keeps a record of past payment results. Routes where payments tend to fail become less likely to be chosen.
So nodes that want to earn fees by routing need to work at keeping their channel balances evenly distributed, so that payments passing through their channels don't fail.
As an aside, there's also a mechanism for outsourcing pathfinding to another node. That goes beyond the scope of this article, so if you're curious, see the article below.
Gossip protocol
How does a sending node get information about nodes all over the world?
On the Lightning Network, information is passed from node to node like "gossip," spreading the way rumors do. This mechanism is called the "gossip protocol," and anyone running a Lightning node can obtain the information.
The gossip provides three kinds of information:
- node_announcement (node information)
- channel_announcement (channel information)
- channel_update (routing information)
At Bitcoin Research Lab, we use this information for a variety of analyses.
The article below is a good one for getting a bird's-eye view of the Lightning Network.
Ways to pay on the Lightning Network other than invoices
In most cases on the Lightning Network, you have the recipient issue an invoice and use it to pay. In terms of user experience, it's like PayPay, Japan's popular QR payment app: you scan a QR code, press the send button, and it's done in seconds.
As a supplement, here are some payment mechanisms that don't involve issuing an invoice. See the linked pages for a detailed explanation of each.
The first is the "Lightning Address." This lets you send a payment to an email-style address like bitcoin-research@example.com. Whereas an invoice is a long string of characters, a Lightning Address uses an email format, so it's easy to read and makes for a great payment experience.
However, behind the scenes a Lightning Address works by contacting the recipient's web server and automatically fetching an invoice, so it doesn't eliminate the need for invoices. Note also that the recipient needs to provide a web server (or use a business that provides one).

The second is "Keysend." It's used when the payer sends a payment unilaterally, such as for tips or advertising. It actually uses a clever trick: the payment is made by sending the preimage to the recipient.
The third is "BOLT12 Offers." Whereas an invoice is a one-time bill, BOLT12 Offers are a reusable way to get paid and, as the name suggests, are standardized in BOLT12.
With BOLT12 Offers as well, the payer uses the Offer to fetch an invoice from the recipient over the Lightning Network at payment time. The big difference from a Lightning Address is that no web server is required.
Bonus: New technologies that complement Lightning
That concludes our explanation of the Lightning Network. If you've read this far, you should now have a good grasp of the big picture.
In this section, we briefly introduce two of the latest technologies that complement the Lightning Network: "Ark" and "Spark."
Both are Layer 2 payment technologies that let you send bitcoin quickly and with low fees without opening Lightning channels, managing liquidity or dealing with complex routing, and both can also handle sending to and receiving from the Lightning Network.
These two technologies are highly complex and hard to grasp, but Bitcoin Research Lab has published several explainers on them, so if you want to go further down the rabbit hole, be sure to check them out.


Summary
The Lightning Network is a system for making payments off the blockchain, created to ease Bitcoin's scalability problem.
Funds are locked in a 2-of-2 multisig payment channel, and the state is updated with commitment transactions. HTLCs ensure a payment either succeeds or fails (atomicity), and onion routing makes it possible to pay someone trustlessly even without a direct channel to them.
As a result, Bitcoin can now be used in everyday life as a fast, low-fee means of payment.
What we've covered here are the fundamentals, but Lightning continues to evolve with new payment methods such as Lightning Address and BOLT12 Offers, and complementary technologies such as Ark and Spark. We encourage you to read the related articles as well to deepen your understanding.















