Comprabtc

io.github.csacanam由 GitHub 帳號 csacanam 發布v0.1.1更新於 Oct 24, 2026

Non-custodial Bitcoin DCA for agent treasuries: approve USDT once, stack WBTC on Celo forever.

已驗證STDIO僅桌面金融AI 與機器學習

概覽

AI 產生的概覽

讓助理在 Celo 上用資金錢包建立、監控、續訂或取消非託管的比特幣定期定額計畫。

可以做什麼
CompraBTC 是一個本機 MCP 伺服器,對應 Celo 上的非託管比特幣定期定額代理。它提供檢查計畫狀態、建立、續訂或取消計畫,以及追蹤所購入 WBTC 持倉的工具。計畫只需定義一次,即每個週期固定金額的 USDT;鏈上執行器每次執行提取一期,換成 WBTC 直接送到使用者錢包。讀取操作不需要錢包私鑰,建立、續訂與取消則需要簽章。
適用情境
當助理或代理資金庫需要在 Celo 上執行週期性比特幣累積計畫,並希望由助理直接管理該計畫時使用。適合能自行簽署設定交易的代理錢包,或由助理協助、在網頁應用中簽章的人類使用者。
執行需求
透過 npm 套件 comprabtc-mcp 以 npx 在本機以 stdio 執行。需要 Node.js 以及存取 Celo 主網。建立、續訂與取消需要 COMPRABTC_WALLET_PRIVATE_KEY,即持有 USDT 的資金錢包。COMPRABTC_MAX_PER_RUN_USDT 為選用,用於限制每期 USDT 支出(預設 50)。
安裝前請注意
COMPRABTC_WALLET_PRIVATE_KEY 是用來簽署交易並控制資金錢包資產的私鑰,持有者可轉移該錢包資產。建立計畫會向 DCAExecutor 合約授權 USDT 支出,因此每次執行都會花費真實資金,另加 1% 協議費與 0.005 美元固定費。取消需要發起交易;僅讀取則不需要。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Comprabtc,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

CompraBTC

Non-custodial Bitcoin DCA agent on Celo. Define your plan once — $X every hour/day in BTC — and an on-chain agent buys Bitcoin for you, straight into your own wallet. Funds never leave your wallet between purchases.

Deployed contracts (Celo mainnet, chain 42220)

Swaps route through the USDT/WBTC 0.3% Uniswap V3 pool. Protocol fee: 1% + $0.005 flat per execution, with on-chain hard caps (≤1%, ≤$0.05 flat) and a revert if the fee would ever eat the installment.

Agent identity: ERC-8004 #9665 on Celo mainnet (8004scan). Every transaction carries ERC-8021 attribution tags.

How it works

mermaid
flowchart TB    USER["👤 User wallet<br/>(MiniPay / MetaMask / Valora)"]    FE["Frontend — Next.js PWA<br/>(Vercel)"]
    subgraph onchain["⛓️ Celo mainnet"]        USDT["USDT (ERC-20)"]        EXEC["DCAExecutor<br/>0xd03f…4189<br/>non-custodial, on-chain limits"]        ROUTER["Uniswap V3 SwapRouter02<br/>USDT/WBTC 0.3% pool"]        TREASURY["Treasury"]    end
    subgraph backend["🤖 Agent backend — Vercel"]        KEEPER["Keeper (Vercel Cron, 5 min)<br/>scans PlanCreated events,<br/>checks due plans"]        API["Express API<br/>POST /api/execute<br/>(x402-gated, permissionless)"]        DB[("Supabase<br/>plans · executions")]        TG["Telegram bot<br/>purchase alerts + ops"]    end
    FACIL["x402 facilitator<br/>api.x402.celo.org"]
    USER -- "① approve(budget) — once" --> USDT    USER -- "② createPlan(amount, interval) — once" --> EXEC    FE -.-> USER    KEEPER -- "discovers plans<br/>(PlanCreated events)" --> EXEC    KEEPER -- "③ pays 0.02 USDT via x402<br/>(EIP-3009 signature)" --> API    API -- "verify + settle" --> FACIL    API -- "④ execute(user, minOut)<br/>+ ERC-8021 attribution tags" --> EXEC    EXEC -- "⑤ transferFrom<br/>(one installment)" --> USDT    EXEC -- "fee 1% + $0.005" --> TREASURY    EXEC -- "⑥ swap USDT→WBTC" --> ROUTER    ROUTER -- "⑦ WBTC straight<br/>to the user's wallet" --> USER    API -- "records execution" --> DB    API -- "🔔 purchase alert" --> TG
  1. The user approves USDT to DCAExecutor (cap = total plan budget) and creates a plan with on-chain limits (amount per run, minimum interval). Cancelling = one click (cancelPlan or approve(0)).
  2. The keeper discovers plans from PlanCreated events, and each cycle pays the execution API with an x402 micropayment before calling execute() — so every purchase is also an agent-to-agent payment.
  3. On-chain limits mean even a compromised keeper can't overcharge: it can never pull more than amountPerRun or execute before minInterval elapses.
  4. Users get Telegram alerts on every purchase (link from Settings in the app).

Repository layout

DirectoryWhat it is
contracts/DCAExecutor.sol (Foundry) — 21 tests incl. mainnet fork tests, deploy script
backend/Express API + keeper loop (viem) + x402 middleware + Supabase + Telegram bot
frontend/Next.js PWA (wagmi/viem) — MiniPay auto-connect, plan creation, BTC portfolio
docs/Unit economics, copy review
PLAN.mdFull architecture plan and piece-by-piece feasibility verification

Running locally

Frontend (needs NEXT_PUBLIC_EXECUTOR_ADDRESS, NEXT_PUBLIC_API_URL, NEXT_PUBLIC_ATTRIBUTION_CODE, NEXT_PUBLIC_TELEGRAM_BOT in frontend/.env.local):

bash
cd frontend && pnpm install && pnpm dev   # http://localhost:3000

Backend + keeper (Node 22; see backend/src/config.ts for required env vars — executor address, keeper key, Supabase credentials, x402 API key; DB schema in backend/supabase/schema.sql + migrations in the same folder):

bash
cd backend && pnpm install && pnpm dev    # API on :8080, keeper ticks every 60s

Locally the keeper runs as an in-process loop (setInterval). Deployed on Vercel the whole Express app is a single function and the keeper is driven by Vercel Cron hitting GET /api/cron/keeper (guarded by CRON_SECRET, schedule in backend/vercel.json) — serverless instances are frozen and reused, so an interval there would fire duplicated, off-schedule ticks. Anything the keeper needs to remember between ticks (alert cooldowns, digest cadence, last scanned block) lives in agent_keeper_state, not in memory.

Contracts:

bash
cd contracts && forge test                # unit + Celo mainnet fork testsforge script script/Deploy.s.sol --rpc-url celo --broadcast --verify --interactives 1

For AI agents

An agent with its own funded wallet can set up a Bitcoin savings plan in two transactions — and so can an agent assisting a human (the web app handles the signing):

  • MCP server (treasury DCA): claude mcp add comprabtc -- npx -y comprabtc-mcp — tools to check status, create/renew/cancel the plan and track the portfolio, signing with the treasury's own wallet. See mcp/README.md.
  • Agent skill: npx skills add csacanam/comprabtc — covers plan creation (viem), monitoring, budget math, cancelling, and the permissionless x402 execution trigger.
  • Service descriptor (machine-readable how-to): GET https://comprabtc-api.vercel.app/ · LLM index: comprabtc.vercel.app/llms.txt
  • Agent identity: ERC-8004 #9665 on Celo — metadata · 8004scan

Transparency

Operator wallets (declared):

RoleAddress
Keeper (executes plans)0x2F6a8283546d28506B312013F77aA38e60AF99B0
Treasury / payTo (receives fees)0x6Bd5c303b2ed7E264C1Ce9D3592457292a1F1c43

On-chain volume is real user capital. Each plan starts with a user's own approve; the keeper pulls one installment per run via transferFrom and the purchased WBTC goes straight to the user's wallet, where it stays. No custody, no round-trips — the volume is actual BTC purchases with real economic intent.

x402 is internal metering with an open door. The keeper pays x402 on every run, so each x402 payment maps to one real executed purchase — not standalone dust. /api/execute is permissionless and auto-registers plans from on-chain events, so any external agent or human can invoke it and settle their own x402; it is not a closed loop.

Hackathon tracks

  • Track 1 — on-chain revenue: protocol fee charged inside execute(), every tx tagged with ERC-8021 attribution.
  • Track 2 — x402 payments: the keeper pays /api/execute per run via the Celo x402 facilitator. The endpoint is permissionless — any agent can pay to trigger an execution.
  • Track 4 — Aigora: agent registered on the Aigora marketplace (#395) + feedback PRs at trionlabs/aigora-skills.

License

MIT

來源:README.md,提交 e527f1d

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。