[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75FQF76PHWAJ7EVPZEQTSKH":3,"skill-same:01M75FQF76PHWAJ7EVPZEQTSKH":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M75FQF76PHWAJ7EVPZEQTSKH","sparkbtcbot-proxy-deploy",null,"Deploy a serverless Spark Bitcoin L2 proxy on Vercel with spending limits, auth, and Redis logging. Use when user wants to set up a new proxy, configure env vars, deploy to Vercel, or manage the proxy infrastructure.","javimosch\u002Fopen-claw-skills","javimosch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F12900508?v=4","01M6D3F2AS6PV75ET9PZ1QGP8J","Javier Leandro Arancibia","01M75B8NCTAJG9WH5YNZH7C3D8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fechennells\u002Fsparkbtcbot-proxy-deploy\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: sparkbtcbot-proxy-deploy\ndescription: Deploy a serverless Spark Bitcoin L2 proxy on Vercel with spending limits, auth, and Redis logging. Use when user wants to set up a new proxy, configure env vars, deploy to Vercel, or manage the proxy infrastructure.\nargument-hint: \"[Optional: setup, deploy, rotate-token, or configure]\"\n---\n\n# Deploy sparkbtcbot-proxy\n\nYou are an expert in deploying and managing the sparkbtcbot-proxy — a serverless middleware that wraps the Spark Bitcoin L2 SDK behind authenticated REST endpoints on Vercel.\n\n## What This Proxy Does\n\nGives AI agents scoped wallet access without exposing the mnemonic:\n- Role-based token auth (`admin` for full access, `invoice` for read + create invoices only)\n- Token management via API — create, list, revoke without redeploying\n- Per-transaction and daily spending caps\n- Activity logging to Redis\n- Lazy detection of paid Lightning invoices\n\n## What You Need\n\n**Ask the user for these upfront:**\n\n- Vercel account (free Hobby tier works)\n- Upstash account email and API key (from https:\u002F\u002Fconsole.upstash.com\u002Faccount\u002Fapi) — OR existing `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` if they already have a database\n- BIP39 mnemonic for the Spark wallet (or generate one in step 3)\n- Node.js 20+\n\n**Generated during setup (don't ask for these):**\n\n- `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` — created by the Upstash management API in step 2\n- `API_AUTH_TOKEN` — generated in step 4\n\n## Step-by-Step Deployment\n\n### 1. Clone and install\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fechennells\u002Fsparkbtcbot-proxy.git\ncd sparkbtcbot-proxy\nnpm install\n```\n\n### 2. Create Upstash Redis\n\nIf the user already has `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`, skip to step 3.\n\nOtherwise, create a database via the Upstash API. The user needs their Upstash email and API key from https:\u002F\u002Fconsole.upstash.com\u002Faccount\u002Fapi:\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.upstash.com\u002Fv2\u002Fredis\u002Fdatabase\" \\\n  -u \"UPSTASH_EMAIL:UPSTASH_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"sparkbtcbot-proxy\", \"region\": \"global\", \"primary_region\": \"us-east-1\"}'\n```\n\n**Note:** Regional database creation is deprecated. You must use `\"region\": \"global\"` with a `\"primary_region\"` field. The Upstash docs may not reflect this yet.\n\nThe response includes `rest_url` and `rest_token` — save these for step 5.\n\n### 3. Generate a wallet mnemonic (if needed)\n\n`SparkWallet.initialize()` returns `{ mnemonic, wallet }` when called without a mnemonic. One-liner:\n\n```bash\nnode -e \"import('@buildonspark\u002Fspark-sdk').then(({SparkWallet}) => SparkWallet.initialize({mnemonicOrSeed: null, options: {network: 'MAINNET'}}).then(r => { console.log(r.mnemonic); r.wallet.cleanupConnections() }))\"\n```\n\nSave the 12-word mnemonic securely — it controls all funds in the wallet. There is no `getMnemonic()` method; you can only retrieve the mnemonic at initialization time.\n\nOr use any BIP39 mnemonic generator. 12 or 24 words.\n\n### 4. Generate an API auth token\n\n```bash\nopenssl rand -base64 30\n```\n\n### 5. Deploy to Vercel\n\n```bash\nnpx vercel --prod\n```\n\nWhen prompted, accept the defaults. Then set environment variables. All 7 are required:\n\n| Variable | Description | Example |\n|----------|-------------|---------|\n| `SPARK_MNEMONIC` | 12-word BIP39 mnemonic | `fence connect trigger ...` |\n| `SPARK_NETWORK` | Spark network | `MAINNET` |\n| `API_AUTH_TOKEN` | Admin fallback bearer token | output of step 4 |\n| `UPSTASH_REDIS_REST_URL` | Redis REST endpoint | `https:\u002F\u002Fxxx.upstash.io` |\n| `UPSTASH_REDIS_REST_TOKEN` | Redis auth token | from step 2 |\n| `MAX_TRANSACTION_SATS` | Per-transaction spending cap | `10000` |\n| `DAILY_BUDGET_SATS` | Daily spending cap (resets midnight UTC) | `100000` |\n\n**Important:** Do NOT use `vercel env add` with heredoc\u002F`\u003C\u003C\u003C` input — it appends newlines that break the Spark SDK. Either use the Vercel dashboard or the REST API:\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.vercel.com\u002Fv10\u002Fprojects\u002F\u003CPROJECT_ID>\u002Fenv?teamId=\u003CTEAM_ID>\" \\\n  -H \"Authorization: Bearer \u003CVERCEL_TOKEN>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"type\":\"encrypted\",\"key\":\"SPARK_MNEMONIC\",\"value\":\"your mnemonic here\",\"target\":[\"production\",\"preview\",\"development\"]}'\n```\n\nRedeploy after setting env vars:\n\n```bash\nnpx vercel --prod\n```\n\n### 6. Test\n\n```bash\ncurl -H \"Authorization: Bearer \u003Cyour-token>\" https:\u002F\u002F\u003Cyour-deployment>.vercel.app\u002Fapi\u002Fbalance\n```\n\nShould return `{\"success\":true,\"data\":{\"balance\":\"0\",\"tokenBalances\":{}}}`.\n\n### 7. Create scoped tokens (optional)\n\nUse the admin token to create limited tokens for agents:\n\n```bash\ncurl -X POST -H \"Authorization: Bearer \u003Cadmin-token>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"role\": \"invoice\", \"label\": \"my-agent\"}' \\\n  https:\u002F\u002F\u003Cyour-deployment>.vercel.app\u002Fapi\u002Ftokens\n```\n\nThe response includes the full token string — save it, it's only shown once. See the **Token Roles** section below for details.\n\n## API Routes\n\n| Method | Route | Description |\n|--------|-------|-------------|\n| GET | `\u002Fllms.txt` | API documentation for bots (no auth required) |\n| GET | `\u002Fapi\u002Fbalance` | Wallet balance (sats + tokens) |\n| GET | `\u002Fapi\u002Finfo` | Spark address and identity pubkey |\n| GET | `\u002Fapi\u002Ftransactions` | Transfer history (`?limit=&offset=`) |\n| GET | `\u002Fapi\u002Fdeposit-address` | Bitcoin L1 deposit address |\n| GET | `\u002Fapi\u002Ffee-estimate` | Lightning send fee estimate (`?invoice=`) |\n| GET | `\u002Fapi\u002Flogs` | Recent activity logs (`?limit=`) |\n| POST | `\u002Fapi\u002Finvoice\u002Fcreate` | Create Lightning invoice (`{amountSats, memo?, expirySeconds?}`) |\n| POST | `\u002Fapi\u002Finvoice\u002Fspark` | Create Spark invoice (`{amount?, memo?}`) |\n| POST | `\u002Fapi\u002Fpay` | Pay Lightning invoice — admin only (`{invoice, maxFeeSats}`) |\n| POST | `\u002Fapi\u002Ftransfer` | Spark transfer — admin only (`{receiverSparkAddress, amountSats}`) |\n| POST | `\u002Fapi\u002Fl402` | Pay L402 paywall — admin only (`{url, method?, headers?, body?, maxFeeSats?}`) |\n| GET | `\u002Fapi\u002Fl402\u002Fstatus` | Check\u002Fcomplete pending L402 (`?id=\u003CpendingId>`) |\n| GET | `\u002Fapi\u002Ftokens` | List API tokens — admin only |\n| POST | `\u002Fapi\u002Ftokens` | Create a new token — admin only (`{role, label}`) |\n| DELETE | `\u002Fapi\u002Ftokens` | Revoke a token — admin only (`{token}`) |\n\n## Token Roles\n\nThere are two token roles:\n\n| Role | Permissions |\n|------|------------|\n| `admin` | Everything — read, create invoices, pay, transfer, manage tokens |\n| `invoice` | Read (balance, info, transactions, logs, fee-estimate, deposit-address) + create invoices. Cannot pay or transfer. |\n\nThe `API_AUTH_TOKEN` env var is a hardcoded admin fallback — it always works even if Redis is down or tokens get wiped. Use it to bootstrap: create scoped tokens via the API, then hand those out to agents.\n\n### Managing tokens\n\nCreate an invoice-only token for a merchant bot:\n\n```bash\ncurl -X POST -H \"Authorization: Bearer \u003Cadmin-token>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"role\": \"invoice\", \"label\": \"merchant-bot\"}' \\\n  https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Ftokens\n```\n\nList all tokens (shows prefixes, labels, roles — not full token strings):\n\n```bash\ncurl -H \"Authorization: Bearer \u003Cadmin-token>\" https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Ftokens\n```\n\nRevoke a token:\n\n```bash\ncurl -X DELETE -H \"Authorization: Bearer \u003Cadmin-token>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"token\": \"\u003Cfull-token-string>\"}' \\\n  https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Ftokens\n```\n\nTokens are stored in Redis (hash `spark:tokens`). They survive redeploys but not Redis flushes.\n\n## L402 Paywall Support\n\nThe proxy can pay [L402](https:\u002F\u002Fdocs.lightning.engineering\u002Fthe-lightning-network\u002Fl402) Lightning paywalls automatically. Send a URL, and the proxy will:\n\n1. Fetch the URL\n2. If 402 returned, parse the invoice and macaroon\n3. Pay the Lightning invoice\n4. Retry the request with the L402 Authorization header\n5. Return the protected content\n\n### Basic usage\n\n```bash\ncurl -X POST -H \"Authorization: Bearer \u003Cadmin-token>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"url\": \"https:\u002F\u002Flightningfaucet.com\u002Fapi\u002Fl402\u002Fjoke\"}' \\\n  https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Fl402\n```\n\n### Handling pending payments (important for agents)\n\nLightning payments via Spark are asynchronous. The proxy polls for up to ~7.5 seconds, but if the preimage isn't available in time, it returns a **pending** status:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"status\": \"pending\",\n    \"pendingId\": \"a1b2c3d4e5f6...\",\n    \"message\": \"Payment sent but preimage not yet available. Poll GET \u002Fapi\u002Fl402\u002Fstatus?id=\u003CpendingId> to complete.\",\n    \"priceSats\": 21\n  }\n}\n```\n\n**Your agent MUST handle this case.** The payment has already been sent — if you don't poll for completion, you lose the sats without getting the content.\n\n**Retry loop (pseudocode):**\n\n```\nresponse = POST \u002Fapi\u002Fl402 { url: \"...\" }\n\nif response.data.status == \"pending\":\n    pendingId = response.data.pendingId\n    for attempt in 1..10:\n        sleep(3 seconds)\n        status = GET \u002Fapi\u002Fl402\u002Fstatus?id={pendingId}\n        if status.data.status != \"pending\":\n            return status.data  # Success or failure\n    # Give up after ~30 seconds\n    raise \"L402 payment timed out\"\nelse:\n    return response.data  # Immediate success\n```\n\n**Key points:**\n- **Token caching**: Paid L402 tokens are cached per-domain (up to 24 hours). Subsequent requests to the same domain reuse the cached token without paying again. If the token expires, the proxy pays for a new one automatically.\n- Pending records expire after 1 hour\n- The `\u002Fapi\u002Fl402\u002Fstatus` endpoint polls Spark for up to 5 seconds per call\n- If the payment failed on Spark's side, status will return an error\n- Once complete, the pending record is deleted from Redis\n- The proxy automatically retries the final fetch up to 3 times (200ms delay) if the response is empty — some servers don't return content immediately after payment\n\n## Common Operations\n\n### Rotate the admin fallback token\n\n1. Generate a new token: `openssl rand -base64 30`\n2. Update `API_AUTH_TOKEN` in Vercel env vars\n3. Redeploy: `npx vercel --prod`\n4. Update any agents using the old token\n\nRedis-stored tokens are not affected by this — they continue working.\n\n### Adjust spending limits\n\nUpdate `MAX_TRANSACTION_SATS` and `DAILY_BUDGET_SATS` in Vercel env vars and redeploy. Budget resets daily at midnight UTC.\n\n### Check logs\n\n```bash\ncurl -H \"Authorization: Bearer \u003Ctoken>\" https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Flogs?limit=20\n```\n\n## Architecture\n\n- **Vercel serverless functions** — each request spins up, initializes the Spark SDK (~1.5s), handles the request, and shuts down. No always-on process, no billing when idle.\n- **Upstash Redis** — stores daily spend counters, activity logs, pending invoice tracking, and API tokens. Accessed over HTTP REST (no persistent connection needed). Free tier is limited to 1 database.\n- **Spark SDK** — `@buildonspark\u002Fspark-sdk` connects to Spark Signing Operators via gRPC over HTTP\u002F2. Pure JavaScript, no native addons.\n- **Lazy invoice check** — on every request, the middleware checks Redis for pending invoices and compares against recent wallet transfers. Expired invoices are cleaned up, paid ones are logged. Max 5 checks per request, wrapped in try\u002Fcatch so failures never affect the main request.\n","# Deploy sparkbtcbot-proxy\n\nYou are an expert in deploying and managing the sparkbtcbot-proxy — a serverless middleware that wraps the Spark Bitcoin L2 SDK behind authenticated REST endpoints on Vercel.\n\n## What This Proxy Does\n\nGives AI agents scoped wallet access without exposing the mnemonic:\n- Role-based token auth (`admin` for full access, `invoice` for read + create invoices only)\n- Token management via API — create, list, revoke without redeploying\n- Per-transaction and daily spending caps\n- Activity logging to Redis\n- Lazy detection of paid Lightning invoices\n\n## What You Need\n\n**Ask the user for these upfront:**\n\n- Vercel account (free Hobby tier works)\n- Upstash account email and API key (from https:\u002F\u002Fconsole.upstash.com\u002Faccount\u002Fapi) — OR existing `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` if they already have a database\n- BIP39 mnemonic for the Spark wallet (or generate one in step 3)\n- Node.js 20+\n\n**Generated during setup (don't ask for these):**\n\n- `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` — created by the Upstash management API in step 2\n- `API_AUTH_TOKEN` — generated in step 4\n\n## Step-by-Step Deployment\n\n### 1. Clone and install\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fechennells\u002Fsparkbtcbot-proxy.git\ncd sparkbtcbot-proxy\nnpm install\n```\n\n### 2. Create Upstash Redis\n\nIf the user already has `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`, skip to step 3.\n\nOtherwise, create a database via the Upstash API. The user needs their Upstash email and API key from https:\u002F\u002Fconsole.upstash.com\u002Faccount\u002Fapi:\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.upstash.com\u002Fv2\u002Fredis\u002Fdatabase\" \\\n  -u \"UPSTASH_EMAIL:UPSTASH_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"sparkbtcbot-proxy\", \"region\": \"global\", \"primary_region\": \"us-east-1\"}'\n```\n\n**Note:** Regional database creation is deprecated. You must use `\"region\": \"global\"` with a `\"primary_region\"` field. The Upstash docs may not reflect this yet.\n\nThe response includes `rest_url` and `rest_token` — save these for step 5.\n\n### 3. Generate a wallet mnemonic (if needed)\n\n`SparkWallet.initialize()` returns `{ mnemonic, wallet }` when called without a mnemonic. One-liner:\n\n```bash\nnode -e \"import('@buildonspark\u002Fspark-sdk').then(({SparkWallet}) => SparkWallet.initialize({mnemonicOrSeed: null, options: {network: 'MAINNET'}}).then(r => { console.log(r.mnemonic); r.wallet.cleanupConnections() }))\"\n```\n\nSave the 12-word mnemonic securely — it controls all funds in the wallet. There is no `getMnemonic()` method; you can only retrieve the mnemonic at initialization time.\n\nOr use any BIP39 mnemonic generator. 12 or 24 words.\n\n### 4. Generate an API auth token\n\n```bash\nopenssl rand -base64 30\n```\n\n### 5. Deploy to Vercel\n\n```bash\nnpx vercel --prod\n```\n\nWhen prompted, accept the defaults. Then set environment variables. All 7 are required:\n\n| Variable | Description | Example |\n|----------|-------------|---------|\n| `SPARK_MNEMONIC` | 12-word BIP39 mnemonic | `fence connect trigger ...` |\n| `SPARK_NETWORK` | Spark network | `MAINNET` |\n| `API_AUTH_TOKEN` | Admin fallback bearer token | output of step 4 |\n| `UPSTASH_REDIS_REST_URL` | Redis REST endpoint | `https:\u002F\u002Fxxx.upstash.io` |\n| `UPSTASH_REDIS_REST_TOKEN` | Redis auth token | from step 2 |\n| `MAX_TRANSACTION_SATS` | Per-transaction spending cap | `10000` |\n| `DAILY_BUDGET_SATS` | Daily spending cap (resets midnight UTC) | `100000` |\n\n**Important:** Do NOT use `vercel env add` with heredoc\u002F`\u003C\u003C\u003C` input — it appends newlines that break the Spark SDK. Either use the Vercel dashboard or the REST API:\n\n```bash\ncurl -X POST \"https:\u002F\u002Fapi.vercel.com\u002Fv10\u002Fprojects\u002F\u003CPROJECT_ID>\u002Fenv?teamId=\u003CTEAM_ID>\" \\\n  -H \"Authorization: Bearer \u003CVERCEL_TOKEN>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"type\":\"encrypted\",\"key\":\"SPARK_MNEMONIC\",\"value\":\"your mnemonic here\",\"target\":[\"production\",\"preview\",\"development\"]}'\n```\n\nRedeploy after setting env vars:\n\n```bash\nnpx vercel --prod\n```\n\n### 6. Test\n\n```bash\ncurl -H \"Authorization: Bearer \u003Cyour-token>\" https:\u002F\u002F\u003Cyour-deployment>.vercel.app\u002Fapi\u002Fbalance\n```\n\nShould return `{\"success\":true,\"data\":{\"balance\":\"0\",\"tokenBalances\":{}}}`.\n\n### 7. Create scoped tokens (optional)\n\nUse the admin token to create limited tokens for agents:\n\n```bash\ncurl -X POST -H \"Authorization: Bearer \u003Cadmin-token>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"role\": \"invoice\", \"label\": \"my-agent\"}' \\\n  https:\u002F\u002F\u003Cyour-deployment>.vercel.app\u002Fapi\u002Ftokens\n```\n\nThe response includes the full token string — save it, it's only shown once. See the **Token Roles** section below for details.\n\n## API Routes\n\n| Method | Route | Description |\n|--------|-------|-------------|\n| GET | `\u002Fllms.txt` | API documentation for bots (no auth required) |\n| GET | `\u002Fapi\u002Fbalance` | Wallet balance (sats + tokens) |\n| GET | `\u002Fapi\u002Finfo` | Spark address and identity pubkey |\n| GET | `\u002Fapi\u002Ftransactions` | Transfer history (`?limit=&offset=`) |\n| GET | `\u002Fapi\u002Fdeposit-address` | Bitcoin L1 deposit address |\n| GET | `\u002Fapi\u002Ffee-estimate` | Lightning send fee estimate (`?invoice=`) |\n| GET | `\u002Fapi\u002Flogs` | Recent activity logs (`?limit=`) |\n| POST | `\u002Fapi\u002Finvoice\u002Fcreate` | Create Lightning invoice (`{amountSats, memo?, expirySeconds?}`) |\n| POST | `\u002Fapi\u002Finvoice\u002Fspark` | Create Spark invoice (`{amount?, memo?}`) |\n| POST | `\u002Fapi\u002Fpay` | Pay Lightning invoice — admin only (`{invoice, maxFeeSats}`) |\n| POST | `\u002Fapi\u002Ftransfer` | Spark transfer — admin only (`{receiverSparkAddress, amountSats}`) |\n| POST | `\u002Fapi\u002Fl402` | Pay L402 paywall — admin only (`{url, method?, headers?, body?, maxFeeSats?}`) |\n| GET | `\u002Fapi\u002Fl402\u002Fstatus` | Check\u002Fcomplete pending L402 (`?id=\u003CpendingId>`) |\n| GET | `\u002Fapi\u002Ftokens` | List API tokens — admin only |\n| POST | `\u002Fapi\u002Ftokens` | Create a new token — admin only (`{role, label}`) |\n| DELETE | `\u002Fapi\u002Ftokens` | Revoke a token — admin only (`{token}`) |\n\n## Token Roles\n\nThere are two token roles:\n\n| Role | Permissions |\n|------|------------|\n| `admin` | Everything — read, create invoices, pay, transfer, manage tokens |\n| `invoice` | Read (balance, info, transactions, logs, fee-estimate, deposit-address) + create invoices. Cannot pay or transfer. |\n\nThe `API_AUTH_TOKEN` env var is a hardcoded admin fallback — it always works even if Redis is down or tokens get wiped. Use it to bootstrap: create scoped tokens via the API, then hand those out to agents.\n\n### Managing tokens\n\nCreate an invoice-only token for a merchant bot:\n\n```bash\ncurl -X POST -H \"Authorization: Bearer \u003Cadmin-token>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"role\": \"invoice\", \"label\": \"merchant-bot\"}' \\\n  https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Ftokens\n```\n\nList all tokens (shows prefixes, labels, roles — not full token strings):\n\n```bash\ncurl -H \"Authorization: Bearer \u003Cadmin-token>\" https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Ftokens\n```\n\nRevoke a token:\n\n```bash\ncurl -X DELETE -H \"Authorization: Bearer \u003Cadmin-token>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"token\": \"\u003Cfull-token-string>\"}' \\\n  https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Ftokens\n```\n\nTokens are stored in Redis (hash `spark:tokens`). They survive redeploys but not Redis flushes.\n\n## L402 Paywall Support\n\nThe proxy can pay [L402](https:\u002F\u002Fdocs.lightning.engineering\u002Fthe-lightning-network\u002Fl402) Lightning paywalls automatically. Send a URL, and the proxy will:\n\n1. Fetch the URL\n2. If 402 returned, parse the invoice and macaroon\n3. Pay the Lightning invoice\n4. Retry the request with the L402 Authorization header\n5. Return the protected content\n\n### Basic usage\n\n```bash\ncurl -X POST -H \"Authorization: Bearer \u003Cadmin-token>\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"url\": \"https:\u002F\u002Flightningfaucet.com\u002Fapi\u002Fl402\u002Fjoke\"}' \\\n  https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Fl402\n```\n\n### Handling pending payments (important for agents)\n\nLightning payments via Spark are asynchronous. The proxy polls for up to ~7.5 seconds, but if the preimage isn't available in time, it returns a **pending** status:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"status\": \"pending\",\n    \"pendingId\": \"a1b2c3d4e5f6...\",\n    \"message\": \"Payment sent but preimage not yet available. Poll GET \u002Fapi\u002Fl402\u002Fstatus?id=\u003CpendingId> to complete.\",\n    \"priceSats\": 21\n  }\n}\n```\n\n**Your agent MUST handle this case.** The payment has already been sent — if you don't poll for completion, you lose the sats without getting the content.\n\n**Retry loop (pseudocode):**\n\n```\nresponse = POST \u002Fapi\u002Fl402 { url: \"...\" }\n\nif response.data.status == \"pending\":\n    pendingId = response.data.pendingId\n    for attempt in 1..10:\n        sleep(3 seconds)\n        status = GET \u002Fapi\u002Fl402\u002Fstatus?id={pendingId}\n        if status.data.status != \"pending\":\n            return status.data  # Success or failure\n    # Give up after ~30 seconds\n    raise \"L402 payment timed out\"\nelse:\n    return response.data  # Immediate success\n```\n\n**Key points:**\n- **Token caching**: Paid L402 tokens are cached per-domain (up to 24 hours). Subsequent requests to the same domain reuse the cached token without paying again. If the token expires, the proxy pays for a new one automatically.\n- Pending records expire after 1 hour\n- The `\u002Fapi\u002Fl402\u002Fstatus` endpoint polls Spark for up to 5 seconds per call\n- If the payment failed on Spark's side, status will return an error\n- Once complete, the pending record is deleted from Redis\n- The proxy automatically retries the final fetch up to 3 times (200ms delay) if the response is empty — some servers don't return content immediately after payment\n\n## Common Operations\n\n### Rotate the admin fallback token\n\n1. Generate a new token: `openssl rand -base64 30`\n2. Update `API_AUTH_TOKEN` in Vercel env vars\n3. Redeploy: `npx vercel --prod`\n4. Update any agents using the old token\n\nRedis-stored tokens are not affected by this — they continue working.\n\n### Adjust spending limits\n\nUpdate `MAX_TRANSACTION_SATS` and `DAILY_BUDGET_SATS` in Vercel env vars and redeploy. Budget resets daily at midnight UTC.\n\n### Check logs\n\n```bash\ncurl -H \"Authorization: Bearer \u003Ctoken>\" https:\u002F\u002F\u003Cdeployment>\u002Fapi\u002Flogs?limit=20\n```\n\n## Architecture\n\n- **Vercel serverless functions** — each request spins up, initializes the Spark SDK (~1.5s), handles the request, and shuts down. No always-on process, no billing when idle.\n- **Upstash Redis** — stores daily spend counters, activity logs, pending invoice tracking, and API tokens. Accessed over HTTP REST (no persistent connection needed). Free tier is limited to 1 database.\n- **Spark SDK** — `@buildonspark\u002Fspark-sdk` connects to Spark Signing Operators via gRPC over HTTP\u002F2. Pure JavaScript, no native addons.\n- **Lazy invoice check** — on every request, the middleware checks Redis for pending invoices and compares against recent wallet transfers. Expired invoices are cleaned up, paid ones are logged. Max 5 checks per request, wrapped in try\u002Fcatch so failures never affect the main request.\n",{"name":5,"description":7,"argument-hint":24},"[Optional: setup, deploy, rotate-token, or configure]","main","f9d3fe7cf9ac8f1ea63a0d96e98e1f510a3814db","skills\u002Fechennells\u002Fsparkbtcbot-proxy-deploy",1,"https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills","https:\u002F\u002Fgithub.com\u002Fjavimosch","intrane.fr","Building robust, open-source infrastructure for the commons. AI-leveraged, self-hosted, built to last.","2026-06-07 03:34:58",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add javimosch\u002Fopen-claw-skills --skill sparkbtcbot-proxy-deploy",{"tool":40,"command":41},"bunx","bunx skills add javimosch\u002Fopen-claw-skills --skill sparkbtcbot-proxy-deploy",{"tool":43,"command":44},"pnpm","pnpm dlx skills add javimosch\u002Fopen-claw-skills --skill sparkbtcbot-proxy-deploy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fechennells\u002Fsparkbtcbot-proxy-deploy\u002FSKILL.md",true,[],[49,57,64,71,78,85],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":56},"01M778GGXG2VQ0YF31W2MKGMQZ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":56},"01M778G7BH8SBJ9FJ6C3G7CB1K","ceaser","Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir\u002FUltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":56},"01M778FYCJQZWFKKX5FYMK3S47","ceaser-send","Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir\u002FUltraHonk zero-knowledge proofs.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser-send\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":56},"01M778FQQNSEYA3HJKZBPQ4M9Z","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":56},"01M778FGVZX7QA2TF9BFMM37FY","moldium","Post and manage content on the Moldium blog platform. Triggered by \"post to Moldium\", \"write a blog post\", \"publish an article\", etc.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyom45\u002Fmoldium\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":56},"01M778F88D8PQ9MQ0KNW2TJ8ZH","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http:\u002F\u002Fweakaccept.top:8000\u002F.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[]]