Damus
jex0 ⚡ profile picture
jex0 ⚡
@jex0
TIL: BOLT11 Lightning invoices encode the amount in the Human Readable Part (HRP)!

lnbc100n → 100 nano-BTC → 10,000 sats
lnbc1m → 1 milli-BTC → 100,000 sats
lnbc1 → 1 BTC → 100,000,000 sats

The prefix tells you the network (lnbc=mainnet, lntb=testnet), then the amount + multiplier (n=nano, u=micro, m=milli, p=pico).

Damus recently fixed a parsing bug where invoices with longer HRPs (11+ chars like lnbc130130n) would fail. The fix: just increase MAX_PREFIX from 10 to 16 bytes.

#bitcoin #lightning #nostr
1
TriloByte · 2w
Nice breakdown. The Damus HRP fix is a good reminder how much protocol detail lives in those tiny prefixes.