Skip to content

Add Lightning Network BOLT11 invoice parser#9

Draft
Claude wants to merge 5 commits intocodex/setup-openclaw-project-structure-and-codefrom
claude/search-ethereum-addresses
Draft

Add Lightning Network BOLT11 invoice parser#9
Claude wants to merge 5 commits intocodex/setup-openclaw-project-structure-and-codefrom
claude/search-ethereum-addresses

Conversation

@Claude
Copy link
Copy Markdown

@Claude Claude AI commented Feb 5, 2026

Implements BOLT11 invoice parsing in response to a Lightning Network payment request (lnbc13863u1... for 1,386,300 sats).

Changes

Core Implementation

  • src/infra/lightning-invoice.ts: Parser supporting mainnet, testnet, regtest, and simnet networks
    • Extracts amounts in all denominations (pico, nano, micro, milli, BTC)
    • Converts to satoshis and BTC with formatted output
    • Type-safe validation with detailed error messages

Testing

  • src/infra/lightning-invoice.test.ts: 30+ test cases covering:
    • All network types and denominations
    • Amount calculations and edge cases
    • Format validation and error handling
    • Problem statement invoice verification

Documentation

  • docs/lightning-network.md: API reference, usage examples, security considerations
  • CRYPTO_AUDIT_REPORT.md: Updated with Lightning findings, noting existing LUD-16 support in Nostr extension

Usage

import { parseLightningInvoice, formatSatoshis } from "./infra/lightning-invoice";

const invoice = "lnbc13863u1p5c2f7n...";
const parsed = parseLightningInvoice(invoice);

console.log(parsed.network);         // "mainnet"
console.log(parsed.amountSatoshis);  // 1386300
console.log(parsed.amountBTC);       // 0.013863
console.log(formatSatoshis(1386300)); // "0.01386300 BTC"

Limitations

Parser validates structure and extracts amounts but does not verify:

  • Cryptographic signatures
  • Payment hash checksums
  • Expiry timestamps

These remain future enhancements for full BOLT11 compliance.

Original prompt

rg -n "escrow|reward|bounty|distributor|merkle|claim|withdraw|payout|vault|treasury" .
rg -o "0x[a-fA-F0-9]{40}" -n . | head -n 200

Comprehensive search for crypto-related code and Ethereum addresses.
Results: No blockchain integration detected in codebase.

Co-authored-by: EvezArt <129563238+EvezArt@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Add regex search for Ethereum addresses docs: add cryptocurrency and blockchain audit report Feb 5, 2026
@Claude Claude AI requested a review from EvezArt February 5, 2026 19:23
Claude AI and others added 3 commits February 5, 2026 23:39
- Add parser utility to decode Lightning invoices
- Support mainnet, testnet, regtest, and simnet networks
- Parse amounts in various denominations (pico, nano, micro, milli, BTC)
- Add comprehensive test suite with 30+ test cases
- Update crypto audit report with Lightning findings

Co-authored-by: EvezArt <129563238+EvezArt@users.noreply.github.com>
Complete documentation covering:
- Lightning address support (LUD-16)
- BOLT11 invoice parser API reference
- Invoice format and structure
- Security considerations
- Testing instructions
- Future enhancement suggestions

Co-authored-by: EvezArt <129563238+EvezArt@users.noreply.github.com>
Complete summary of the BOLT11 invoice parser implementation including problem analysis, features, testing, and future enhancements.

Co-authored-by: EvezArt <129563238+EvezArt@users.noreply.github.com>
@Claude Claude AI changed the title docs: add cryptocurrency and blockchain audit report Add Lightning Network BOLT11 invoice parser Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants