您的位置:首页 > 手游攻略 > LNbits 钱包管理器:管理闪电网络支付 - Openclaw Skills

LNbits 钱包管理器:管理闪电网络支付 - Openclaw Skills

作者:互联网  时间: 2026-08-08 19:10:01  

什么是 LNbits 钱包管理器?

LNbits 钱包管理器是一个专门设计的技能,旨在弥合 AI 代理与比特币闪电网络之间的差距。通过利用 Openclaw Skills,开发人员可以让其代理具备使用自然语言命令或自动化脚本管理钱包流动性、执行支付和生成发票的能力。该技能优先考虑安全性和透明度,确保敏感的管理密钥永远不会在聊天界面中暴露。

这种集成允许在终端或开发环境中进行无缝的财务交互。无论您是构建自动化微支付系统,还是只需要一种快速查看聪(sats)的方法,此技能都为 LNbits 交互提供了强大的框架。通过利用 Openclaw Skills,您可以从标准化的错误处理和强制性确认工作流中受益,从而防止意外的资金转移。

下载入口:https://github.com/openclaw/skills/tree/main/skills/jamestsetsekas/lnbits-with-qrcode

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install lnbits-with-qrcode

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 <project>/skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 lnbits-with-qrcode。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

LNbits 钱包管理器 应用场景

  • 在验证付款详情后安全地支付 Bolt11 发票。
  • 生成微支付发票,并自动创建二维码用于视觉分享。
  • 监控闪电钱包余额以进行实时流动性管理。
  • 在演示服务器上通过编程方式创建钱包,以便进行快速原型设计和测试。
  • 在继续付款前解码闪电网络发票以检查交易元数据。
LNbits 钱包管理器 工作原理
  1. 代理使用配置的 API 密钥和基础 URL 连接到 LNbits 实例。
  2. 当请求余额检查时,代理会查询账户状态以确保充足的流动性。
  3. 对于发票生成,代理调用 LNbits API 创建 Bolt11 字符串,并同步生成本地二维码图像。
  4. 对于出站支付,代理先解码发票,向用户展示准确的金额和目的地。
  5. 在代理执行最终支付命令之前,会触发强制性的手动确认步骤。
  6. 所有媒体输出(如二维码)都直接链接在响应中,方便用户立即访问。

LNbits 钱包管理器 配置指南

要在 Openclaw Skills 生态系统中使用此技能,请确保您的环境已正确配置:

  1. 安装所需的 Python 依赖项:
pip install qrcode[pil]
  1. 将您的 LNbits 凭据导出为环境变量:
export LNBITS_API_KEY="your_admin_key_here"
export LNBITS_BASE_URL="https://legend.lnbits.com"
  1. 如果您需要创建一个用于测试的新钱包:
python3 scripts/lnbits_cli.py create --name "Agent Wallet"

LNbits 钱包管理器 数据架构与分类体系

该技能通过 API 响应和用于媒体资产的本地文件存储相结合来管理数据。以下是 Openclaw Skills 使用的元数据分类:

属性 描述 数据类型
payment_request 用于闪电网络交易的 Bolt11 字符串。 字符串
qr_file 包含发票二维码的生成的 PNG 文件路径。 文件路径
balance 以聪 (Satoshis) 为单位的当前钱包余额。 整数
memo 交易的可选描述或标签。 字符串
adminkey 敏感的管理密钥(仅通过环境变量处理)。 机密
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 ??

  1. NEVER Expose Secrets: Do NOT display Admin Keys, User IDs, or Wallet IDs.
  2. 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)"
  3. Check Balance First: Always call balance before pay to prevent errors.
  4. ALWAYS Include Invoice + QR: When generating an invoice, you MUST: (a) show the payment_request text for copying, and (b) output MEDIA: followed by the qr_file path 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:

  1. Run the command. The CLI prints JSON containing adminkey and base_url to stdout (visible in the terminal).
  2. NEVER Expose Secrets (applies here): Do NOT repeat, quote, or display the adminkey or 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.
  3. 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 .env as LNBITS_API_KEY and LNBITS_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:

  1. Invoice text for copying: Show the full payment_request string so user can copy it
  2. QR code image: Output MEDIA: followed by the qr_file path 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.

最新游戏

更多

Copyright©2010-2019. All rights reserved | 波波三国游戏官网|[email protected]

备案编号:湘ICP备2022015115号-4