简介
通过 LNbits 管理比特币闪电网络钱包,支持查余额、收发票、扫码支付,内置多重安全确认机制。
原始描述
Manage LNbits Lightning Wallet (Balance, Pay, Invoice)
中文使用说明 来自收录源
LNbits Wallet Manager 评估
核心用法
LNbits 技能使 AI 助手能够安全地管理基于 LNbits 平台的比特币闪电网络钱包。核心功能包括四大部分:
- 钱包创建与配置:可通过 CLI 创建新钱包并获取
adminkey和base_url,需用户手动配置到环境变量(LNBITS_API_KEY、LNBITS_BASE_URL) - 余额查询:实时查看钱包 Satoshis 余额
- 收款(创建发票):生成 Bolt11 标准发票,支持自定义金额和备注,强制输出二维码图片便于扫码支付
- 付款(支付发票):通过解码发票验证金额后执行支付,必须经过用户确认
显著优点
- 安全设计完善:多重防护机制——密钥永不暴露、支付前强制确认、先查余额后支付
- 用户体验优化:自动生成二维码(
MEDIA:格式输出),支持复制粘贴发票文本 - ** Lightning Network 原生**:基于 Bolt11 协议,兼容所有闪电网络钱包
- 开源可审计:LNbits 本身是开源项目,CLI 脚本透明可审查
- 灵活部署:支持自建服务器或 demo 服务器,用户掌握私钥
潜在缺点与局限性
- 依赖外部服务:LNbits 服务器若宕机或被封,功能完全失效
- 链下风险:闪电网络为 Layer 2 方案,需在线节点,存在通道流动性风险
- 密钥管理责任:
adminkey泄露等于钱包完全失控,用户需自行保管 - 汇率波动:以 Satoshis 计价,法币价值实时变动
- 网络要求:必须能访问 LNbits 实例,Tor/I2P 环境可能受限
适合人群
- 闪电网络日常用户(小额高频支付场景)
- 接受比特币支付的商家/创作者
- 技术用户希望自建托管钱包
- 加密货币爱好者探索 Layer 2 应用
常规风险
| 风险类型 | 说明 | 缓解措施 |
|---|---|---|
| 密钥泄露 | adminkey 被截获导致资金被盗 |
技能强制不重复密钥,用户需安全存储 |
| 误操作支付 | 确认后发送至错误地址 | 解码预览金额+强制确认流程 |
| 服务器劫持 | LNbits 实例被恶意控制 | 建议自建节点或使用可信实例 |
| 发票欺诈 | 恶意发票伪装金额 | 解码验证环节显示真实金额 |
| 流动性不足 | 通道余额不足导致支付失败 | 支付前自动检查余额 |
技能正文
name: lnbits description: Manage LNbits Lightning Wallet (Balance, Pay, Invoice) homepage: https://lnbits.com metadata: {"clawdbot":{"emoji":"⚡","requires":{"bins":["python3"],"pip":["qrcode[pil]"],"env":["LNBITS_API_KEY", "LNBITS_BASE_URL"]},"primaryEnv":"LNBITS_API_KEY"}}
LNbits Wallet Manager
Enable the assistant to safely and effectively manage an LNbits Lightning Network wallet.
🛑 CRITICAL PROTOCOLS 🛑
- NEVER Expose Secrets: Do NOT display Admin Keys, User IDs, or Wallet IDs.
- Explicit Confirmation: You MUST ask for "Yes/No" confirmation before paying.
- Format: "I am about to send [Amount] sats to [Memo/Dest]. Proceed? (y/n)"
- Check Balance First: Always call
balancebeforepayto prevent errors. - ALWAYS Include Invoice + QR: When generating an invoice, you MUST: (a) show the
payment_requesttext for copying, and (b) outputMEDIA:followed by theqr_filepath on ONE line. NEVER skip this.
Usage
0. Setup / Create Wallet
If the user does not have an LNbits wallet, you can create one for them on the demo server.
python3 {baseDir}/scripts/lnbits_cli.py create --name "My Wallet"
Action:
- Run the command. The CLI prints JSON containing
adminkeyandbase_urlto stdout (visible in the terminal). - NEVER Expose Secrets (applies here): Do NOT repeat, quote, or display the
adminkeyor any secret from the output in your chat response. The user sees the command output in their terminal; that is the only place the key should appear. - Instruct the user in plain language only, e.g.:
"A new wallet was created. The command output above contains your adminkey and base_url. Copy those values from the terminal and add them to your configuration or
.envasLNBITS_API_KEYandLNBITS_BASE_URL. Do not paste the adminkey here or in any chat."
1. Check Balance
Get the current wallet balance in Satoshis.
python3 {baseDir}/scripts/lnbits_cli.py balance
2. Create Invoice (Receive)
Generate a Bolt11 invoice to receive funds. QR code is always included by default.
- amount: Amount in Satoshis (Integer).
- memo: Optional description.
- --no-qr: Skip QR code generation (if not needed).
# Invoice with QR code (default)
python3 {baseDir}/scripts/lnbits_cli.py invoice --amount 1000 --memo "Pizza"
# Invoice without QR code
python3 {baseDir}/scripts/lnbits_cli.py invoice --amount 1000 --memo "Pizza" --no-qr
⚠️ MANDATORY RESPONSE FORMAT: When generating an invoice, your response MUST include:
- Invoice text for copying: Show the full
payment_requeststring so user can copy it - QR code image: Output
MEDIA:followed by theqr_filepath on ONE line
EXACT FORMAT (follow precisely):
Here is your 100 sat invoice:
lnbc1u1p5abc123...
MEDIA:./clawd/.lnbits_qr/invoice_xxx.png
CRITICAL: The MEDIA: and file path MUST be on the SAME LINE. This sends the QR code image to the user.
2b. Generate QR Code from Existing Invoice
Convert any Bolt11 string to a QR code image file.
python3 {baseDir}/scripts/lnbits_cli.py qr <bolt11_string>
Returns: {"qr_file": "./.lnbits_qr/invoice_xxx.png", "bolt11": "..."}
3. Pay Invoice (Send)
⚠️ REQUIRES CONFIRMATION: Decode first, verify balance, ask user, then execute.
# Step 1: Decode to verify amount/memo
python3 {baseDir}/scripts/lnbits_cli.py decode <bolt11_string>
# Step 2: Pay (Only after user CONFIRMS)
python3 {baseDir}/scripts/lnbits_cli.py pay <bolt11_string>
Error Handling
If the CLI returns a JSON error (e.g., {"error": "Insufficient funds"}), summarize it clearly for the user. Do not show raw stack traces.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。
其他来源收录
同一技能在不同目录的原始页面: