35 Commits

Author SHA1 Message Date
b26dfadaba docs: fix stale MCP tool count (16 -> 78) in mcp-tools.md
Some checks failed
ci / backend (typecheck · test) (push) Failing after 34s
ci / frontend (build) (push) Failing after 41s
ci / demo loop (smoke) (push) Failing after 36s
ci / odra contracts (fmt · build) (push) Failing after 27s
The docs still listed only the original 16 tools; mcp/tools.ts has grown
to 78 (RealFi/Flare bridge, risk analytics, marketplace, automations).
Found while independently verifying this week's launch-maxxing submissions,
which had propagated the stale "16 tools" claim into live external PRs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-12 01:30:27 +03:00
524f2ddea5 fix(near-hackathon): re-voice false "live on two other chains" claim in pitch demo video
Narration line 2 said Cred402 is "already live on two other chains, and
now native NEAR" — false. Live checks against
cred402-1.onrender.com/v1/x402/{algorand,qie}/status both return
configured:false. The deck was already corrected (4eb21fe); this patches
the video's narration to match.

New line 2: "Cred402 sells credit scores to AI agents over a pay per
call payment protocol, and now it's enforced natively on NEAR." Same
Aura-2 voice (aura-2-asteria-en — re-derived acoustically, since no
voice ID was recorded in the original build: synthesized the real line 1
text in all 5 cataloged voices and compared pitch/spectral-centroid
against the shipped audio; asteria matched an order of magnitude closer
than the next candidate). Same per-line Deepgram nova-3 QC round-trip.

Only the line 2 window (8.9s-17.766s) was touched — confirmed by frame
diff that this whole span is a single static held title card in the
shipped video, so the patch could re-render just that card + new
captions + new audio and splice it between the untouched first 8.9s and
untouched remainder (which includes line 3's unmoved 19.5s start).
Re-transcribed the full final audio with nova-3 to confirm lines 1 and
3-6 are unchanged.

Duration unchanged (70.6s), resolution/fps/codec unchanged (1920x1080,
30fps, h264/aac). Re-mastered loudness: -14.8 LUFS integrated / -1.8
dBTP true peak (both within spec).

Reproducible recipe: media/video-recipe/line2-fix/ (generate_line2_audio.py
-> render_line2_assets.mjs -> build_patch.sh).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-11 02:06:42 +03:00
4eb21fecfe fix(near-hackathon): correct overclaimed Algorand/QIE "live" status in pitch deck
A judging pass found the deck said Cred402 is "already live on Algorand
and QIE." Live checks show otherwise: curl against
cred402-1.onrender.com/v1/x402/{algorand,qie}/status both return
"configured": false right now (pay-to address not set, neither route is
production-live). Corrected slides 4 and 10 of PITCH-DECK.md to state
this honestly and re-exported PDF/PPTX via marp-cli; re-rendered and
visually checked both slides for overflow/contrast after the edit.
Documented the correction and the one known remaining gap (the video's
narration line 2 still carries the old claim, baked into mastered audio,
not re-recorded this pass) in README.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-11 01:32:54 +03:00
b729ff486c docs(near-hackathon): add pitch deck + narrated demo video for NEAR Hackathon submission
13-slide Marp deck (PDF+PPTX) mapping the Agent Economy track brief and
NEAR's stated judging criteria to SpendGuard's real on-chain proof, plus a
70.6s narrated demo video built entirely from real captures: the existing
asciinema-recorded SpendGuard loop, a fresh terminal recording made today
re-verifying the live testnet contract + 450/450 tests, and code-rendered
(Playwright/HTML) title cards. Deepgram Aura-2 narration with per-line ASR
round-trip QC, burned-in word-timed captions, loudness mastered to -14.6
LUFS / -1.9 dBTP true peak. No AI-generated footage; no paid APIs beyond
the existing Deepgram key.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-11 01:16:34 +03:00
f40b54c983 feat(near-spend-guard): close the revolving-credit demo gap with top_up_allowance
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>
2026-11-05 19:33:05 +03:00
8a956d3660 docs(near-spend-guard): architecture writeup + real verification evidence (Day 7, partial) 2026-11-03 05:04:20 +03:00
4fb99d27f7 docs(near-x402): record real NEAR Testnet end-to-end verification + fix stale test counts
Revived cred402 for the NEAR Hackathon per owner override (2026-10-28 retirement
does not apply to this product in this session). Audited the existing NEAR x402
implementation (lib/x402/near_*.ts, api/near_x402_routes.ts) and found it already
complete and correctly wired into api/server.ts — no code bugs found.

Verified live against a running server and the real NEAR Testnet RPC, no protocol
mocking: unpaid request returns a real 402 + PAYMENT-REQUIRED; a tampered proof is
rejected at decode time; a well-formed proof over a never-broadcast tx hash returns
502 indeterminate (intentional fail-safe, documented); a real signed NEAR Transfer
(tx C1LNxQFEaR2AQj79U9WzToiB1eY86jwzmxoHKvr9W7jk) settles for real with finality
confirmations and a verified receipt; replay returns the cached result; a real
underpaid Transfer (G33RhcX5zSMarmkY358ANHcCVpeGGasrNmjgiiruYQdn) is cleanly
rejected on-chain-amount, not just signature-claimed amount. Two disposable NEAR
Testnet accounts were created+funded via the public non-captcha helper API to run
this without any owner credential.

Corrected stale/inaccurate test-count claims in HACKATHON.md, SUBMISSION-CHECKLIST.md,
and README.md: real full suite is 447/450 (3 pre-existing failures in the unrelated
test/mcp_sdk.test.ts stdio handshake, not the x402/NEAR path), not 450/450 or 346.
docs/near_x402.md gets a new Verification section with the real evidence and a
Known Gaps entry explaining the 502-vs-402 design choice for ambiguous RPC timeouts.
2026-11-03 01:44:12 +03:00
7fdc321d79 feat: live-wire Casper writes, add marketing homepage, fix cold-start UX
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.
2026-10-23 19:57:40 +03:00
c80dda9e91 feat(near): add NEAR Hackathon x402 credit-score integration
Adds a third chain-priced rail (alongside the existing Algorand and QIE
integrations, both untouched) for the NEAR Hackathon (Nov 1-14, 2026,
Agent Economy track): GET /v1/x402/near/credit-score/:agentId, settled
in native NEAR on NEAR Testnet.

No @x402/near scheme package exists, so lib/x402/near_gateway.ts is a
from-scratch x402 v2 "exact" scheme built on @x402/core's chain-agnostic
header codecs and types. It needs no third-party facilitator: Cred402
verifies settlement itself directly against the configured NEAR RPC
(lib/x402/near_finality.ts), the same role the Algorand Indexer check and
QIE RPC check play for their chains.

- lib/x402/near_networks.ts, near_rpc.ts, near_finality.ts,
  near_payment_attempt_store.ts, near_gateway.ts: resource server,
  self-verifying settlement, durable exact-once replay protection.
- api/near_x402_routes.ts, api/near_receipt_anchor.ts: HTTP routes
  (status, usage, payment attempts, paid credit score) and Casper-rooted
  receipt anchoring, wired into api/server.ts and api/state.ts.
- examples/near-paid-score/typescript.ts (+ README): a real buyer that
  signs and submits a NEAR Testnet transaction via near-api-js.
- test/near_x402.test.ts: 14 new tests (TDD), full suite 450/450 green,
  typecheck clean.
- docs/near_x402.md, HACKATHON.md, SUBMISSION-CHECKLIST.md: protocol
  writeup (incl. Chain Signatures / NEAR Intents extension points),
  submission guide, and an explicit owner-only checklist (team info,
  payout account, demo video/post, form submission).
2026-10-21 03:11:37 +03:00
b69e6cd414 test: pin per-category risk weights for the x402 service-category registry
Service-category weighting (docs/risk_model.md p1) turns out to already be
fully shipped — categoryRiskMultiplier is wired into both policyV1/policyV2's
credit_line, ServiceCategoryRegistry seeds+governance-tunes the weights, and
demo:x402/universal_credit.test.ts already exercise an inference.llm agent
building a credit line from x402 receipts alone. Add test/service_categories.test.ts
to pin every documented per-family multiplier (rwa/compliance/data/api/compute/
storage/inference/dispute/defi/unknown) exactly, plus registry governance
tuning, so a future weight edit can't silently drift from the design doc.
Update docs/risk_model.md to mark the feature Built (strikethrough, mirroring
docs/qie_x402.md's pattern) instead of "roadmap p1", and note the on-chain
Casper mirror is deliberately deferred — consistent with several other
off-chain-only registries in lib/ledger/contracts/ that have no Rust contract
counterpart.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 19:30:33 +03:00
9b615993fa feat: add QIE readiness + release-check scripts to match Algorand parity
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>
2026-10-19 13:46:48 +03:00
9a1cb7fa15 feat(qie): anchor QIE settlement receipts to Casper
Mirrors the Algorand route's existing anchoring pattern exactly
(api/algorand_receipt_anchor.ts): a settled QIE credit-score payment now
becomes the same Casper-rooted Universal Receipt Envelope used by every
other satellite chain, via a new api/qie_receipt_anchor.ts anchored
provisional (finalize: false) until reconcileQiePayment's own-RPC finality
check confirms it, then finalized or challenged exactly like Algorand's.

- api/qie_receipt_anchor.ts: anchorQieCreditScoreSettlement (idempotent on
  tx hash, refuses conflicting replays), finalizeQieExternalReceipt,
  challengeQieExternalReceipt, qieX402Usage.
- api/state.ts: wires the above through a qieAnchorContext(), reusing the
  existing chain-agnostic externalReceiptProof(receiptId) lookup.
- api/qie_x402_routes.ts: credit-score responses now carry
  external_receipt_id / external_receipt_url / casper_anchor_status;
  reconcileQiePayment finalizes/challenges the receipt alongside recording
  finality; the receipt proof is served by the existing chain-agnostic
  GET /v1/x402/external-receipts/:id route (unchanged, already shared).
- lib/x402/qie_payment_attempt_store.ts: StoredQieSettlement gained
  externalReceiptId, mirroring StoredAlgorandSettlement.

6 new tests (test/qie_receipt_anchor.test.ts) exercise the anchor function
directly against a real Ledger: idempotent replay, conflicting-replay
rejection, finalize/challenge transitions, and usage aggregation. Full
suite stays green: 408/408 tests, typecheck clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 12:53:48 +03:00
bd9004603a feat(qie): add QIE Hackathon 3.0 x402 credit-score integration
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.
2026-10-19 02:43:44 +03:00
52c5c87a1f fix: point frontend config comment at the canonical Render service
frontend/src/lib/config.ts told operators to set VITE_API_BASE to
cred402.onrender.com (no -1) — a stale duplicate Render deploy still
running an old pre-Algorand build. Every other reference in the repo
(render.yaml, README, vercel.json rewrites, docs, examples) already
points at the canonical cred402-1.onrender.com. Fixed the comment and
documented the duplicate-service cleanup (owner-gated, no Render API
token available here) in docs/ACTIVATION_CHECKLIST.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-15 16:34:17 +03:00
1e27326510 fix: keep Render on free and record the Mainnet receiver
The Mainnet durability gate only checks that CRED402_DATA_DIR is set, not
that it is a mounted disk, so the paid path does enable on the free plan.
The facilitator is the system of record for settlements, so Bazaar listing
and leaderboard standing survive a restart either way.

Documents what free actually costs: an ephemeral replay barrier (one spent
proof can replay once per restart, 0.01 USDC), a usage projection that
resets, and cold starts slow enough to time out a buyer -- volume risk,
not eligibility risk.

Also records the generated receiver address. Public by construction: it is
advertised in every 402 challenge header.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 16:04:52 +03:00
9ed2ec319d docs: draft the x402 Global Challenge entry form
Every field the form asks for, minus the two that need a live endpoint: the
leaderboard payTo wallet and a 3-5 minute Algorand x402 demo video. Flags
that neither existing video qualifies (both ~90s, Casper/KeeperHub arcs)
and sketches the shot list to record after activation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 15:59:49 +03:00
e8139bf75c docs: record challenge submission state — blueprint, main merge, Electric Capital PR
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 15:44:44 +03:00
1ff795f53f fix: put the challenge tag where the facilitator actually reads it
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>
2026-09-16 15:35:55 +03:00
d84b5ce983 feat: make pricing/docs status-aware + document paid-endpoint activation
The pricing and docs pages headlined a live, buyable 0.01 USDC endpoint while
the deploy returns 503 (configured:false) — selling a dead product.

- pricing.html: badge/CTA/spec now read GET /v1/x402/algorand/status and render
  'activating', live-testnet, or live-mainnet states; example labeled illustrative;
  JSON-LD availability -> PreOrder until the probe confirms live
- api-docs.html: live-status banner up top so a developer sees on/off before coding
- both degrade gracefully on cold-start/probe failure (never claim live)
- docs/ACTIVATION_CHECKLIST.md: exact owner env checklist to flip the probe to
  configured:true (pay-to, network, facilitator, indexer) + durable CRED402_DATA_DIR
  persistence + mainnet gates
2026-09-06 09:59:44 +03:00
388d482cfc chore: add Apache-2.0 LICENSE (unblocks open-core) + extract http_utils from server god-file 2026-08-25 03:09:55 +03:00
099dd3c97a feat: add production Algorand x402 credit endpoint 2026-08-23 14:18:57 +03:00
24d073ee83 feat: KeeperHub execution layer + Flare interoperable/confidential credit
Two hackathon integrations spanning the whole credit stack, sim-first
(green with no keys) with real integrations behind env flags.

KeeperHub — the on-chain execution & reliability layer (lib/keeperhub/):
- OnchainExecutor: pay-per-execution (x402/MPP) -> simulate -> smart gas
  with exponential backoff -> MEV-protected private routing -> audit trail;
  real MCP client to app.keeperhub.com; deterministic sim fallback.
- Autonomous Credit Keeper: FTSO position health -> check->execute deleverage.
- Credit Automations: declarative price/health/schedule rules as workflows.
- Autonomous Scheduler: KeeperHub-cron loop running keeper + automations.

Flare — interoperable + confidential primitives (packages/.../flare, lib/flare):
- FXRP credit satellite: CAN-gated, FTSO-priced, FDC-attested; Coston2
  Solidity vault (contracts/flare/).
- Confidential Compute credit scoring (TEE-attested, private inputs).
- FTSO-priced multi-asset collateral; FAssets mint->collateralize lifecycle.

x402 Credit-Service Marketplace: sells cred402's intelligence pay-per-call
over x402 (402->pay->200); paid receipts feed the revenue->reputation loop.

Wiring: 78 MCP tools, /v1 + /api routes, console Flare + x402 tabs, 11 demo
CLIs, 8 feature docs + docs/SUBMISSIONS.md, recorded demo video (media/).
346 tests pass; 7 adversarial verification workflows caught + fixed ~37
correctness/security issues.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-11 23:34:23 +03:00
25ed718ad0 feat: p10 service verticals (per-vertical underwriting profiles)
ServiceVerticals makes each x402 family a first-class credit vertical with its
own underwriting profile: advance rate, revenue-volatility haircut, settlement
horizon, minimum track record, and required attestations. profileFor() resolves
a service type to its vertical; qualify() gates eligibility; sizeAdvance()
fronts revenue × advance_rate × (1 − volatility); register() lets governance
tune profiles. Seeded for all p1 category families (coverage-checked).

7 new tests, full suite 233 green. Completes roadmap p3–p10.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:45:42 +03:00
55012ad463 feat: p9 Enterprise RealFi GA (tenants, entitlements, audit trail)
EnterpriseRealFi adds the production access-control layer in front of the
oracle / data commons / attestation surfaces: named tenants on plans
(developer/growth/enterprise) with entitlement gating, a rolling 30-day quota,
a trailing 60s rate limit, suspend/resume, and a sequential, exportable audit
trail recording every allow/deny decision. guard() wraps authorize-then-run.

8 new tests, full suite 226 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:43:56 +03:00
19d6549230 feat: p8 zk receipt proofs (selective disclosure + Merkle anchoring)
ReceiptProofSystem lets an agent prove a receipt is anchored on-chain and
disclose only chosen fields while hiding the rest. Each attribute is a
secret-salted hiding commitment H(key=value|salt); receipt leaves form a
Merkle tree whose root is the on-chain anchor; a DisclosureProof opens the
revealed fields, ships opaque commitments for the rest, and a Merkle path.
verify() needs no prover secret — anyone can check inclusion from the root.

Honest scope: commitment-based selective-disclosure + membership (the
dependency-free, Casper-verifiable Stage-4 primitive), not a full zk-SNARK.

6 new tests, full suite 218 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:42:03 +03:00
295f975d5a feat: p7 ML risk-engine v2 (learned probability-of-default model)
RiskEngineV2 adds a logistic-regression PD model over a normalized agent
feature vector (reputation, accuracy, dispute rate, experience, revenue,
stake, category risk). train() fits weights by deterministic, L2-regularized
batch gradient descent on realized default/repay outcomes; score() returns
pd + ml_score + rules_score + a convex blended_score, so v2 augments the v1
rules policy rather than replacing it. A domain-calibrated prior makes it
useful before any training data.

5 new tests, full suite 212 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:39:55 +03:00
8696d265ad feat: p6 decentralization & data moat (dispute jury + credit-data commons)
DisputeJury: a deterministic, dispute-id-rooted panel of staked/reputable
agents votes the verdict; the plurality decision is issued on the DisputeCourt
with the median proposed slash, consensus jurors earn reputation and
dissenters/no-shows lose it. Decentralizes verdict authority off the single
judge agent.

CreditDataCommons: anonymized, k-anonymous public snapshot of protocol credit
performance (per-category + per-tier aggregates, dispute slash rate, no agent
ids, thin categories folded into 'other') — the data moat as a citable public
benchmark.

DAO parameter governance already shipped via GovernanceProposals.

9 new tests, full suite 207 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:37:39 +03:00
a59d2bfe5d feat: p5 omnichain credit reconciliation (satellites ↔ Casper exposure)
CrossChainReconciler ties satellite-reported draws/repayments back to the
Casper-rooted GlobalExposureManager (single source of truth for global
exposure across all chains). reconcile() flags the over-borrow failure mode,
Casper-vs-satellite divergence, and unauthorized draws (no issuing CAN);
globalHeadroom() is the per-agent over-borrow guard satellites must respect.

7 new tests, full suite 198 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:33:33 +03:00
81a0e533ed feat(p4): mainnet-beta market risk — exposure caps + insurance loss absorption
lib/services/market_risk.ts: MarketRiskManager gates every draw (per-agent +
per-category + pool-utilization caps, approved-category allowlist for the beta)
and absorbs default losses from the insurance reserve with honest shortfall
reporting + coverage ratio. test/market_risk.test.ts (5). Suite green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:29:19 +03:00
deed9725d7 feat(p3): Credit Oracle — Cred402 Inside (credit-as-a-service)
lib/services/credit_oracle.ts: read-only creditCheck (policy-stamped), what-if
simulate, and batch checks so any third-party x402 platform queries Cred402 for
agent creditworthiness and gets the same Casper-rooted answer — works for non-RWA
services. test/credit_oracle.test.ts (5). 186 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:26:49 +03:00
afed64e4bd feat(p2): x402 Gateway middleware — any API becomes x402-payable + receipt-generating
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>
2026-06-17 17:20:46 +03:00
0813724602 feat(p1): universal x402 receipts — credit for any service, not just RWA
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>
2026-06-17 17:09:02 +03:00
c93c35f07c docs(roadmap): reframe as the credit protocol for the x402 economy + phase plan
Cred402 is the credit & reputation layer for ALL x402 services — RWA verification
is the first wedge, not the whole product. Add docs/roadmap/ with the forward
phase plan (p1–p6): universal x402 receipts, the x402 Gateway wedge,
credit-as-a-service, mainnet-beta credit market, omnichain credit, and
decentralization + the data moat. Broaden README positioning + link the roadmap.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 03:00:14 +03:00
2d43618725 feat: real integrations (Casper Testnet, x402/EIP-712, MCP, RealFi, cross-chain), wallet sign-in, branding
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>
2026-06-17 00:37:36 +03:00
f1e4bb712e first 2026-06-16 02:50:52 +03:00