Deployed SpendGuard to NEAR Testnet for real via near-api-js, driven
programmatically (cargo-near's create-dev-account/sign-with-keychain are
interactive-only, confirmed in the plan's own rehearsal):
contract account spendguard-024e8dd6f7.testnet, deploy + init transactions
both SuccessValue, independently re-verified via a raw RPC call to
rpc.testnet.near.org.
- scripts/near_spend_guard_deploy.ts: generates a keypair, creates the
account via the public testnet faucet, deploys the built wasm, calls
new({admin}).
- lib/x402/near_spend_guard_client.ts: typed near-api-js client
(SpendGuardClient) for request_spend_authorization / spend_to_seller /
report_dispute_spike / view methods. Does not touch near_gateway.ts /
near_rpc.ts / near_finality.ts.
- agents/near_spend_controlled_buyer_agent.ts: buyer_agent.ts-pattern agent
— gets authorized, spends repeatedly through its scoped key.
- agents/near_watchdog_agent.ts: watchdog_agent.ts-pattern agent — triggers
the dispute-spike circuit breaker.
- scripts/near_spend_guard_full_demo.ts (npm run demo:near-spend-guard):
one command building the contract, running the full Rust test pass, and
then a live Testnet bonus run — 25/25 real on-chain spend_to_seller calls
settled against the real deployed contract, then a second real agent was
frozen and its key revoked, confirmed by a genuine rejected transaction
("Access key ... does not exist").
Real protocol finding baked into the client/agent design: Function Call
Access Keys can never attach a deposit (InvalidAccessKeyError::
DepositWithFunctionCall, hit live against both the local sandbox and real
Testnet) — spend_to_seller takes `amount` as a plain argument instead, with
ExposureBook enforcing the yoctoNEAR cap and the FC key's allowance
enforcing a real, protocol-level prepaid-gas call budget.
Round 1 against STRATEGY-2026-10-23.md's backlog:
- Wire register_agent/stake/set_credit_score/deposit_liquidity to the real
Casper Testnet contracts (lib/casper/live_bridge.ts), verified live against
the real RPC node with a freshly generated (unfunded) keypair
(npm run casper:keygen). Honesty flags built in for the Odra payable
calling convention and the admin-gated set_credit_score call.
- Unblock NEAR's paid x402 route (npm run near:keygen generates a real
implicit account id); QIE stays correctly flagged as blocked on unconfirmed
external facts (asset contract, facilitator), not env plumbing.
- New public Home tab: live-stats hero, how-it-works, a real competitor
comparison table, and a "90-second proof" that calls the real API live in
the browser (verified end-to-end with gstack browse).
- Cold-start UX: visible retry state in X402Playground + the TS SDK, plus a
keep-warm self-ping (lib/services/keepalive.ts) so the free Render dyno
rarely idles out from under a real first-time caller.
- New GET /v1/credit-score/:agentId alias + docs/integrations/ samples for
Skyfire/Nevermined/Coinbase x402.
- Self-hosting quickstart: root docker-compose.yml + scripts/bootstrap.sh,
both run for real; fixed a real EACCES crash-loop bug in infra/Dockerfile
(non-root user never owned the /data volume mount) found while verifying.
450/450 tests pass, typecheck clean, frontend build clean.
Replace the design-note docs (p1–p7) with the implemented "make it real" phase
docs (p8–p10) and wire production-grade, env-gated real integrations:
- p8 Casper Testnet: byte-exact deploys + WASM install via casper-js-sdk; live
node reads (node.testnet.casper.network); CRED402_CHAIN=sim|testnet transport.
- p9 x402 + data + MCP: real EIP-712 typed-data digests (@casper-ecosystem/
casper-eip-712); casper-x402 facilitator client (x402 V2); live Open-Meteo GHI;
official @modelcontextprotocol/sdk server; casper-sidecar SSE event feed.
- p10 RealFi + cross-chain: real Stripe test-mode webhooks (HMAC-verified) and
Plaid sandbox → privacy-preserving on-chain envelopes; Base Sepolia EVM deploy
(Foundry); reachable via /api/realfi/* and /api/x402/facilitator routes.
- Sign-in with Casper Wallet: real extension provider + challenge/ed25519/session
flow (/v1/auth/wallet/*), console connect + sign-in button.
- Branding: Cred402 logo mark, favicon, OG image; Vercel config for the console.
All env-gated with sim/free-API fallbacks; full suite green, all toolchains
(TS/Rust/Go/Solidity) build.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>