v0.1 — Phase 1

Stack

LayerTechnology
BlockchainSolana Mainnet
Smart ContractAnchor (Rust)
StablecoinUSDC (SPL Token)
Circle IntegrationCircle Web3 Services API
API BackendNode.js / TypeScript
API FrameworkFastify
DatabasePostgreSQL — accounts, policies, audit log
QueueBullMQ + Redis — async transaction processing
Frontend DashboardNext.js + TypeScript
AuthAPI keys (HMAC-signed) + operator OAuth2
MonitoringDatadog + custom Solana RPC health checks
SDK (primary)TypeScript
SDK (secondary)Python (Phase 3)

Request flow

A transfer from an AI agent to an on-chain address follows this path:

text
Agent (OpenClaw / direct HTTP)
  │
  ▼
ClawdGo REST API  (Fastify / Node.js)
  │  1. Authenticate agent key
  │  2. Validate request schema
  │  3. Check idempotency key
  │
  ▼
Policy Engine
  │  4. Load spending policy from PostgreSQL + on-chain PDA
  │  5. Enforce: single-transfer limit, daily spend window,
  │     counterparty allowlist, memo requirement, pause flag
  │     → Reject here if any rule fails
  │
  ▼
Transaction Builder
  │  6. Construct Solana SPL token transfer instruction
  │  7. Sign with PDA authority keypair
  │
  ▼
BullMQ Queue  (async submission)
  │  8. Submit transaction to Solana RPC
  │  9. Poll for finality confirmation
  │
  ▼
Solana Mainnet
  │  10. On-chain settlement (~400ms)
  │
  ▼
Post-processing
  │  11. Write settled transfer to PostgreSQL audit log
  │  12. Update daily spend counter
  │  13. Fire webhooks
  │
  ▼
Response to Agent
     transfer_id, tx_signature, status: "settled", settled_at

On-chain program structure

The ClawdGo Solana program, written in Anchor (Rust), owns all agent account PDAs:

text
ClawdGo Program (on-chain)
├── Agent PDA (one per agent account)
│   ├── USDC SPL token account
│   ├── Spending policy state
│   │   ├── max_single_transfer
│   │   ├── max_daily_spend
│   │   ├── allowed_counterparties[]
│   │   ├── require_memo
│   │   └── paused
│   └── Transaction nonce (replay protection)
└── Operator registry
    └── Maps each agent PDA to an operator public key

Policy rules stored in the PDA are enforced by the program before any token transfer instruction is executed. A compromised API layer cannot bypass these constraints — they are validated at the program level.

Database schema (simplified)

accounts

ColumnTypeNotes
account_idvarcharPrimary key. Format: acct_*
operator_iduuidFK to operators table
namevarcharDisplay name
solana_addressvarchar(44)Base58 PDA address
usdc_token_accountvarchar(44)Base58 SPL token account
statusenumactive | paused
created_attimestamptz

transfers

ColumnTypeNotes
transfer_idvarcharPrimary key. Format: txn_*
account_idvarcharFK to accounts
to_addressvarchar(44)Recipient SPL address
amount_usdcnumeric(20,6)
memovarchar(200)Nullable
idempotency_keyvarchar(128)Unique per account
tx_signaturevarchar(88)Nullable until settled
statusenumpending | settled | rejected | failed
rejection_reasonvarcharNullable
created_attimestamptz
settled_attimestamptzNullable

Async transaction processing

Transfer submissions are processed via BullMQ + Redis. The API response is synchronous — ClawdGo waits for on-chain finality before returning. The queue handles:

  • RPC retry on transient Solana network errors
  • Confirmation polling with timeout and fallback
  • Webhook fan-out after settlement