Adds scripts/record_near_spend_guard_demo.mjs (npm run
record:near-spend-guard), which asciinema-records the real `npm run
demo:near-spend-guard` terminal session and renders it with agg/ffmpeg.
Ran it for real against the live spendguard-024e8dd6f7.testnet
contract: full build, 18/18 unit tests, sandbox integration test, then
25 real spend_to_seller calls, a real repay_credit_line, a real
top_up_allowance, one more real spend on the same key, a dispute
freeze, and a rejected post-freeze call.
Commits the real artifacts: media/cred402-near-spend-guard-demo.cast
(.gif, .mp4, poster.png). Updates SUBMISSION-CHECKLIST.md to mark the
video done and adds a ready-to-post X caption draft
(X-POST-DRAFT-2026-11-07.md) since no social-posting credentials exist
in this environment.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the SpendGuard entrypoint flagged in HACKATHON.md as a known limit:
an agent with a still-ACTIVE spend key can now draw, repay, top up, and
draw again on the SAME key, not just at the ExposureBook ledger level.
- contracts-near/spend_guard/src/lib.rs: new admin-only top_up_allowance,
re-reserving freed headroom (capped by the agent's own policy-approved
credit line) and re-minting the agent's existing Function Call Access
Key via spend_key::retop_spend_key.
- src/spend_key.rs: retop_spend_key — a real NEAR protocol constraint
found and fixed live against a running nearcore sandbox: AddKey
unconditionally rejects an already-existing public key
(AddKeyAlreadyExists), so topping up means delete_key + re-add in the
SAME receipt, not a second AddKey call. Also fixed a clippy
doc_lazy_continuation nit in this file's module docs.
- src/exposure.rs: replaced two manual saturating-subtract patterns with
u128::saturating_sub (clippy implicit_saturating_sub), and added a unit
test proving repay-then-reserve-again reaches the full cap a second
time.
- tests/sandbox.rs: extended the real near-workspaces sandbox integration
test (genuinely running local nearcore node) to prove the full loop
live: draw -> repay -> top_up_allowance -> a real spend_to_seller call
that succeeds again on the SAME original key -> dispute spike -> freeze
-> revoked-key rejection.
- lib/x402/near_spend_guard_client.ts: repayCreditLine + topUpAllowance
client methods; scripts/near_spend_guard_full_demo.ts now exercises the
same real repay/top-up/draw-again loop against the LIVE deployed public
Testnet contract (spendguard-024e8dd6f7.testnet), not just the sandbox.
- scripts/near_spend_guard_redeploy.ts: new script to upgrade the
already-deployed contract's wasm in place (DeployContract replaces code
only, never storage) — used to push this change to the live Testnet
contract without losing its existing agent/exposure state.
Also fixes a real, judge-relevant finding hit while running the above:
NEAR's own legacy public RPC (rpc.testnet.near.org) now rejects most
calls with -429 "WARNING! THIS ENDPOINT IS DEPRECATED!". Every default
RPC URL in this repo (near_networks.ts, near_spend_guard_client.ts,
near_spend_guard_deploy.ts, docs/near_x402.md's example) now defaults to
FastNear's free public RPC instead; CRED402_NEAR_RPC_URL still overrides.
Updated the one test that asserted the old default.
18/18 Rust unit tests green, cargo clippy -D warnings clean, the sandbox
integration test passes against a real local nearcore node, the live
Testnet bonus loop passes against the real public contract, and the full
TS suite is 450/450 green with a clean typecheck.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Mirrors scripts/algorand_x402_ready.ts and algorand_x402_release_check.ts
for QIE's EVM-based x402 integration: x402:qie:ready fetches live
payer/receiver ERC-20 balances over the configured QIE RPC and reports
readiness; x402:qie:release-check adds the public deployment-status gate
and writes a SHA-256-sealed evidence artifact (same hash-seal mechanism
as the Algorand artifact, no private key). Both fail closed with clear
errors (no guessed RPC URL or contract address) when required env vars
are unset. Closes the "no combined release-check / readiness script yet"
gap tracked in docs/qie_x402.md.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
QIE is EVM-compatible (Cosmos SDK + eth_* JSON-RPC, testnet chain 1983 /
mainnet 1990), so this reuses the existing generic EVM x402 payment path
(same shape as the Flare integration) rather than bespoke chain code:
- lib/x402/qie_networks.ts, qie_rpc.ts, qie_finality.ts, qie_client.ts,
qie_gateway.ts, qie_payment_attempt_store.ts
- api/qie_x402_routes.ts wired into api/server.ts
- scripts/qie_x402_check.ts (readiness/preflight, mirrors x402:algorand:check)
- docs/qie_x402.md + a QIE Hackathon section in docs/SUBMISSIONS.md
Fails closed without CRED402_QIE_PAY_TO / asset / facilitator configured,
same discipline as the Algorand integration. Honest gaps flagged rather
than faked: QUSDC's exact testnet contract address is unconfirmed (falls
back to pricing in native QIE), and a real signed transaction needs a
funded faucet key + live facilitator neither of which exist yet — both
documented as TODO with exact unblock steps in docs/SUBMISSIONS.md.
Track: AI + Autonomous Agents. Deadline: 2026-11-30, with a QIE Mainnet
(chain 1990) contract deployment required at submission, not just
testnet — confirmed via the hackathon's own dashboard + press coverage.
9/9 new tests pass (node:test via tsx --test), typecheck clean.
Adds scripts/record_algorand_x402_demo.mjs (npm run record:algorand) and a
3m20s 1920x1080 recording of the Algorand x402 flow against a real
Mainnet-configured resource server.
Shows the agents and x402 receipts being underwritten, the risk policy and
bureau, then the paid Algorand resource: live deployment metadata, a real
unpaid 402, and all eight PAYMENT-REQUIRED verification rows passing --
x402 v2, single exact option, the full-genesis-hash network id, USDC ASA
31566704, receiver, amount, resource URL, and the x402-global-challenge
tag.
Two recorder details worth keeping: it records into its own directory,
because "some .webm in media/" renames whichever file readdir returns
first, and it pins horizontal scroll, because the 25-tab bar overflows the
viewport and drags content out of frame when a right-hand tab is clicked.
Re-record after the first real Mainnet settlement so the usage panel shows
a finalized receipt instead of a measured zero.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The GoPlausible facilitator writes Global x402 Challenge attribution at
settlement time from accepts[].extra.tag, and never backfills it. It does
not persist the x402 resource.tags array into its Bazaar record: of 200
live Bazaar resources, 176 carry the tag via extra.tag and zero have a
tags field at all.
Cred402 advertised the tag only in resource.tags, so a real Mainnet
payment would have settled, catalogued into the Bazaar, and then been
filed under src=direct -- never reaching the challenge leaderboard.
- move the tag into the accepted option's extra, from a shared
challenge_tag module so server and client cannot drift
- declare the x402-merchant extension so the leaderboard row carries a
name and logo instead of a bare hostname
- reject a challenge missing extra.tag in inspectAlgorandChallenge, which
fails both the preflight and the release gate
- assert it in the gateway test and in both buyer examples
- add x402:algorand:challenge-check, a read-only gate over the status
probe, the Bazaar catalogue and the challenge leaderboard
Attribution is not retroactive, so this has to ship before the first real
payment.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds the five new service calls to all polyglot SDKs (matching the TS SDK):
- Python (_Credit): check, checks, risk_score, data_commons, exposure,
agent_exposure, verticals, vertical
- Go (Client): CreditCheck, CreditChecks, RiskScore, DataCommons, Exposure,
AgentExposure, Verticals, Vertical
- Rust (Cred402Client): credit_check, credit_checks, risk_score, data_commons,
exposure, agent_exposure, verticals, vertical
Bumps MCP tool count 49->54 in ship_first_check.ts; corrects stale 32->54 in
PRODUCTION.md. Go build / cargo build / py_compile all green; TS suite 233 green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Roadmap p2 shipped. The adoption wedge: drop one middleware in front of any route
and it issues 402 challenges, verifies EIP-712/ed25519 payments (replay-protected),
emits a receipt commitment to a sink, and proceeds — feeding the Cred402 credit moat.
- lib/x402/gateway.ts: framework-agnostic X402Gateway + Express and Web (Fetch)
adapters, pluggable nonce store (replay guard), per-route analytics, receipt sink.
- Works for ANY p1 service category (inference/data/compute/…), not just RWA.
- Fix: eip712 uint256 now padded to 32 bytes (odd-length amounts no longer break signing).
- test/x402_gateway.test.ts (5 cases, real buyer→gateway round-trips), examples/paid-api-x402.ts,
npm run demo:gateway, docs/roadmap (p2 ✅). 181 tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Roadmap p1 shipped. Cred402 now underwrites ANY x402 service category, not just
RWA:
- lib/core/service_categories.ts: canonical category taxonomy + per-family
credit-risk weights (rwa/data/compute/inference/storage/api/defi/compliance…),
with legacy-type aliasing.
- ServiceCategoryRegistry (lib/ledger/contracts) — on-chain-style, governance-tunable
weights, seeded defaults, wired into the Ledger.
- ServiceType generalized to an open category string (was a 6-value RWA union).
- Risk policy v1/v2 scale the credit line by the category risk weight; rationale
records it. RWA evidence is now an optional boost, not a gate.
- test/universal_credit.test.ts (5 cases) + npm run demo:x402: a non-RWA
inference.llm agent builds a credit line from x402 receipts alone.
- docs/risk_model.md + docs/roadmap (p1 ✅).
176 tests green; main demo unchanged (legacy RWA types keep the rwa weight).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- media/cred402-demo.mp4: 720p screencast of https://cred402.vercel.app driving the
full loop with the Casper streaming-events feed updating live (proves the
direct-CORS SSE end to end).
- scripts/record_demo.mjs + `npm run record:demo`: Playwright records the live site,
ffmpeg muxes to MP4. Raw .webm is gitignored.
- README: link the demo video.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Rewrite README around the live deployment (console on Vercel, API on Render),
the magic loop, and the real (non-mocked) integrations across p8–p10:
Casper Testnet deploys, x402 + EIP-712, casper-x402 facilitator, Open-Meteo,
official MCP SDK (44 tools), casper-sidecar, Stripe/Plaid RealFi, Base Sepolia,
Casper Wallet connect + sign-in. Accurate counts (14 Odra contracts, 151 tests,
4 SDKs, 20 console tabs) and the contract↔simulation transport seam.
- Pick up concurrent graphql/openapi/sdk/mcp/tests refinements.
Readiness: tsc clean; 151 tests pass; frontend/vite, cargo check, forge build,
and go build all green; console + API both serving 200 in production.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- render.yaml: always-on web service `cred402-api` (node runtime, installs dev
deps so tsx is present, health check /v1/health) — Render runs the long-lived
node:http + SSE server the serverless Vercel deploy can't.
- api/server.ts: honor the platform-provided PORT (Render) before CRED402_PORT.
- frontend/vercel.json: rewrite /api/*, /v1/*, /graphql → https://cred402-api.onrender.com
so the deployed console reaches the backend same-origin (no CORS, no code change).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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>