{"id":46041954,"url":"https://github.com/tiero/claw-cash","last_synced_at":"2026-03-01T06:39:22.905Z","repository":{"id":339090355,"uuid":"1157568152","full_name":"tiero/claw-cash","owner":"tiero","description":"Bitcoin wallet for AI agents. Stablecoins in, Bitcoin out. Keys in hardware enclaves. Works with OpenClaw, Claude Code, or any agent harness.","archived":false,"fork":false,"pushed_at":"2026-02-27T14:07:42.000Z","size":2479,"stargazers_count":17,"open_issues_count":6,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-27T19:13:30.273Z","etag":null,"topics":["ai-agent","bitcoin","bitocin-wallet","clawdbot","moltbot","open-claw","tether","usdc","usdt"],"latest_commit_sha":null,"homepage":"https://clw.cash","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-14T01:14:31.000Z","updated_at":"2026-02-27T14:07:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tiero/claw-cash","commit_stats":null,"previous_names":["tiero/claw-cash"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tiero/claw-cash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiero%2Fclaw-cash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiero%2Fclaw-cash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiero%2Fclaw-cash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiero%2Fclaw-cash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiero","download_url":"https://codeload.github.com/tiero/claw-cash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiero%2Fclaw-cash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29962068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T05:59:08.471Z","status":"ssl_error","status_checked_at":"2026-03-01T05:58:04.208Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agent","bitcoin","bitocin-wallet","clawdbot","moltbot","open-claw","tether","usdc","usdt"],"created_at":"2026-03-01T06:39:22.360Z","updated_at":"2026-03-01T06:39:22.890Z","avatar_url":"https://github.com/tiero.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🦞 claw-cash\n\n[![npm](https://img.shields.io/npm/v/clw-cash)](https://www.npmjs.com/package/clw-cash)\n\nBitcoin for AI Agents.\n\nAgents hold Bitcoin — the only money they can cryptographically verify. When they need to pay for something (APIs, stablecoins, inference), they swap BTC on the fly. Private keys live in hardware enclaves. One CLI for BTC, Lightning, Ark, and stablecoins.\n\nWorks with any agent harness — [OpenClaw](https://openclaw.ai), Claude Code, or your own. Give your agent a wallet it can actually verify.\n\n## Vision: Stablecoins In, Bitcoin Out\n\nHumans pay agents in stablecoins — USDC, USDT, whatever's convenient. The agent converts to Bitcoin and holds verifiable money: 21 million supply cap enforced by math, every block header cryptographically linked, every transaction independently verifiable by code.\n\nWhen an agent needs to spend — an API behind a paywall, a stablecoin transfer, an x402-protected resource — it swaps BTC to stablecoins on the fly and sends. Bitcoin is the treasury, stablecoins are the payment rail.\n\nThe swap infrastructure (LendaSwap + Boltz) and ECDSA signing are already in place. Native x402 support is on the roadmap — blocked on x402 facilitator support beyond Base USDC.\n\n## How it works\n\n```\nAgent ──► cash CLI ──► skills/ ──► sdk/ ──► clw.cash API ──► Enclave (secp256k1)\n                                                │\n                                                └── audit log, rate limits, 2FA via Telegram\n```\n\n## Layout\n\n```\napi/          Public-facing REST API (auth, identities, signing)\nenclave/      Signer service (runs inside Evervault Enclave)\nsdk/          TypeScript SDK — RemoteSignerIdentity, API client, signing utils\nskills/       Bitcoin, Lightning, and Stablecoin skills (Ark, Boltz, LendaSwap)\ncli/          Agent-friendly CLI (\"cash\") — send, receive, balance\nschemas/      OpenAPI + JSON schemas\ninfra/        Enclave config and deployment\n```\n\n## CLI — `cash`\n\n```bash\nnpm i -g claw-cash\n```\n\nThe CLI outputs JSON to stdout, designed to be called by AI agents as a subprocess tool. Full command reference and agent tips: [SKILL.md](https://clw.cash/SKILL.md).\n\n## Quickstart\n\n```bash\npnpm install\n```\n\n### 1. Start services locally\n\n```bash\n# Terminal 1 — enclave signer (runs on :7000)\npnpm start:enclave\n\n# Terminal 2 — API (runs on :4000)\npnpm start:api\n```\n\nNo enclave redeploy needed for local development. The enclave service runs as a regular Node process locally — it only runs inside Evervault in production.\n\n### 2. Initialize the CLI\n\n```bash\n# Auto-authenticates, creates an identity, saves config, starts daemon\npnpm --filter ./cli dev -- init \\\n  --api-url http://127.0.0.1:4000 \\\n  --ark-server https://server.arkade.fun\n```\n\nIn test mode (no `TELEGRAM_BOT_TOKEN` set), authentication resolves automatically. In production, a Telegram deep link is shown for 2FA confirmation.\n\nThis creates `~/.clw-cash/config.json` with your identity credentials and starts a background daemon for monitoring swaps (Lightning HTLC claiming and LendaSwap polling).\n\nYou can also pass a token explicitly: `--token \u003cjwt\u003e`.\n\n### 3. Use the CLI\n\n```bash\n# Check balance (requires Ark server to be reachable)\npnpm --filter ./cli dev -- balance\n\n# Receive — get an Ark address\npnpm --filter ./cli dev -- receive --amount 100000 --currency btc --where arkade\n\n# Receive — create a Lightning invoice\npnpm --filter ./cli dev -- receive --amount 50000 --currency btc --where lightning\n```\n\nYou can also set env vars instead of using the config file:\n\n```bash\nexport CLW_API_URL=http://127.0.0.1:4000\nexport CLW_SESSION_TOKEN=\u003cjwt\u003e\nexport CLW_IDENTITY_ID=\u003cuuid\u003e\nexport CLW_PUBLIC_KEY=\u003chex\u003e\nexport CLW_ARK_SERVER_URL=https://server.arkade.fun\n```\n\n## Testing\n\n### E2E tests (API + Enclave only)\n\n```bash\npnpm test:e2e\n```\n\nThis spins up the enclave and API on random ports, runs the full user journey (auth, identity, sign, destroy, backup/restore), and tears down. No external dependencies needed.\n\n### Typecheck all packages\n\n```bash\npnpm typecheck\n```\n\n## API Endpoints\n\n| Method | Path | Auth | Description |\n| ------ | ---- | ---- | ----------- |\n| GET | `/health` | No | Health check |\n| POST | `/v1/auth/challenge` | No | Create auth challenge |\n| POST | `/v1/auth/verify` | No | Verify challenge, get JWT |\n| POST | `/v1/auth/bot-session` | Bot key | Get session for a Telegram user (bot-to-bot) |\n| POST | `/v1/identities` | Yes | Create identity (key generated in enclave) |\n| POST | `/v1/identities/:id/restore` | Yes | Restore identity from backup |\n| POST | `/v1/identities/:id/sign-intent` | Yes | Get signing ticket |\n| POST | `/v1/identities/:id/sign` | Yes | Sign with ticket |\n| POST | `/v1/identities/:id/sign-batch` | Yes | Batch sign multiple digests |\n| DELETE | `/v1/identities/:id` | Yes | Destroy identity |\n| GET | `/v1/audit` | Yes | Audit trail |\n\n## Bot Integration (Factory Bot)\n\nclw.cash acts as a **factory bot** — a backend service that other Telegram bots use to give their users Bitcoin wallets. Your bot authenticates with a shared API key and gets per-user sessions without any user-facing auth flow.\n\n### How it works\n\n```text\nUser (Telegram)           Your Bot                    clw.cash API          Enclave\n     │                       │                            │                    │\n     │  \"send 1000 sats\"     │                            │                    │\n     │  from.id = 98765      │                            │                    │\n     │──────────────────────►│                            │                    │\n     │                       │  POST /v1/auth/bot-session │                    │\n     │                       │  x-bot-api-key: \u003csecret\u003e   │                    │\n     │                       │  { telegram_user_id: 98765 }                    │\n     │                       │───────────────────────────►│                    │\n     │                       │  ◄── { token, user }       │                    │\n     │                       │                            │                    │\n     │                       │  SDK: wallet.sendBitcoin() │  sign digest       │\n     │                       │───────────────────────────►│───────────────────►│\n     │                       │  ◄── { txid }              │  ◄── { signature } │\n     │  ◄── \"Sent!\"          │                            │                    │\n```\n\n**Telegram guarantees `from.id` can't be faked** — only your bot (with the API key) can create sessions, and it only does so for verified Telegram users. No impersonation is possible.\n\n### Configuration\n\n1. **Create a Telegram bot** via [@BotFather](https://t.me/BotFather) — this is the \"factory\" auth bot\n1. **Generate a bot API key** — any random secret string\n1. **Set env vars** on the clw.cash API server:\n\n```bash\nTELEGRAM_BOT_TOKEN=\u003ctoken from BotFather\u003e\nTELEGRAM_BOT_USERNAME=\u003cyour_bot_username\u003e\nBOT_API_KEY=\u003cyour random secret\u003e\n```\n\n1. **In your bot code**, use the SDK directly (not the CLI):\n\n```typescript\nimport { createClwBitcoinSkill } from \"@clw-cash/skills\";\n\n// Get a session for this Telegram user\nconst session = await fetch(\"https://api.clw.cash/v1/auth/bot-session\", {\n  method: \"POST\",\n  headers: {\n    \"content-type\": \"application/json\",\n    \"x-bot-api-key\": process.env.BOT_API_KEY,\n  },\n  body: JSON.stringify({ telegram_user_id: String(msg.from.id) }),\n}).then(r =\u003e r.json());\n\n// Create a wallet skill for this user\nconst bitcoin = await createClwBitcoinSkill({\n  apiBaseUrl: \"https://api.clw.cash\",\n  sessionToken: session.token,\n  identityId: user.identityId,\n  publicKey: user.publicKey,\n  arkServerUrl: \"https://server.arkade.fun\",\n});\n\n// Use it\nconst result = await bitcoin.send({ address: \"ark1q...\", amount: 1000 });\n```\n\n### Auth modes\n\n| Mode | How it works | Use case |\n| ---- | ------------ | -------- |\n| **CLI** (`cash init`) | Challenge → Telegram deep link → human confirms | Developer testing, standalone agent |\n| **Bot session** | Bot API key + `telegram_user_id` → instant JWT | Telegram bot serving many users |\n| **Test mode** | No `TELEGRAM_BOT_TOKEN` → auto-resolves | Local dev, CI |\n\n## Deploy to Evervault\n\nInstall the [Evervault CLI](https://docs.evervault.com/cli), then:\n\n```bash\n# one-time: generate signing certs\nev enclave cert new --output ./infra\n\n# build enclave image\nev enclave build -v --output . -c ./infra/enclave.toml ./enclave\n\n# deploy\nev enclave deploy -v --eif-path ./enclave.eif -c ./infra/enclave.toml\n```\n\n## Roadmap\n\n### Now\n\n- [ ] **MCP server** — Claude Code / Claude Desktop tool-use integration\n\n### Next\n\n- [ ] **x402 client support** — `cash pay \u003curl\u003e` command, auto-swap BTC→stablecoin, retry with proof. Blocked on x402 facilitators outside USDC on Base\n- [ ] **Spending policies** — per-agent limits, allowlists, time-based rules, enforced at enclave level\n- [ ] **More auth providers** — Slack, Google, 1Password, YubiKey, Passkeys\n\n### Later\n\n- [ ] **Webhook notifications** — push events for transaction completion, swap settlement, balance changes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiero%2Fclaw-cash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiero%2Fclaw-cash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiero%2Fclaw-cash/lists"}