简介
由 Lightning Labs CTO 打造的端到端支付栈,支持 AI Agent 通过 L402 协议实现比特币微支付与数据交易,构建自主商业闭环。
原始描述
End-to-end agentic commerce workflow using Lightning Network. Use when an agent needs to set up a full payment stack (lnd + lnget + aperture), buy or sell data via L402, or enable agent-to-agent micropayments.
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
中文使用说明 来自收录源
核心用法
本技能是一套端到端的 Lightning Network 商务工作流指南,而非可执行代码。它指导 AI Agent 搭建完整的支付基础设施:
- 运行 Lightning 节点:通过 litd(Lightning Terminal)启动 LND + Loop + Pool + Taproot Assets 的集成节点
- 购买数据服务:使用 lnget 客户端自动处理 L402 协议的付费资源获取(HTTP 402 Payment Required + 发票支付)
- 出售数据服务:部署 Aperture 反向代理,将任何 HTTP 后端转换为按次付费的 API
典型工作流:安装三组件 → 创建加密钱包 → 充值并开通支付通道 → 配置 lnget → 开始买卖数据。
显著优点
- T1 顶级可信来源:维护者 roasbeef(Olaoluwa Osuntokun)是 Lightning Labs 联合创始人兼 CTO,Bitcoin Core 和 Lightning Network 协议核心贡献者
- 零代码风险:纯 Markdown 文档,无可执行代码,无依赖,无动态行为
- 标准化协议:基于 L402(Lightning HTTP 402)开放标准,非专有方案
- Agent 原生设计:lnget 工具支持自动发票支付和令牌缓存,适合无人值守的自动化场景
- 微支付优化:Lightning Network 的即时结算和低手续费特性,适合 AI Agent 高频小额交易
潜在缺点与局限
- 仅文档无实现:实际网络操作依赖独立的子技能(lnd、lnget、aperture),本技能本身不执行任何功能
- 资金风险:涉及真实比特币操作,配置错误可能导致资金损失(如助记词泄露、通道管理不当)
- 运维复杂度:需要维护在线 Lightning 节点、通道流动性、链上手续费监控
- 流动性依赖:买卖双方需预先建立支付通道,冷启动阶段需要资本投入
- 测试网/主网混淆风险:文档默认 testnet,但用户可能误用于 mainnet 造成损失
适合人群
- 需要为 AI Agent 构建自主支付能力的开发者
- 探索 Agent-to-Agent 经济 的研究者和协议设计师
- 已熟悉 Bitcoin/Lightning 生态,希望将其集成到自动化工作流的技术用户
常规风险
| 风险类型 | 说明 |
|---|---|
| 资金安全风险 | 钱包助记词和密码以 0600 权限存储于 ~/.lnget/lnd/,主机被入侵可能导致盗币 |
| 配置错误风险 | 占位符(your-host:8081)未替换可能导致服务暴露或支付失败 |
| 流动性风险 | 通道余额不足或对手方离线会导致支付失败 |
| 主网误用风险 | 文档示例使用 testnet,但工具支持 mainnet,缺乏显眼的网络切换警告 |
认证结论
CLS-Certify 评分 100/100,S 级,所有检测维度通过。纯文档性质消除了代码层面的威胁向量,但用户按指南操作时的资金安全管理责任重大。建议生产环境结合 lightning-security-module 技能的远程签名方案使用。
技能正文
name: commerce description: End-to-end agentic commerce workflow using Lightning Network. Use when an agent needs to set up a full payment stack (lnd + lnget + aperture), buy or sell data via L402, or enable agent-to-agent micropayments. user-invocable: false
Agentic Commerce Toolkit
This plugin provides a complete toolkit for agent-driven Lightning Network commerce. Three skills work together to enable agents to send and receive micropayments over the Lightning Network using the L402 protocol.
Components
| Skill | Purpose |
|---|---|
| lnd | Run Lightning Terminal (litd: lnd + loop + pool + tapd) |
| lnget | Fetch L402-protected resources (pay for data) |
| aperture | Host paid API endpoints (sell data) |
Full Setup Workflow
Step 1: Install All Components
# Install litd (Lightning Terminal — bundles lnd + loop + pool + tapd)
skills/lnd/scripts/install.sh
# Install lnget (Lightning HTTP client)
skills/lnget/scripts/install.sh
# Install aperture (L402 reverse proxy)
skills/aperture/scripts/install.sh
Step 2: Set Up the Lightning Node
# Start litd container (testnet by default)
skills/lnd/scripts/start-lnd.sh
# Create an encrypted wallet
skills/lnd/scripts/create-wallet.sh --mode standalone
# Verify node is running
skills/lnd/scripts/lncli.sh getinfo
Step 3: Fund the Wallet
# Generate a Bitcoin address
skills/lnd/scripts/lncli.sh newaddress p2tr
# Send BTC to this address from an exchange or another wallet
# Verify balance
skills/lnd/scripts/lncli.sh walletbalance
Step 4: Open a Channel
# Connect to a well-connected node (e.g., ACINQ, Bitfinex)
skills/lnd/scripts/lncli.sh connect <pubkey>@<host>:9735
# Open a channel
skills/lnd/scripts/lncli.sh openchannel --node_key=<pubkey> --local_amt=1000000
# Wait for channel to confirm (6 blocks)
skills/lnd/scripts/lncli.sh listchannels
Step 5: Configure lnget
# Initialize lnget config (auto-detects local lnd)
lnget config init
# Verify connection
lnget ln status
Step 6: Fetch Paid Resources
# Fetch an L402-protected resource
lnget --max-cost 1000 https://api.example.com/paid-data
# Preview without paying
lnget --no-pay https://api.example.com/paid-data
# Check cached tokens
lnget tokens list
Step 7: Host Paid Endpoints (Optional)
# Start your backend service
python3 -m http.server 8080 &
# Configure aperture to protect it
skills/aperture/scripts/setup.sh --insecure --port 8081
# Start the L402 paywall
skills/aperture/scripts/start.sh
# Other agents can now pay to access your endpoints
# lnget --max-cost 100 https://your-host:8081/api/data
Agent-to-Agent Commerce
The full loop for autonomous agent commerce:
Agent A (buyer) Agent B (seller)
───────────── ─────────────
lnd node running lnd node running
↓ ↓
lnget fetches URL ──────────────→ aperture receives request
↓
Returns 402 + invoice
↓
lnget pays invoice ─────────────→ lnd receives payment
↓ ↓
lnget retries with token ───────→ aperture validates token
↓
Proxies to backend
↓ ↓
Agent A receives data ←────────── Backend returns data
Buyer Agent Setup
# One-time setup
skills/lnd/scripts/install.sh
skills/lnget/scripts/install.sh
skills/lnd/scripts/start-lnd.sh
skills/lnd/scripts/create-wallet.sh --mode standalone
lnget config init
# Fund wallet and open channels (one-time)
skills/lnd/scripts/lncli.sh newaddress p2tr
# ... send BTC ...
skills/lnd/scripts/lncli.sh openchannel --node_key=<pubkey> --local_amt=500000
# Ongoing: fetch paid resources
lnget --max-cost 100 -q https://seller-api.example.com/api/data | jq .
Seller Agent Setup
# One-time setup
skills/lnd/scripts/install.sh
skills/aperture/scripts/install.sh
skills/lnd/scripts/start-lnd.sh
skills/lnd/scripts/create-wallet.sh --mode standalone
# Configure and start paywall
skills/aperture/scripts/setup.sh --port 8081 --insecure
# Start backend with content to sell
mkdir -p /tmp/api-data
echo '{"market_data": "..."}' > /tmp/api-data/data.json
cd /tmp/api-data && python3 -m http.server 8080 &
# Start aperture
skills/aperture/scripts/start.sh
# Buyers can now access:
# https://your-host:8081/api/data.json (100 sats per request)
Cost Management
Agents should always control spending:
# Set a hard limit per request
lnget --max-cost 500 https://api.example.com/data
# Check cost before paying
lnget --no-pay --json https://api.example.com/data | jq '.invoice_amount_sat'
# Track spending via token list
lnget tokens list --json | jq '[.[] | .amount_paid_sat] | add'
Security Summary
| Component | Security Model |
|---|---|
| Wallet passphrase | Stored at ~/.lnget/lnd/wallet-password.txt (0600) |
| Seed mnemonic | Stored at ~/.lnget/lnd/seed.txt (0600) |
| L402 tokens | Stored at ~/.lnget/tokens/<domain>/ per domain |
| lnd macaroons | Standard lnd paths at ~/.lnd/data/chain/... |
| Aperture DB | SQLite at ~/.aperture/aperture.db |
For production use with significant funds, use watch-only mode with a remote
signer container. See the lightning-security-module skill for details.
Stopping Everything
skills/aperture/scripts/stop.sh
skills/lnd/scripts/stop-lnd.sh
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。