RoadmapsProjects
Sign in./start

Learn

RoadmapsProjects

Contribute

DiscoverIssues

Account

Sign in./start-building

Become an Open Source Builder. Learn. Build. Contribute.

Learn

RoadmapsProjectsStart Building

Contribute

DiscoverIssues

Account

Sign inDashboardSettings

Legal

PrivacyTerms

© 2026 Pull // all rights reserved

PrivacyTerms

lesson // lightning

Invoices

Create, decode, and settle BOLT11 invoices on testnet or regtest.

intermediate5 days

Public lesson — sign in to track progress on this roadmap.

./sign-in

On this page

Learning objectives

  • Decode BOLT11 fields that wallets rely on
  • Create and pay invoices on a local Lightning lab
  • Handle expiry, amounts, and description safely

study // plan

Lessons are primers. Depth comes from required reading, interactive labs, reflection, and a hands-on check with evidence — the BOSS study pattern.

Research on Bitcoin Search
BOLT11Lightning invoice

Required reading

  • boltBOLT11 Invoice Protocol

Reflection prompts

  1. Explain Invoices to a teammate without jargon — what problem does it solve?
  2. What would break in production if you misunderstood Invoices?
  3. Which BOLT (or implementation doc) is the source of truth for this topic, and what did you verify there?

Lab // Polar check

After reading, run one hands-on check related to Invoices. Prefer local regtest or Polar over mainnet.

evidence required

  • ·Command output or screenshot from your local lab
  • ·One sentence on what you observed vs expected
  • ·Link to the required reading section you used

A BOLT11 invoice is a bech32-encoded payment request. It tells a payer what to pay, where hints might help, and when the request expires.

Why this matters

POS apps, SaaS billing, and wallets all mint invoices. Incorrect expiry or amount handling causes failed payments and angry users.

Analogy

An invoice is a temporary ticket: amount, destination commitment (payment hash), and a deadline. After expiry, the ticket is useless even if someone pays late.

Key fields

  • Payment hash / payment secret
  • Amount (optional for “any amount”)
  • Expiry / timestamp
  • Description or description hash
  • Routing hints for unannounced channels

Loading diagram…

Invoice commits to a payment hash; settlement reveals the preimage.
# CLN example
lightning-cli invoice 10000 "coffee" "cup #42"
lightning-cli decodepay <bolt11>

Never reuse preimages carelessly

Payment hashes must be unique per payment intent. Reuse can create serious security/privacy issues.

Common mistakes

  • Showing expired invoices in UI
  • Ignoring msat precision vs display rounding
  • Forgetting routing hints for private channels

Amountless invoices

Invoices can omit amount, letting the payer choose. Receivers must still validate paid amounts against application expectations (donations vs fixed checkout).

Description hash

Long descriptions can be hashed into the invoice to keep QR codes smaller; the full text is transported out of band. If you use description hashes, ensure the payer UI can fetch and display the preimage text safely.

Expiry UX

Show countdowns. Disable Pay on expiry. When regenerating invoices, rotate payment hashes, never recycle.

Test matrix

Decode fixtures from multiple implementations (LND, CLN, LDK wallets) to ensure your parser accepts real-world BOLT11 quirks.

Worked mental model

Re-read the diagrams in this lesson once out loud in plain language. If you cannot explain the flow to a friend without jargon, pause and revisit Mastering Bitcoin / Mastering Lightning chapters linked in Resources. Chapter references are intentional, not decorative.

Hands-on habit

Every protocol idea should be paired with one local experiment:

  1. Reproduce the happy path on regtest (or Polar for Lightning)
  2. Break it on purpose (wrong fee, expired invoice, offline peer)
  3. Write down what error you saw and which layer produced it (wallet, node, mempool, peer)

That habit turns reading into builder instinct.

Glossary check

Pick three terms from this lesson and define them in one sentence each without opening notes. Weak definitions mean the lesson is not finished yet.

Resource order

Use Resources in order: narrative book chapter first, then BIP/BOLT for precision, then implementation docs for commands. Jumping straight to RPC flags without the mental model creates brittle knowledge.

Next steps

BOLT12 offers improve reusable payment UX beyond one-shot invoices.

further reading

  • bookMastering the Lightning Network

    Ch. 15: Payment Requests

  • toolPolar

progress // sign in

Reading is public. Sign in to mark lessons complete, sync across devices, and unlock your roadmap.

./sign-in-to-track
prevBOLTs & Spec LandscapenextBOLT12 Offers

On this page

Press Shift + ? for keyboard shortcuts.

Press R to research on Bitcoin Search.