Feedback
Sign in./start

Site navigation

Theme

Learn

  • Roadmaps

Build

  • Projects
  • Developer Tools

Contribute

  • Open Source Projects
  • Issues
  • Reviews
  • First Contribution
  • BountiesSoon
  • Feedback

Prove

  • Builders

Ecosystem

  • Partners
  • Get Funded↗
  • HackathonsSoon
Sign in./start-building

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

Feedback welcome — open a GitHub issue.

Learn

RoadmapsStart Building

Build

ProjectsDeveloper Tools

Contribute

Open Source ProjectsIssuesReviewsFirst ContributionSupportFeedback

Prove

Builders Directory

Account

Sign in

Legal

PrivacyTermsCredits

© 2026 Pull // code MIT · curriculum CC BY-SA 4.0

PrivacyTermsCredits

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. Start with Step 1 (required reading) when present, then follow the numbered steps in the article. Depth comes from primary sources, labs, reflection, and evidence.

Research on Bitcoin Search
BOLT11Lightning invoice

Step 1 // Required reading

Complete these before the numbered steps in the lesson body. Links are listed here once — not repeated below.

  • 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 // Create + decode invoice

Complete Steps 2–3. On Polar/CLN/LND lab, create an invoice, decode it, and identify hash, amount, and expiry fields.

evidence required

  • ·Create + decode command/UI output (or screenshots)
  • ·Labeled fields: payment hash (or secret), amount, expiry
  • ·Link to BOLT11 section you used
  1. 01

    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 the Mastering Bitcoin / Mastering Lightning chapters linked in Resources. Chapter references are intentional, not decorative.

  2. 02

    Hands-on habit

    Every protocol idea should be paired with one local experiment. That habit turns reading into builder instinct.

    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)
  3. 03

    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.

  4. 04

    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.

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.

Complete Step 1 // Required reading in the study plan above, then continue here.

Step 2 — Core idea: fields, expiry, uniqueness

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

Analogy: 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.

Invoices can omit amount (payer chooses) — receivers must still validate paid amounts against app expectations. Long descriptions can be hashed into the invoice to keep QRs small; full text travels out of band.

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

Never reuse preimages carelessly

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

Done when: You can list the fields a payer UI must show before Pay is enabled.

Step 3 — Try it: create + decode (lab)

# CLN example (Polar or local)
lightning-cli invoice 10000 "coffee" "cup #42"
lightning-cli decodepay <bolt11>

Label hash, amount, and expiry in the decode output. Prefer Polar if you are not running a node yet.

Common mistakes

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

Done when: Lab evidence (create/decode + labeled fields + BOLT11 link) is complete.

Next lesson

BOLT12 Offers — reusable payment UX beyond one-shot invoices.

further reading

  • bookMastering the Lightning Network

    Ch. 15: Payment Requests

  • toolPolar

review // club

Review club

Practice on real Lightning OSS changes tied to this chapter. Read the diff, use the checklist, and optionally paste your review comment URL in your lab notes.

  • BOLT11 invoice format

    Walk through BOLT11 fields and decode a testnet invoice with your wallet or a CLI tool.

    spec review
    payment hashrouting hintsexpiry
    40 min·intermediateopen on GitHub
review checklist
  1. Does the change solve the stated problem?
  2. Are edge cases and rollout behavior covered?
  3. Are tests or test vectors included?
  4. Is the diff minimal and clearly explained?

More repos and GFIs on /discover and /issues.

progress // sign in

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

./sign-in-to-track

discussion

Discussion

prevBOLTs & Spec LandscapenextBOLT12 Offers

On this page

Press Shift + ? for keyboard shortcuts.

Press R to research on Bitcoin Search.

No questions yet — be the first to ask.