Book a free call

The Bitcoin Lightning Network: How Fast Payments Work

The Lightning Network moves Bitcoin payments into payment channels, so they settle in seconds for a tiny fee. Here is how channels, routing and invoices work.

Hertiv engineering teamReviewed by a senior engineer
7 min read
The Bitcoin Lightning Network: How Fast Payments Work
On this page

Short answer

The Bitcoin Lightning Network is a layer on top of Bitcoin that lets people send bitcoin instantly for very low fees. Two parties lock bitcoin into a payment channel, update the balance between themselves off-chain as often as they like, and record the final balance on-chain when the channel closes. Channels link together, so a payment can hop through several of them to reach anyone on the network.

What is the Bitcoin Lightning Network?

The Bitcoin Lightning Network is a second layer built on top of Bitcoin that moves payments off the main blockchain so they can settle almost instantly and for a very small fee. It does not replace Bitcoin. It uses Bitcoin transactions to open and close payment channels, and it keeps the payments inside those channels off the chain.

Bitcoin's base layer confirms a block about every ten minutes, and each block holds a limited number of transactions. That makes on-chain payments slow and costly for small amounts such as a coffee or a tip. Lightning solves this by letting two parties transact privately between themselves and only publishing the final result.

The network is a web of payment channels. Each channel connects two participants, and channels join up so a payment can travel from sender to receiver through several intermediaries. The rules that make this safe are enforced by Bitcoin scripts, not by trust in the intermediaries. For a business that takes small Bitcoin payments, a crypto payment gateway is often the simplest way to start.

How does a payment channel work?

A payment channel is a shared pot of bitcoin that two parties control together. It starts with an on-chain funding transaction that locks bitcoin into a two-of-two multisignature address, which means both parties must sign to spend it. The amount locked in is the channel's capacity, and it caps how much value can move through the channel.

Once the channel is open, the two parties update the split of the funds between themselves by signing new commitment transactions. Each update replaces the last one, and none of them is broadcast to the blockchain. The parties can send value back and forth as many times as they like, and only the latest split matters.

To close a channel, the parties agree on the final split and publish a settlement transaction on-chain. The steps are:

  1. Open the channel with a funding transaction that locks bitcoin into a shared address.
  2. Exchange signed updates off-chain to move the balance back and forth.
  3. Agree on the final balance and publish one settlement transaction on-chain.
  4. Each party receives the bitcoin that the final split assigns to them.

If one party stops cooperating, the other can close the channel alone by publishing the latest signed commitment. Old states are punished by the protocol, so publishing an outdated balance can cost the cheater their funds.

How do payments travel across the network?

Payments travel across the network through a chain of channels, using hashed time-locked contracts, known as HTLCs. An HTLC is a conditional payment: the receiver can claim the funds only by revealing a secret, and the sender gets the funds back if the secret is not revealed before a deadline.

When a receiver wants to be paid, they create an invoice that contains the hash of a random secret. The sender builds a route through several channels, and each hop carries an HTLC locked to that same hash. The receiver reveals the secret to claim the final payment, and the secret then travels backwards along the route so each intermediary can claim theirs.

Because every hop uses the same secret and the same deadline logic, the payment either completes all the way or fails everywhere. An intermediary cannot keep the funds, because they can only claim their incoming payment by revealing the secret, which also lets the next hop claim theirs. Routing nodes earn a small fee for forwarding, which is why most payments cost only a few satoshis.

Payments are also wrapped in onion routing, so each node on the route only learns who paid it and who it pays next. No single node sees the full path from sender to receiver, which keeps the payment private.

What is a Lightning invoice?

A Lightning invoice is a payment request that a receiver creates before a payment is sent. It states the amount, a short description, an expiry time and the hash of the secret that will settle the payment. The sender's wallet reads the invoice and builds a route that can deliver that amount.

Invoices are single-use by design. Each one carries a fresh secret, so a payment cannot be replayed, and each one expires, so an unpaid invoice simply stops working. That expiry also protects the sender: if a payment gets stuck on the route, the HTLCs time out and the funds return to the sender.

Most wallets generate invoices automatically when a user asks to receive. The sender scans a QR code or pastes the invoice text, and the wallet handles the route. For a shop, this means the till can show a new invoice for every sale without any manual work. The best Bitcoin Lightning wallets all handle invoices this way.

Where does Lightning help most?

Lightning helps most where Bitcoin's base layer is too slow or too costly: small payments, frequent payments and payments that need to settle at once. The table below compares the common uses.

Use case Why Lightning fits What to watch
Retail and tips Settles in seconds, fees are tiny Needs a wallet and some channel liquidity
Content and streaming Pay per minute or per article Receivers must stay online to be paid
Machine payments Devices can pay each other directly Needs automated channel management
Cross-border remittance No bank in the middle, fast arrival On and off ramps still cost money
Gaming and apps In-app purchases without card fees Small amounts only, keep limits low
Exchange withdrawals Cheaper than on-chain for small sums Not every exchange supports it yet

Lightning is less useful for large one-off transfers, where an on-chain transaction is already cheap relative to the amount, and for holding savings, where the base layer is the safer place. It is a payments layer, not a vault.

Example (hypothetical): a coffee shop takes Lightning payments

Example (hypothetical): a coffee shop sells 200 cups a day at an average price of 15,000 satoshis, which is 3,000,000 satoshis a day. If every sale were an on-chain transaction with a fee of 2,000 satoshis, the shop would pay 400,000 satoshis a day in fees, which is more than 13 percent of its takings.

With Lightning, the shop opens one channel with 5,000,000 satoshis of capacity and takes all 200 payments through it. Each payment carries a routing fee of about 10 satoshis, so the day's fees come to 2,000 satoshis. The shop then closes the channel once a week and settles the week's balance on-chain in a single transaction.

The arithmetic shows the gap. On-chain, 200 payments times 2,000 satoshis is 400,000 satoshis a day. On Lightning, 200 payments times 10 satoshis is 2,000 satoshis a day, plus one weekly closing fee. The shop saves about 398,000 satoshis a day, which is why small-value payments are the strongest case for the network.

What are the common mistakes?

The most common Lightning mistakes are opening channels with too little capacity, ignoring liquidity direction, and treating a hot wallet like a savings account.

  • Channels that are too small. A channel can only carry payments up to its capacity, so a tiny channel fails on ordinary payments. Size channels for the payments you expect.
  • One-way liquidity. A channel that has only received payments cannot send any more until it is rebalanced or closed. Watch which side of the channel holds the funds.
  • Keeping large sums in a hot wallet. Lightning wallets are online by design, so keep only spending money there and hold the rest on-chain.
  • Closing channels too often. Every close is an on-chain transaction with a fee, so closing daily eats the savings. Close weekly or when the channel is spent.
  • Skipping backups. Losing the channel state can strand funds, so back up the wallet and the channel data.

Teams that want to accept Lightning payments should also read the guide to developing a Lightning wallet before choosing an approach.

The comparison of Bitcoin layer 2 options is also worth reading before you commit to one design.

Key takeaways

  • Lightning moves Bitcoin payments off-chain into channels that settle in seconds
  • A channel is a shared pot of bitcoin; only the opening and closing touch the blockchain
  • HTLCs let payments hop through strangers safely, because each hop needs the same secret
  • Invoices are single-use and expire, so stuck payments return to the sender
  • Lightning fits small, frequent payments and is a poor place to hold savings

Frequently asked questions

What is the difference between Bitcoin and the Lightning Network?

Bitcoin is the base blockchain that records transactions in blocks about every ten minutes. The Lightning Network is a layer on top of it made of payment channels between users. Payments inside a channel settle off-chain and only the opening and closing are recorded on Bitcoin.

Is Lightning safe if an intermediary goes offline?

Yes, mostly. If a payment cannot complete, the HTLCs time out and the funds return to the sender. If a channel partner disappears, you can close the channel alone using the latest signed commitment. You do need to watch your channels, or use a watchtower service that watches them for you.

How much does a Lightning payment cost?

Usually a few satoshis, split between the routing nodes that forward it. The exact fee depends on the route and the amount, and the sender's wallet shows it before the payment is sent. Opening and closing a channel costs an on-chain fee, so those steps are the expensive part.

Do I need to run a node to use Lightning?

No. Most people use a Lightning wallet app that handles channels and routing for them. Running your own node gives you more control over fees, privacy and channel choice, but it also means you manage backups and uptime yourself. Start with a wallet and move to a node only if you need it.

Can Lightning handle large payments?

It can, but large payments need a route where every channel on the path has enough capacity, which is not always available. Very large transfers are usually cheaper and simpler on-chain. Lightning is built for small and medium payments, and wallets can split a payment across several routes when needed.

What happens if I lose my Lightning wallet?

It depends on the wallet. Most wallets let you restore funds from a backup phrase, but channel funds need the channel state as well, so a plain seed phrase is not always enough. Keep the wallet's backup file safe and follow its recovery instructions. Test recovery with a small amount before trusting it.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning to accept Bitcoin payments and wondering if Lightning fits? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Crypto Payment Gateway service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call