Book a free call

How to Develop a Lightning Network Wallet That Works

A Lightning Network wallet needs a custody model, a node or provider, channel management, clear fees and a tested recovery flow before it is ready for real money.

Hertiv engineering teamReviewed by a senior engineer
6 min read
How to Develop a Lightning Network Wallet That Works
On this page

Short answer

To develop a Lightning Network wallet, choose a custody model, set up a node or a Lightning service provider, build channel management and payment routing, and add backup and recovery. Then test on testnet with real payment flows, audit the code, and launch to a small group first so failures surface before real money is involved.

What is a Lightning Network wallet?

A Lightning Network wallet is an app that sends and receives bitcoin over the Lightning Network, a layer on top of Bitcoin that moves small payments off the main chain. Instead of waiting for a block confirmation, payments travel through payment channels and settle in seconds, with fees of a few satoshis.

A channel is a shared balance between two parties, funded by an on-chain transaction. Once open, the two sides can send payments back and forth by updating that balance, and only the final balance needs to be written to the Bitcoin blockchain when the channel closes.

Wallets come in two shapes. A custodial wallet holds the user's funds and manages channels for them, while a non-custodial wallet gives the user their own keys and channels. The choice shapes almost every later decision, from the interface to the legal duties of the operator.

Lightning runs on Bitcoin's second layer; what is Bitcoin layer 2 explains the idea behind it.

Custodial or non-custodial: which wallet should you build?

The first decision is who holds the keys. The table below compares the two models on the points that matter most to a team choosing between them.

ModelWho holds the keysBest forMain trade-off
CustodialThe operatorNew users who want instant paymentsOperator holds customer funds
Non-custodialThe userExperienced users who want controlMore support work and harder recovery
HybridBoth, by user choiceTeams serving both groupsTwo systems to maintain

Most consumer wallets start custodial because the experience is simpler: no channel management, no backup phrases, no waiting for confirmations. Teams that serve experienced users, or that want to avoid holding customer funds, build non-custodial wallets and accept the extra support work that comes with them.

A hybrid route is common. The wallet starts custodial so users can send their first payment in seconds, then offers self-custody as an upgrade for users who want it. The cost is complexity: the team maintains two systems instead of one.

What does a Lightning wallet need to do?

A Lightning wallet needs to do five things well: create and manage channels, find routes for payments, show balances and history clearly, keep keys safe, and recover funds if the phone is lost. Everything else is secondary.

  • Open and close channels. The wallet funds channels, watches them and closes them cleanly.
  • Send and receive with invoices. Payments use invoices that state the amount and the destination.
  • Show fees before payment. The user sees the total cost before confirming, not after.
  • Back up keys and channel state. Losing a phone must not mean losing funds.
  • Handle offline receiving. The wallet explains what happens when the user is offline.

Receiving while offline is the hardest of the five. Lightning payments need an open channel and a route, so a wallet that is switched off cannot receive unless a service holds the payment or the wallet uses a static address. Teams should explain this limit honestly instead of hiding it.

Fees need the same honesty. A payment can fail or cost more than expected when no cheap route exists, so the wallet should show the fee before the user confirms and explain why a payment failed in plain words.

How do you build a Lightning wallet, step by step?

Building a Lightning wallet follows a fixed order. Each step depends on the one before it, so skipping ahead usually means rebuilding later.

  1. Choose the custody model and the node software. Decide who holds the keys and whether the team runs its own node.
  2. Set up a node or a Lightning service provider. A provider is faster to start; a self-run node gives more control.
  3. Build channel management and liquidity handling. Open channels, watch balances and suggest new channels when liquidity runs low.
  4. Add invoices, payments and balance display. The payment flow and the balance view are the core of the app.
  5. Add backup and recovery. Keys and channel state must survive a lost or broken phone.
  6. Test on testnet with real payment flows. Use real users and real failure cases, not only scripted tests.
  7. Audit, then launch to a small group first. Fix what the audit and the pilot find before opening up widely.

Node software is the first technical choice. Teams either run their own node software or use a provider that runs nodes for them, which is faster to start but adds a dependency and a monthly cost. Either way, the wallet needs a way to watch the blockchain for channel closes and to react if a counterparty tries to cheat.

Testing deserves more time than most teams plan for. Payments can fail for a dozen reasons — no route, not enough liquidity, a peer offline — and each failure needs a clear message and a retry path. A testnet launch with real users finds these cases faster than any internal checklist.

Key management is the hardest part of a non-custodial build; how to set up an MPC wallet covers one approach teams use.

How do channels, fees and liquidity work?

A channel holds a fixed amount of bitcoin, split between the two sides. Payments move that split back and forth, so a channel can only send as much as its side currently holds. When one side runs out, the channel must be refilled or a new one opened.

Liquidity is the practical limit on every payment. A wallet with many small channels can receive small payments easily but struggles with large ones, while a few large channels handle big payments but cost more to open. Good wallets watch this balance and suggest new channels before the user hits the limit.

Fees have two parts: the network fee for opening and closing channels on-chain, and the routing fee paid to nodes that forward a payment. Routing fees are usually a few satoshis, but they rise when the network is busy or the route is long. The wallet should show the total before the user confirms.

The wider context is layer 2 scaling; what is layer 2 explains how these networks fit together.

Example (hypothetical): a wallet with 200 channels

Example (hypothetical): a small wallet service runs a node with 200 channels, each funded with 2,000,000 satoshis. Total capacity is 200 x 2,000,000 = 400,000,000 satoshis, or 4 bitcoin, since 100,000,000 satoshis make one bitcoin.

The node routes 20,000 payments a month at an average fee of 5 satoshis per payment, earning 100,000 satoshis a month, or 1,200,000 satoshis a year. That is about 0.012 bitcoin a year, which covers only a small part of the server and on-chain costs — routing alone rarely pays for a wallet service.

The lesson is that routing income is a side benefit, not a business model. A wallet earns its keep from the service around the payments: subscriptions, spreads on swaps, or fees for instant channel opens that users are willing to pay for.

What are the common mistakes?

The most common mistakes are launching without a backup story, hiding fees until after payment, and assuming every payment will find a route. Each one costs users money or trust.

  • No tested recovery flow. Backup that has never been tested on a real device is a guess.
  • Channels opened with too little capacity. Small channels block the payments users actually want to make.
  • No plan for force closes. A peer going offline must not leave funds stuck for weeks.
  • Treating testnet success as mainnet readiness. Real users, real peers and real fees behave differently.
  • Ignoring watchtower protection. Without it, an offline user cannot catch a cheating counterparty.

Recovery is the mistake that hurts most. If a user loses their phone and the wallet has no backup of keys and channel state, their funds may be locked in channels they can no longer close. Test recovery with a real device before launch, not after the first support ticket.

Key takeaways

  • Custody is the first decision, and it shapes the interface, the law and the support load
  • A wallet must manage channels, routes, fees, keys and recovery, not just payments
  • Liquidity limits every payment, so watch channel balances before users hit them
  • Routing fees rarely pay for a wallet service on their own
  • Test recovery on a real device before launch, not after the first lost phone

Frequently asked questions

What is a Lightning Network wallet?

A Lightning Network wallet is an app that sends and receives bitcoin over the Lightning Network, a layer on top of Bitcoin. Payments move through channels and settle in seconds, instead of waiting for a block confirmation.

Should I build a custodial or non-custodial Lightning wallet?

Custodial is simpler for new users because the operator manages channels and keys. Non-custodial gives users control of their own funds but needs more support work and a tested recovery flow. Many teams start custodial and add self-custody later.

How much does it cost to open a Lightning channel?

Opening a channel needs one on-chain transaction, so the cost is the Bitcoin network fee at the time. Once open, payments inside the channel cost only small routing fees of a few satoshis each.

Can a Lightning wallet receive payments while offline?

Not on its own. A payment needs an open channel and a route, so an offline wallet cannot receive unless a service holds the payment or the wallet uses a static address. The wallet should explain this limit clearly.

What happens if my counterparty closes a channel while I am offline?

The channel closes on-chain at the last agreed balance. If the counterparty tries to close with an old balance, a watchtower can catch it and claim the funds, which is why watchtower protection matters for non-custodial wallets.

Do I need to run my own node to build a Lightning wallet?

No. Teams can use a Lightning service provider that runs nodes for them, which is faster to start. Running your own node gives more control but adds server work, monitoring and on-chain costs.

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

Building a Lightning wallet? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Crypto Wallet 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