详细分析 ▾
运行时依赖
版本
Fix: request preImage for intra-ledger settlements in l402_pay. L402 now works when both payer and payee use Blink wallets.
安装命令 点击复制
技能文档
Bitcoin Lightning wallet operations via the Blink API. Enables agents to check balances, receive payments via invoices, send payments over Lightning, track transactions, monitor prices, and automatically pay for L402-gated web services.
什么 Blink?
Blink is a custodial Bitcoin Lightning wallet with a GraphQL API. Key concepts:
- API 键 — authentication 令牌 (格式:
blink_...) 带有 scoped permissions (读取, 接收, 写入) - BTC Wallet — balance denominated 在...中 satoshis
- USD Wallet — balance denominated 在...中 cents (stablecoin pegged 到 USD)
- Lightning Invoice — BOLT-11 payment 请求 字符串 (
lnbc...) used 到 接收 payments - Lightning Address — human-readable address (
用户@domain) 对于 sending payments 没有 invoice - LNURL — protocol 对于 interacting 带有 Lightning services 通过 encoded URLs
- L402 — HTTP payment protocol (RFC draft) gates resources 后面 Lightning invoice. Servers return HTTP 402 带有 macaroon + invoice; clients pay 和 重试 带有 令牌.
Environment
- Requires
bash和 节点.js 18+. - Requires
BLINK_API_KEYenvironment 变量 带有 appropriate scopes. - 对于 WebSocket subscriptions: 节点 22+ (native) 或 节点 20+ 带有
--experimental-websocket. - Zero runtime npm dependencies. 仅 节点.js built-在...中 modules used (
节点:util,节点:fs,节点:path,节点:child_process).
Use this skill for concrete wallet operations, not generic Lightning theory.
Getting Started
1. 获取 API 键
- 创建 free 账户 在 dashboard.blink.sv.
- Go 到 API Keys 和 创建 键 带有 scopes 您 需要.
- 设置 在...中 environment:
export BLINK_API_KEY="blink_..."
API 键 Scopes:
- 读取 — 查询 balances, 事务 history, price, 账户 info
- 接收 — 创建 invoices
- 写入 — 发送 payments (使用 带有 caution)
Tip: Start with Read + Receive only. Add Write when you need to send payments.
2. 验证 works
node {baseDir}/scripts/balance.js
If you see JSON with your wallet balances, you're ready.
3. Staging / Testnet (recommended 对于 第一个-时间 setup)
To use the Blink staging environment (signet) instead of real money:
export BLINK_API_URL="https://api.staging.blink.sv/graphql"
Create a staging API key at dashboard.staging.blink.sv. The staging environment uses signet bitcoin (no real value) — perfect for testing payment flows safely.
If BLINK_API_URL is not set, production (https://api.blink.sv/graphql) is used by default.
API 键 auto-detection
Scripts automatically resolve BLINK_API_KEY using this order:
process.env.BLINK_API_KEY(checked 第一个)- Shell rc files:
~/.个人资料,~/.bashrc,~/.bash_profile,~/.zshrc— scanned 对于导出 BLINK_API_KEY=...line 仅
No source ~/.profile prefix is needed. The rc file scan uses a targeted regex that reads only the BLINK_API_KEY export line — no other data is extracted from these files.
可选: CLI wrapper (满 GitHub repo 仅)
If you have cloned the full GitHub repo, you can optionally install a blink CLI command:
npm install # install dev dependencies (eslint, prettier)
npm link # creates global 'blink' command
blink --help # verify
Note:npm linkmodifies global npm state. This is optional — all functionality is available by running scripts directly withnode {baseDir}/scripts/