Lightning Address Zapping - Send to Lightning Addresses ([email protected])
Payment History - Track all Lightning transactions
Balance Checking - Query wallet balance
DID Integration - Publish Lightning endpoint to DID document
Invoice Decoding - Inspect BOLT11 invoice details
Prerequisites
Node.js installed (for npx @didcid/keymaster)
Archon identity configured (~/.archon.env with ARCHON_WALLET_PATH, ARCHON_PASSPHRASE)
jq recommended for JSON parsing
All created by archon-keymaster setup. If you don't have Archon configured yet, see the archon-keymaster skill first.
Security Notes
This skill handles Lightning Network payments:
Non-custodial: You control your Lightning node and private keys
Payment verification is built-in: lightning-pay.sh automatically verifies payments; if using keymaster directly, you must verify manually with (see Payment Verification Pattern below)
lightning-check
Environment access: Scripts source ~/.archon.env for wallet access
Network connectivity: Connects to Lightning Network via Archon gatekeeper
Quick Start
Create Lightning Wallet
./scripts/lightning/add-lightning.sh [id]
Creates a Lightning wallet for your current DID (or specified DID alias).
Examples:
./scripts/lightning/add-lightning.sh # Current DID
./scripts/lightning/add-lightning.sh work # Specific DID alias
# Zap to Lightning Address
./scripts/lightning/lightning-zap.sh [email protected] 1000 "Great post!"
# Zap to DID
./scripts/lightning/lightning-zap.sh did:cid:bagaaiera... 5000
# Zap to alias
./scripts/lightning/lightning-zap.sh alice 2000 "Coffee"
Output: Success or failure message with exit code
Example:
./scripts/lightning/lightning-zap.sh [email protected] 1000 "Great post!"
# ✅ Payment confirmed
# (exits 0 on success, 1 on failure)
The script automatically verifies the payment settled before outputting success.
# Alice creates invoice
INVOICE=$(./scripts/lightning/lightning-invoice.sh 1000 "Coffee")
echo "Invoice: $INVOICE"
# Bob pays invoice
RESULT=$(./scripts/lightning/lightning-pay.sh "$INVOICE")
HASH=$(echo "$RESULT" | jq -r .paymentHash)
# Bob verifies payment
STATUS=$(./scripts/lightning/lightning-check.sh "$HASH" | jq -r .paid)
if [ "$STATUS" = "true" ]; then
echo "✅ Payment confirmed!"
fi
# Alice checks balance
./scripts/lightning/lightning-balance.sh
Example 2: Lightning Address Zap
# Zap creator via Lightning Address
./scripts/lightning/lightning-zap.sh [email protected] 5000 "Love your content!"
# ✅ Payment confirmed
# Payment verification is automatic - no manual checking needed
Example 3: Invoice Verification
# Receive a BOLT11 invoice from someone
INVOICE="lnbc10u1p..."
# Decode to verify amount and recipient
./scripts/lightning/lightning-decode.sh "$INVOICE"
# Check amount, description, expiry
# If looks good, pay it
RESULT=$(./scripts/lightning/lightning-pay.sh "$INVOICE")
HASH=$(echo "$RESULT" | jq -r .paymentHash)
# CRITICAL: Verify payment settled
./scripts/lightning/lightning-check.sh "$HASH"
Example 4: Multi-DID Wallet Management
# Create wallets for different personas
./scripts/lightning/add-lightning.sh personal
./scripts/lightning/add-lightning.sh work
./scripts/lightning/add-lightning.sh project
# Check balances
./scripts/lightning/lightning-balance.sh personal
./scripts/lightning/lightning-balance.sh work
./scripts/lightning/lightning-balance.sh project
# Pay from specific wallet
./scripts/lightning/lightning-pay.sh lnbc10u1p... work
Example 5: Publishing Lightning to DID
# Create Lightning wallet
./scripts/lightning/add-lightning.sh
# Publish to DID document
./scripts/lightning/publish-lightning.sh
# Others can now discover your Lightning endpoint
# They look up your DID and see your Lightning service
# Later, if you want to unpublish:
./scripts/lightning/unpublish-lightning.sh
Example 6: Sending Invoice via Dmail
# Alice creates an invoice for 5000 sats
INVOICE_JSON=$(npx @didcid/keymaster lightning-invoice 5000 "Consulting fee")
INVOICE=$(echo "$INVOICE_JSON" | jq -r .paymentRequest)
# Alice sends the invoice to Bob via dmail
npx @didcid/keymaster send-dmail \
"did:cid:bob..." \
"Invoice for consulting work" \
"Please pay this invoice: $INVOICE"
# Bob receives the dmail, extracts the invoice, and pays
npx @didcid/keymaster lightning-pay "$INVOICE"
# ✅ Payment confirmed
# Alice checks her payment history
npx @didcid/keymaster lightning-payments
# Shows the received payment
Why this matters: Agents can request payment without needing email, phone numbers, or centralized messaging platforms. Just DIDs + Lightning + dmail.
Environment Setup
All scripts require:
source ~/.archon.env # Load wallet path and passphrase
This is automatically sourced by the wrapper scripts. npx is used to run keymaster, so no nvm sourcing is needed.