详细分析 ▾
运行时依赖
版本
fix: l402-pay preimage polling (5x retry with 1s delay) + per-path token cache key. Discovered during Citrusrate L402 pilot.
安装命令 点击复制
技能文档
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.
What is Blink?
Blink is a custodial Bitcoin Lightning wallet with a GraphQL API. Key concepts:
- API Key — authentication token (format:
blink_...) with scoped permissions (Read, Receive, Write) - BTC Wallet — balance denominated in satoshis
- USD Wallet — balance denominated in cents (stablecoin pegged to USD)
- Lightning Invoice — BOLT-11 payment request string (
lnbc...) used to receive payments - Lightning Address — human-readable address (
user@domain) for sending payments without an invoice - LNURL — protocol for interacting with Lightning services via encoded URLs
- L402 — HTTP payment protocol (RFC draft) that gates resources behind a Lightning invoice. Servers return HTTP 402 with a macaroon + invoice; clients pay and retry with the token.
Environment
- Requires
bashand Node.js 18+. - Requires
BLINK_API_KEYenvironment variable with appropriate scopes. - For WebSocket subscriptions: Node 22+ (native) or Node 20+ with
--experimental-websocket. - Zero runtime npm dependencies. Only Node.js built-in modules are used (
node:util,node:fs,node:path,node:child_process).
Use this skill for concrete wallet operations, not generic Lightning theory.
Getting Started
1. Get your API key
- Create a free account at dashboard.blink.sv.
- Go to API Keys and create a key with the scopes you need.
- Set it in your environment:
export BLINK_API_KEY="blink_..."
API Key Scopes:
- Read — query balances, transaction history, price, account info
- Receive — create invoices
- Write — send payments (use with caution)
Tip: Start with Read + Receive only. Add Write when you need to send payments.
2. Verify it works
node {baseDir}/scripts/balance.js
If you see JSON with your wallet balances, you're ready.
3. Staging / Testnet (recommended for first-time 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 key auto-detection
Scripts automatically resolve BLINK_API_KEY using this order:
process.env.BLINK_API_KEY(checked first)- Shell rc files:
~/.profile,~/.bashrc,~/.bash_profile,~/.zshrc— scanned for anexport BLINK_API_KEY=...line only
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.
Optional: CLI wrapper (full GitHub repo only)
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/