Skip to content

GoodDollar/good-ai-compute-bridge

Repository files navigation

GoodDollar AI Compute Bridge

MVP repository for turning bridged GoodDollar (G$) deposits on Base / GoodDollar L2 into non-withdrawable AI compute credits that can be spent through an AntSeed buyer proxy.

Why this exists

GoodDollar users may have G$ but no USDC. AntSeed sellers are paid in USDC. This bridge separates the two:

  1. On-chain: user deposits bridged G$ into AntSeedCreditVault.
  2. Credit minting: vault computes USD-denominated micro credits from an operator-configured oracle rate (G$ per USD, 1e18 precision).
  3. Off-chain metering: API locks, settles, or refunds credits per AI usage session.
  4. Treasury payment: backend spends a USDC treasury through the local AntSeed buyer proxy (http://127.0.0.1:8377 by default).

Credits are not withdrawable and are only useful for compute.

Monorepo

packages/contracts  Hardhat Solidity AntSeedCreditVault + tests
packages/api        Express TypeScript usage proxy + JSON/in-memory credit ledger
packages/web        Vite React minimal quote/deposit/usage UI
docs/               Architecture, API notes, and agent/AntSeed status

Quick start

npm install
npm test
npm run build

Run the API and UI locally:

cp packages/api/.env.example packages/api/.env
npm run dev -w @good-ai-compute-bridge/api
npm run dev -w @good-ai-compute-bridge/web

Open the Vite URL and use the mock deposit flow. The API defaults to ANTSEED_MODE=mock; set ANTSEED_MODE=proxy only when a local AntSeed buyer proxy is funded and running.

Contract: AntSeedCreditVault

Core properties:

  • accepts an immutable IERC20 G$ token
  • mints credits in USD micro-units (1 USD = 1_000_000)
  • oracleRateGPerUsd uses 1e18 precision (100e18 = 100 G$ per USD)
  • optional global and per-account credit caps
  • owner-controlled pause and operator allowlist
  • operator spendCredits and refundCredits with refund bounded by prior operator debits
  • intentionally no user withdrawal or treasury-USDC withdrawal path

API endpoints

  • GET /health
  • GET /quote?gAmount=250
  • GET /credits/:userId
  • POST /credits/mock-deposit — dev-only ledger seeding for the MVP UI
  • POST /usage-sessions — lock estimated credits
  • GET /usage-sessions/:id
  • POST /usage-sessions/:id/settle — charge actual used credits and unlock the rest
  • POST /usage-sessions/:id/refund — unlock all credits without charge
  • POST /antseed/mock — deterministic mock completion
  • POST /antseed/call — metered mock/proxy completion, based on ANTSEED_MODE

Additional docs

  • docs/ARCHITECTURE.md — system architecture and flows
  • docs/API.md — endpoint reference
  • docs/AGENT_SKILLS.md — GoodClaw skill inventory and AntSeed/AntSkill status

Security stance

This is intentionally small and conservative:

  • on-chain deposits cannot be withdrawn from the vault in this MVP
  • off-chain ledger never stores private keys or AntSeed credentials
  • AntSeed proxy URL is local by default
  • operators are explicit and pausable
  • refunds cannot exceed prior operator-debited credits on-chain
  • the API locks credits before making a paid proxy call and refunds the lock if the proxy call throws

Production hardening still needed: real event indexing, signed usage sessions, audited oracle governance, treasury controls, rate limits, durable DB, and chain-specific deployment scripts.

About

GoodDollar AI compute bridge: spend G$ credits for AntSeed AI compute

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors