Sparkbtcbot
Set up Spark Bitcoin L2 wallet capabilities for AI agents. Initialize wallets from mnemonic, transfer sats and tokens, create/pay Lightning invoices, pay L40... Skill: Sparkbtcbot Owner: echennells Summary: Set up Spark Bitcoin L2 wallet capabilities for AI agents. Initialize wallets from mnemonic, transfer sats and tokens, create/pay Lightning invoices, pay L40... Tags: latest:0.3.3 Version history: v0.3.3 | 2026-02-21T20:44:28.685Z | user Add homepage URL v0.3.2 | 2026-02-21T20:11:41.420Z | auto sparkbtcbot 0.3.2 - Added example scripts for common Spark wallet operations,
Rank
62
Safety
84
Downloads
2.2k
Updated
Oct 9, 2026
Version
0.3.3
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 2.2K downloads reported by the source. Last updated 10/9/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 9, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 9, 2026
- Adoption signal
- 2.2K downloadsadoption · observed Oct 9, 2026
- Latest release
- 0.3.3release · observed Feb 21, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s17c0k375bsxdtsd34rkcnxard885aqr:sparkbtcbot- Node.js workspace detected. Install dependencies securely: run `npm ci --ignore-scripts` to prevent post-install lifecycle triggers from running arbitrary code, then selectively audit the dependency tree.
- Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-echennells-sparkbtcbot/snapshot"
Documentation
CLAWHUB
143,734 characters of source documentation, loaded on request.
Extracted files
5 files captured from the source.
SKILL.md
---
name: sparkbtcbot
description: Set up Spark Bitcoin L2 wallet capabilities for AI agents. Initialize wallets from mnemonic, transfer sats and tokens, create/pay Lightning invoices, pay L402 paywalls, manage deposits and withdrawals. Use when user mentions "Spark wallet," "Spark Bitcoin," "BTKN tokens," "Spark L2," "Spark SDK," "Spark payment," "Spark transfer," "Spark invoice," "L402," "Lightning paywall," or wants Bitcoin L2 capabilities for an agent.
argument-hint: "[Optional: specify what to set up - wallet, payments, tokens, lightning, l402, or full]"
requires:
env:
- name: SPARK_MNEMONIC
description: 12 or 24 word BIP39 mnemonic for the Spark wallet. This is a secret key that controls all funds — never commit to git or expose in logs.
sensitive: true
- name: SPARK_NETWORK
description: Network to connect to (MAINNET or REGTEST)
default: MAINNET
model-invocation: autonomous
model-invocation-reason: This skill enables agents to autonomously send and receive Bitcoin payments. Autonomous invocation is intentional — agents need to pay invoices and respond to incoming transfers without human approval for each transaction. Use spending limits and the proxy for production environments where you need guardrails.
homepage: https://sparkbot.yvrbtclabs.dev
---
# Spark Bitcoin L2 for AI Agents
You are an expert in setting up Spark Bitcoin L2 wallet capabilities for AI agents using the `@buildonspark/spark-sdk`.
Spark is a Bitcoin Layer 2 that enables instant, zero-fee self-custodial transfers of BTC and tokens, with native Lightning Network interoperability. Spark-to-Spark transfers cost nothing — compared to Lightning routing fees or on-chain transaction fees of 200+ sats. Even cross-network payments (Lightning interop) are cheaper than most alternatives at 0.15-0.25%. A single BIP39 mnemonic gives an agent identity, wallet access, and payment capabilities.
## For Production Use
**This skill gives the agent full custody of the wallet.** The agent holds the mnemonic and can send all funds without restriction. This is appropriate for:
- Development and testing (use REGTEST with no real funds)
- Trusted agents you fully control
- Small operational balances you're willing to lose
**For production with real funds, use [sparkbtcbot-proxy](https://github.com/echennells/sparkbtcbot-proxy) instead.** The proxy keeps the mnemonic on your server and gives agents scoped access via bearer tokens:
- **Spending limits** — per-transaction and daily caps
- **Role-based access** — read-only, invoice-only, or full access
- **Revocable tokens** — cut off a compromised agent without moving funds
- **Audit logs** — track all wallet activity
The proxy wraps the same Spark SDK behind authenticated REST endpoints. Agents get HTTP access instead of direct SDK access.
## Why Bitcoin for Agents
AI agents that transact need a monetary network that matches their nature: programmable, borderless, and available 24/7 without gatekeepers. Bi_meta.json
{
"ownerId": "kn71ga2vavytxp332ntav7k50x80epfh",
"slug": "sparkbtcbot",
"version": "0.3.3",
"publishedAt": 1771706668685
}BUGFIX-tokenBalances-map.md
# Bug: `tokenBalances` is a Map, not a plain Object — silent data loss
## Problem
`wallet.getBalance()` returns `{ balance, tokenBalances }` where `tokenBalances` is a JavaScript **`Map`**, not a plain object. This is undocumented in the Spark SDK and the SKILL.md doesn't call it out explicitly.
This matters because when an AI agent (the primary consumer of this skill) works with the balance data, it will naturally reach for standard JS patterns that **silently fail on Maps**:
```javascript
// All of these return {} or [] — SILENT DATA LOSS
JSON.stringify(tokenBalances) // "{}"
Object.entries(tokenBalances) // []
Object.keys(tokenBalances) // []
Object.keys(tokenBalances).length === 0 // true (even when tokens exist!)
```
None of these throw an error. They just return empty results, making it look like the wallet holds no tokens when it actually does.
## How we discovered it
1. User sent BEPSI tokens to the wallet's Spark address
2. Agent checked balance using `wallet.getBalance()`
3. Agent serialized `tokenBalances` with `JSON.stringify()` → showed `{}`
4. Agent reported "No tokens found" — **incorrect**
5. Running the `token-operations.js` example script (which uses `tokenBalances.size` and `for...of`) correctly showed 5,000,000 BEPSI
The wallet had tokens the entire time. The agent just couldn't see them because of the Map vs Object mismatch.
## Why this is especially bad for AI agents
AI agents (the target users of this skill) generate code on the fly. They default to the most common JS patterns — `JSON.stringify`, `Object.entries`, `Object.keys`. All of these work on plain objects but silently produce empty results on Maps. There's no error, no warning, no indication that data was lost.
An agent could:
- Report zero token balance when the user actually holds tokens
- Skip token operations because it thinks the wallet is empty
- Fail to trigger token-based logic (sweeps, transfers, alerts)
## Fix
### 1. Add explicit Map documentation to SKILL.md
In the Quick Example and the `getBalance()` sections, add a clear warning:
```
⚠️ `tokenBalances` is a JavaScript `Map`, not a plain object.
Use `.size`, `for...of`, or `Map` methods. Do NOT use JSON.stringify(),
Object.entries(), or Object.keys() — they silently return empty results.
```
### 2. Add a safe serialization helper to the Quick Example
```javascript
// tokenBalances is a Map — convert to object for JSON/logging
const tokensObj = Object.fromEntries(
[...tokenBalances].map(([id, info]) => [
info.tokenMetadata.tokenTicker,
{ balance: info.balance.toString(), decimals: info.tokenMetadata.decimals }
])
);
console.log("Tokens:", JSON.stringify(tokensObj));
```
### 3. Update the Quick Example to include token checking
The current Quick Example only shows BTC balance. It should show tokens too, since that's a primary use case.
## Files changed
- `SKILL.md` — Added Map warning, updated Quick Example with token balance check and safe spackage-lock.json
{
"name": "sparkbtcbot-skill",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sparkbtcbot-skill",
"version": "0.1.0",
"dependencies": {
"@buildonspark/spark-sdk": "^0.5.8",
"dotenv": "^16.4.7"
}
},
"node_modules/@bufbuild/protobuf": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.11.0.tgz",
"integrity": "sha512-sBXGT13cpmPR5BMgHE6UEEfEaShh5Ror6rfN3yEK5si7QVrtZg8LEPQb0VVhiLRUslD2yLnXtnRzG035J/mZXQ==",
"license": "(Apache-2.0 AND BSD-3-Clause)"
},
"node_modules/@buildonspark/spark-sdk": {
"version": "0.5.8",
"resolved": "https://registry.npmjs.org/@buildonspark/spark-sdk/-/spark-sdk-0.5.8.tgz",
"integrity": "sha512-e3F3UReerB68B6x4zykQ5MLzWeyNqRuU8rmgCfxDqnKCfaFUg0wTiZw6GdJrthO8kDX7A7THhwh4UsBiHzNtAg==",
"license": "Apache-2.0",
"dependencies": {
"@bufbuild/protobuf": "^2.2.5",
"@lightsparkdev/core": "^1.4.4",
"@noble/curves": "^1.8.0",
"@noble/hashes": "^1.7.0",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/context-async-hooks": "^2.0.0",
"@opentelemetry/core": "^2.0.0",
"@opentelemetry/instrumentation": "^0.203.0",
"@opentelemetry/instrumentation-undici": "^0.14.0",
"@opentelemetry/sdk-trace-base": "^2.0.0",
"@opentelemetry/sdk-trace-node": "^2.0.1",
"@opentelemetry/sdk-trace-web": "^2.0.1",
"@scure/base": "^1.2.4",
"@scure/bip32": "^1.6.2",
"@scure/bip39": "^1.5.4",
"@scure/btc-signer": "^1.5.0",
"abort-controller-x": "^0.4.3",
"abortcontroller-polyfill": "^1.7.8",
"async-mutex": "^0.5.0",
"bare-crypto": "^1.9.2",
"bare-fetch": "^2.4.1",
"buffer": "^6.0.3",
"eventemitter3": "^5.0.1",
"js-base64": "^3.7.7",
"light-bolt11-decoder": "^3.2.0",
"nice-grpc": "^2.1.10",
"nice-grpc-client-middleware-retry": "^3.1.10",
"nice-grpc-common": "^2.0.2",
"nice-grpc-opentelemetry": "^0.1.18",
"nice-grpc-web": "^3.3.7",
"ts-proto": "2.8.3",
"ua-parser-js": "^2.0.6",
"uuidv7": "^1.0.2"
},
"engines": {
"node": ">=18.0.0"
},
"peerDependencies": {
"react": ">=18.2.0",
"react-native": ">=0.71.0",
"react-native-get-random-values": ">=1.11.0"
},
"peerDependenciesMeta": {
"react": {
"optional": true
},
"react-native": {
"optional": true
},
"react-native-get-random-values": {
"optional": true
}
}
},
"node_modules/@grpc/grpc-js": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.3.tgz",
"integrity": "sha512-Iq8QQQ/7X3Sac15oB6p0FmUg/klxQvXLeileoqrTRGJYLV+/9tubbr9ipz0GKHjmXVsgFPo/+W+2cA8epackage.json
{
"name": "sparkbtcbot-skill",
"version": "0.1.0",
"type": "module",
"description": "Claude Code skill for setting up Spark Bitcoin L2 wallet capabilities for AI agents",
"dependencies": {
"@buildonspark/spark-sdk": "^0.5.8",
"dotenv": "^16.4.7"
},
"scripts": {
"example:setup": "node examples/wallet-setup.js",
"example:balance": "node examples/balance-and-deposits.js",
"example:payments": "node examples/payment-flow.js",
"example:tokens": "node examples/token-operations.js",
"example:agent": "node examples/spark-agent.js"
}
}AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/echennells/skills/sparkbtcbot",
"sourceUrl": "https://clawhub.ai/echennells/skills/sparkbtcbot",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-09T17:09:38.178Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-echennells-sparkbtcbot/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-echennells-sparkbtcbot/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-09T17:09:38.178Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "2.2K downloads",
"href": "https://clawhub.ai/echennells/sparkbtcbot",
"sourceUrl": "https://clawhub.ai/echennells/sparkbtcbot",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-09T17:09:38.178Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "0.3.3",
"href": "https://clawhub.ai/echennells/sparkbtcbot",
"sourceUrl": "https://clawhub.ai/echennells/sparkbtcbot",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-02-21T20:44:28.685Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-echennells-sparkbtcbot/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-echennells-sparkbtcbot/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 0.3.3",
"description": "Add homepage URL",
"href": "https://clawhub.ai/echennells/sparkbtcbot",
"sourceUrl": "https://clawhub.ai/echennells/sparkbtcbot",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-02-21T20:44:28.685Z",
"isPublic": true
}
]
}Record generated Oct 9, 2026.
