| name | bitcoin-lightning |
| description | Bitcoin and Lightning Network protocol knowledge for agents with wallet access. Use when: agent needs to send/receive lightning payments, check balances, create invoices, understand BOLT-11, convert between sats/BTC, evaluate fees, or decide which payment tool to use (NWC vs Cashu vs zaps). NOT for: on-chain Bitcoin transactions, mining, or running a node (see lnd-node-ops and bos-node-ops skills). |
| when_to_use | Use when handling any lightning payment, invoice, balance check, or when the user asks about Bitcoin/Lightning protocol details. |
| metadata | {"openclaw":{"emoji":"โก"}} |
Bitcoin & Lightning Network
Protocol knowledge for agents interacting with the Lightning Network.
When to Use
โ
USE this skill when:
- Sending or receiving lightning payments
- Creating or paying BOLT-11 invoices
- Checking wallet balance
- Converting between sats, millisats, and BTC
- Explaining lightning to a user
- Deciding which payment tool to use
- Evaluating fee costs and payment feasibility
โ DON'T use this skill when:
- Managing a lightning node (channels, peers, routing) โ use lnd-node-ops or bos-node-ops
- LNbits server administration โ use lnbits-admin
- On-chain Bitcoin transactions (L1) โ currently unsupported
- Mining, consensus, or blockchain analysis
Units & Conversions
| Unit | Value | Use case |
|---|
| 1 BTC | 100,000,000 sats | Display / large amounts |
| 1 sat | 1,000 msats | Common user-facing unit |
| 1 msat (millisatoshi) | smallest LN unit | Protocol / NWC amounts |
Critical: NWC tools work in millisatoshis (msats). Always convert:
- User says "100 sats" โ
amount_msats: 100000
- User says "0.001 BTC" โ
amount_msats: 100000000
- Balance returned as
50000000 msats โ tell user "50,000 sats (0.0005 BTC)"
Always present amounts to users in sats unless they specifically ask for BTC or msats.
BOLT-11 Invoice Anatomy
A BOLT-11 invoice looks like: lnbc10u1p...
| Prefix | Meaning |
|---|
lnbc | Bitcoin mainnet |
lntb | Bitcoin testnet |
lnbcrt | Bitcoin regtest |
The amount follows the prefix:
lnbc10u โ 10 ยตBTC = 1,000 sats
lnbc1m โ 1 mBTC = 100,000 sats
lnbc100n โ 100 nBTC = 10 sats
- No amount โ zero-amount (payer chooses)
Key fields encoded in an invoice:
- Payment hash (unique identifier)
- Destination node pubkey
- Amount (optional)
- Description or description hash
- Expiry (default: 3600 seconds / 1 hour)
- Route hints (for private channels)
Payment Tool Decision Tree
User wants to pay/receive lightning?
โ
โโ Agent has NWC configured (nwc_* tools available)?
โ โโ YES โ Use NWC tools (preferred)
โ โ โโ Check balance: nwc_get_balance
โ โ โโ Pay invoice: nwc_pay_invoice
โ โ โโ Create invoice: nwc_make_invoice
โ โ โโ Check payment: nwc_lookup_invoice
โ โ โโ History: nwc_list_transactions
โ โโ NO โ Fall through
โ
โโ Agent has Cashu tools (cashu_* tools available)?
โ โโ YES โ Use Cashu for ecash operations
โ โ โโ Good for: small tips, micropayments, offline tokens
โ โ โโ Cashu tokens are bearer instruments (like cash)
โ โ โโ Requires a mint (trust the mint operator)
โ โโ NO โ Fall through
โ
โโ User wants to zap a nostr event/profile?
โ โโ YES โ Use nostr_zap_send (NIP-57)
โ โโ Requires: recipient pubkey + lud16 lightning address
โ โโ Zaps are public (visible on nostr)
โ โโ Good for: tipping content creators, social payments
โ
โโ No payment tools available
โโ Inform user: "I don't have wallet access configured.
Ask the operator to set extra.nwc.uri in my config."
NWC Quick Reference
Config: Set extra.nwc.uri in agent config:
nostrwalletconnect://<wallet_pubkey>?relay=wss://relay.example&secret=<hex_privkey>
Supported wallets: Alby, Mutiny, LNbits (NWC extension), any NIP-47 wallet.
Available tools:
| Tool | Purpose | Key params |
|---|
nwc_get_balance | Check balance | (none) |
nwc_pay_invoice | Pay a BOLT-11 invoice | invoice (required), amount_msats (for zero-amt) |
nwc_make_invoice | Create an invoice | amount_msats (required), description, expiry |
nwc_lookup_invoice | Check payment status | payment_hash or invoice |
nwc_list_transactions | Recent payment history | from, until, limit, type |
Fee Awareness
Lightning payments have routing fees. Guidelines:
- Small payments (<1000 sats): fees are typically 0-2 sats
- Medium payments (1K-100K sats): fees are typically 1-50 sats
- Large payments (>100K sats): fees can be 50-500+ sats
- Failed routes: no fee charged โ the protocol retries automatically
When discussing fees with users:
- Don't promise exact fee amounts (they vary by route)
- For amounts >10,000 sats, mention that fees will apply
- If a payment fails, it's usually a routing issue, not a fee issue
Security Guardrails
โ ๏ธ NEVER do these:
- Pay an invoice without user confirmation for amounts > 1,000 sats
- Share the NWC connection URI or secret key
- Create invoices for amounts the user didn't request
- Assume a payment succeeded without checking the result
โ
ALWAYS do these:
- Confirm the amount before paying (especially zero-amount invoices)
- Show the user the amount in sats, not just msats
- Check
nwc_lookup_invoice to verify payment status when uncertain
- Report both success AND the preimage/payment_hash for receipts
Common Scenarios
"Send 1000 sats to this invoice"
- Parse the invoice to understand the amount
- Confirm: "This invoice is for 1,000 sats (~$X). Proceed?"
nwc_pay_invoice with the BOLT-11 string
- Report: "Paid โ โ preimage: abc123..."
"Create an invoice for 5000 sats"
- Convert: 5,000 sats = 5,000,000 msats
nwc_make_invoice with amount_msats: 5000000
- Return the BOLT-11 string and payment hash
"What's my balance?"
nwc_get_balance
- Convert msats โ sats
- Report: "Your balance is 150,000 sats (0.0015 BTC)"
"Check if invoice XYZ was paid"
nwc_lookup_invoice with the payment_hash or invoice string
- Report settled/pending/expired status
Glossary
| Term | Meaning |
|---|
| BOLT | Basis of Lightning Technology โ the Lightning spec documents |
| Channel | A payment path between two Lightning nodes |
| HTLC | Hash Time-Locked Contract โ the mechanism that makes LN payments atomic |
| Invoice | A BOLT-11 encoded payment request |
| Keysend | Spontaneous payment without an invoice |
| LNURL | HTTP-based Lightning protocol extensions (pay, withdraw, auth) |
| Preimage | The secret revealed when a payment succeeds (proof of payment) |
| Payment hash | SHA256 of the preimage โ identifies a payment |
| Route | Path of channels a payment traverses from sender to receiver |
| Sats | Satoshis โ 1/100,000,000 of a Bitcoin |
| Zap | A nostr-native Lightning tip (NIP-57) |
| NWC | Nostr Wallet Connect (NIP-47) โ wallet access via nostr events |