Skip to main content

Lightning Network

The Lightning Network is a Layer 2 scaling solution for Bitcoin that enables instant, low-cost payments. It's the backbone of Nostr's payment infrastructure.

What is Lightning Network?​

Lightning is a network of payment channels built on top of Bitcoin:

Key Properties​

PropertyBitcoin On-ChainLightning
Speed10-60 minutesMilliseconds
FeesVariable ($0.50-$50+)Near-zero ($0.001)
Throughput~7 TPS1,000,000+ TPS
PrivacyPublic ledgerRoute-based
MinimumDust limit (~$3)1 satoshi

How Lightning Works​

Payment Channels​

  1. Opening: Fund a channel with on-chain Bitcoin
  2. Transacting: Unlimited off-chain payments
  3. Closing: Settle final balance on-chain

Alice can send up to 1 BTC to Bob without touching the blockchain.

Routing​

Payments route through multiple channels:

Each node charges a small routing fee.

Lightning on Nostr​

Integration Points​

  1. Zaps - NIP-57 Lightning payments
  2. NWC - NIP-47 Wallet connectivity
  3. LNURL - Simplified payment flows
  4. Marketplace - Product payments

LNURL​

LNURL simplifies Lightning interactions:

LNURL TypePurpose
lnurl-payReceive payments
lnurl-withdrawClaim payments
lnurl-authAuthentication
lnurl-channelOpen channels

Lightning Address​

Human-readable payment addresses:

user@domain.com → LNURL-pay endpoint

Behind the scenes:

GET https://domain.com/.well-known/lnurlp/user
Returns: Payment endpoint metadata

Setting Up Lightning​

Option 1: Custodial Wallets​

Easiest for beginners:

WalletFeatures
Wallet of SatoshiSimple, no setup
AlbyBrowser extension
StrikeEasy fiat on-ramp

Option 2: Self-Custodial​

More control, more responsibility:

WalletFeatures
PhoenixMobile, auto channels
MutinyWeb-based, private
ZeusFull node control
BreezPOS features

Option 3: Full Node​

Maximum sovereignty:

# Example: Running a node
- Bitcoin Core (base layer)
- LND / CLN / Eclair (Lightning implementation)
- RTL / ThunderHub (management UI)

Lightning Invoices​

Invoice Structure​

ComponentExampleDescription
Network prefixlnbcmainnet
Amount1000n1000 sats
Data payload1pj...Payment hash, etc.

Invoice Fields​

FieldDescription
AmountPayment amount in sats
Payment HashUnique payment identifier
ExpiryTime until invoice expires
DescriptionPayment memo
Route HintsHelp find recipient

Creating Invoices​

Via NWC:

{
"method": "make_invoice",
"params": {
"amount": 1000,
"description": "Thanks for the content!"
}
}

Lightning Limitations​

Channel Capacity​

  • Maximum payment = smallest channel in route
  • Large payments may fail
  • Solution: Multiple smaller payments or MPP

Inbound Liquidity​

To receive, you need inbound capacity:

Solutions:

  • Buy inbound liquidity
  • Spend first to create inbound
  • Use services like Loop

Online Requirement​

  • Must be online to receive
  • Watchtowers can protect channels
  • Custodial solutions avoid this

Lightning + Nostr Flow​

Sending a Zap​

1. User clicks ⚡ on post
2. Client creates Zap Request
3. Sends to recipient's LNURL
4. LNURL returns invoice
5. Client pays via NWC
6. Wallet pays Lightning invoice
7. LNURL publishes Zap Receipt

Receiving Payments​

1. Set lud16 in profile
2. Point to LNURL endpoint
3. Endpoint handles:
- Invoice generation
- Payment receipt
- Zap receipt publishing

Best Practices​

For Users​

  1. Start custodial - Learn before self-custody
  2. Fund appropriately - Keep small amounts for zapping
  3. Multiple wallets - Separate spending/savings
  4. Backup keys - Protect wallet seeds

For Developers​

  1. Use NWC - Standard wallet connection
  2. Handle failures - Lightning can timeout
  3. Implement LNURL - Better UX
  4. Test on testnet - Before mainnet

On-Chain​

While Lightning is the primary payment method on Nostr, on-chain Bitcoin payments are still useful for:

  • Large amounts where Lightning capacity is insufficient
  • Long-term savings
  • Channel funding
  • Cold storage deposits

On-Chain vs Lightning​

Use CaseRecommended
Zaps and tipsLightning
Small purchasesLightning
Large payments (1000+ USD)On-chain
SavingsOn-chain
Channel depositsOn-chain

On-Chain in Nostr​

On-chain payments aren't directly integrated into Nostr protocols yet, but you can:

  • Share on-chain addresses in DMs
  • Use NIP-15 marketplace with on-chain option
  • Include Bitcoin addresses in profiles

Resources​

Wallets​

Learning​


Micropayments Unlocked

Lightning makes payments of 1 sat (~$0.001) economically viable. This enables entirely new business models impossible with traditional payment systems.