cred402/README.md
caelum0x b8b4101382
Some checks failed
ci / backend (typecheck · test) (push) Failing after 35s
ci / frontend (build) (push) Failing after 32s
ci / demo loop (smoke) (push) Failing after 44s
ci / odra contracts (fmt · build) (push) Failing after 39s
docs: cross-link Scribase/Toolgate ecosystem (Rithub discoverability pass, 2026-11-16)
2026-11-16 14:35:24 +00:00

416 lines
26 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div align="center">
<img src="frontend/public/cred402-mark.png" alt="Cred402" width="120" />
# Cred402 — credit scores for autonomous AI agents, across every chain
**Agents earn on any chain. Cred402 decides who is creditworthy.**
[**🌐 Live console**](https://cred402.vercel.app) · [**⚙️ Live API**](https://cred402-1.onrender.com/v1/health) · [**🎬 Demo video**](media/cred402-demo.mp4) · [**🗺️ Roadmap**](docs/roadmap/) · [Architecture](docs/architecture.md) · [Risk model](docs/risk_model.md) · [x402 flow](docs/x402_flow.md)
</div>
---
> **Cred402 is the multi-chain credit & reputation protocol for the x402 economy —
> an extension of x402 that spans blockchains, not a single-chain product.**
> Every x402 payment is a verifiable machine-to-machine cash-flow event. Cred402
> ingests x402 receipts from **any chain** — **Casper, Algorand, and EVM networks**
> today, extensible to any x402-compatible chain — and turns them, for **any** paid
> agent service (data, compute, inference, storage, APIs, RWA verification), into
> on-chain reputation and DeFi credit. The payment and receipt layer is
> chain-agnostic; Casper anchors the canonical identity, reputation, and credit-policy root.
DeFi was built for wallets. Cred402 is built for **workers**: it turns agents from
tools into financeable economic actors. Identity → payment rails → reputation →
working capital. **RWA verification is the first wedge, not the whole product** —
the same loop underwrites any agent that earns through x402. See the
[roadmap](docs/roadmap/) for how Cred402 generalizes into the universal x402 credit layer.
## 🏆 Hackathon submissions — KeeperHub × Flare
Cred402's agents now **execute on-chain through KeeperHub** (the last mile) and use **Flare's**
interoperable + confidential primitives (FXRP · FTSO · FDC · Confidential Compute). Nine features,
one arc: earn → confidential score → FXRP credit via KeeperHub → FTSO position health → autonomous
keeper → credit automations → multi-asset collateral → FAssets mint → x402 service marketplace →
autonomous scheduler.
- **Demo video:** [`media/cred402-hackathon-demo.mp4`](media/cred402-hackathon-demo.mp4) · regenerate with `npm run record:hackathon`
- **Submission packets + readiness:** [`docs/SUBMISSIONS.md`](docs/SUBMISSIONS.md) · `npm run submit:check`
- **Run the whole story:** `npm run demo:grand` · **Docs:** [KeeperHub](docs/keeperhub_integration.md) · [Flare](docs/flare_integration.md) · [keeper](docs/credit_keeper.md) · [automations](docs/credit_automations.md) · [collateral](docs/collateral.md) · [x402 marketplace](docs/x402_marketplace.md) · [FAssets](docs/fassets.md) · [scheduler](docs/scheduler.md)
![Cred402 KeeperHub × Flare console](media/cred402-hackathon-poster.png)
## Algorand Global x402 Challenge
Cred402 exposes its credit oracle as a standards-compatible, Bazaar-discoverable
Algorand x402 v2 resource:
```text
GET /v1/x402/credit-score/:agentId
price: 0.01 USDC
network: Algorand Testnet or Mainnet (environment-selected)
facilitator: https://facilitator.goplausible.xyz
tag: x402-global-challenge (accepts[].extra.tag — the attribution channel)
```
The paid response combines the existing policy score, ML probability of default,
eligibility and reason codes, verified x402 revenue, and underwriting provenance.
Configure `CRED402_ALGORAND_PAY_TO` and the Algorand variables in
[`.env.example`](.env.example); see [the integration guide](docs/algorand_x402.md)
for Testnet and Mainnet rollout, and the
[challenge submission packet](docs/X402_GLOBAL_CHALLENGE.md) for the requirement
status and the ordered activation runbook. `npm run x402:algorand:challenge-check`
verifies the live deployment, the Bazaar catalogue entry, and leaderboard
attribution without signing or paying anything. Copyable
[TypeScript and Python consumers](examples/algorand-paid-score/) show the full
`402 → approval → payment retry → settlement proof → finalized usage receipt`
path against the public endpoint. The console's dedicated **Algorand x402** tab
stays available when `/api/state` is unavailable, accepts any typed agent ID,
and treats API agent IDs as suggestions. It reads
[`/v1/x402/algorand/status`](https://cred402-1.onrender.com/v1/x402/algorand/status)
and [`/v1/x402/algorand/usage`](https://cred402-1.onrender.com/v1/x402/algorand/usage)
independently, with separate retries and a manual finalized-receipt refresh.
The browser decodes the live `PAYMENT-REQUIRED` header and validates its version,
single exact option, network, USDC ASA, receiver, price, resource URL, and tag.
It does not read a private key or pay; the terminal consumers own approval,
signing, retry, settlement, and proof verification.
The paid route uses a durable exact-once attempt ledger: it stores a digest, not
the raw `PAYMENT-SIGNATURE`, and replays the same paid response after safe retries
or restarts. Facilitator success produces a provisional receipt; an independent
Algorand Indexer check must match sender, receiver, ASA, amount, and the configured
confirmation depth before revenue or reputation is finalized. Opaque attempt
status and an operator refund-review queue cover timeout, mismatch, and sustained
not-found outcomes. Mainnet also requires persistent storage, aligned runtime and
network tiers, pinned HTTPS endpoints, and a deliberate real-USDC release
acknowledgement.
## QIE Blockchain Hackathon 3.0
Cred402 exposes a second chain-priced credit-score resource for QIE's
"AI & Autonomous Agents" track (`hackathon.qie.digital`, build period through
2026-11-30):
```text
GET /v1/x402/qie/credit-score/:agentId
network: QIE Testnet (eip155:1983) or Mainnet (eip155:1990)
scheme: x402 v2 exact (EIP-3009), via @x402/core + @x402/evm
```
QIE is EVM-compatible, so this reuses the same generic `@x402/core`
resource-server plumbing the Algorand integration uses — only the registered
scheme (`ExactEvmScheme`) and network differ. Configure
`CRED402_QIE_PAY_TO`, `CRED402_QIE_ASSET_ADDRESS` (QIE's QUSDC stablecoin
contract, once confirmed — no address is hardcoded), and
`CRED402_QIE_FACILITATOR_URL` in [`.env.example`](.env.example); without them
the route fails closed with `503`. `npm run x402:qie:check` verifies the live
unpaid challenge without signing or paying anything. See
[the integration guide](docs/qie_x402.md) for configuration, independent
on-chain finality via QIE's own RPC, and the documented gaps vs. the
Algorand integration.
## NEAR Hackathon — Cred402: SpendGuard + Audit Anchor (Nov 1-14, 2026)
**One submission, two NEAR components, one story:** Cred402 gives AI agents
credit and a protocol-enforced spending limit (**SpendGuard**), and every
agent spend decision is journaled into a real, hash-chained audit trail
whose tip is anchored on NEAR (**Audit Anchor**, originally built in the
companion project Ration and now vendored into this repo), so a
counterparty can independently verify **both** the limit and the history
on one chain, without trusting Cred402's own database for either claim.
Cred402 also exposes a third chain-priced credit-score resource, settled in
native NEAR, for the **Agent Economy** track at `nearhackathon.com`:
```text
GET /v1/x402/near/credit-score/:agentId
network: NEAR Testnet (near:testnet) or Mainnet (near:mainnet)
scheme: x402 v2 exact, native NEAR, self-verified (no facilitator)
```
NEAR has no `@x402/near` scheme package, so this is a from-scratch `exact`
scheme over `@x402/core`'s generic header codecs — and it needs no
third-party facilitator at all: Cred402 verifies settlement itself,
directly against the configured NEAR RPC. Configure `CRED402_NEAR_PAY_TO`
in [`.env.example`](.env.example); without it the route fails closed with
`503`. See [`HACKATHON.md`](HACKATHON.md) for the submission writeup and
run-it-yourself steps, [`docs/near_x402.md`](docs/near_x402.md) for the
protocol/architecture, and
[`examples/near-paid-score/`](examples/near-paid-score/) for a real
NEAR-Testnet buyer.
### SpendGuard (`contracts-near/spend_guard`)
A real NEAR smart contract that turns an agent's verified x402 revenue
into a protocol-enforced spending limit: nearcore itself caps spend via a
Function Call Access Key allowance, not just an app-level check. Deployed
live on NEAR Testnet (`spendguard-024e8dd6f7.testnet`): 25+ real on-chain
spends, a real repay, a real top-up that re-mints the same key with
restored headroom, one more real spend past the original allowance, then
a dispute-spike circuit breaker that freezes the key — nearcore itself
then rejects the frozen key's next call. 18/18 Rust unit tests.
### Audit Anchor (`ration-anchor/`)
**Ration audit anchor, now part of Cred402.** Ration (a separate agent
spend-control product by the same author,
[github.com/caelum0x/ration](https://github.com/caelum0x/ration)) runs AI
agents inside a deterministic spending envelope and journals every
decision into a real append-only, hash-chained audit trail. That work —
the on-chain `audit_anchor` contract, a hand-rolled Go NEAR transaction
signer (no maintained Go NEAR SDK exists, cross-checked byte-for-byte
against the real `near-api-js` reference implementation), the anchoring
service, its tests, and the recorded demo — is vendored into this repo
at [`ration-anchor/`](ration-anchor/) as a first-class component of this
single Cred402 submission. Deployed live on NEAR Testnet
(`ration-anchor-286ca315f1.testnet`); a real deliberate replay attempt is
mechanically rejected by nearcore itself, not just by application code.
15/15 Go tests green (`go test ./... -race`). See
[`ration-anchor/README.md`](ration-anchor/README.md) for the full
provenance note and how it fits SpendGuard.
Together: SpendGuard enforces **how much** an agent may spend (the
limit); Audit Anchor proves **why** it spent, tamper-evidently (the
history). Both are testnet-only — this submission makes no mainnet
claims, and Cred402 is not claimed "live" on any chain other than Casper
Testnet (see `HACKATHON.md`'s overclaim-correction history, commit
`524f2dd`, for why this wording is deliberate).
## Live deployment
| Surface | URL | Stack |
| ------- | --- | ----- |
| **Console** | https://cred402.vercel.app | Vite + React on Vercel |
| **API** | https://cred402-1.onrender.com | `node:http` + SSE on Render |
| **Repo** | https://github.com/caelum0x/cred402 | monorepo (TS · Rust · Go · Solidity · Python) |
The console proxies `/api` + `/v1` to the API (same-origin via Vercel rewrites). The Render free instance cold-starts (~50 s) after idle.
The **On-Chain** tab makes protocol activity observable: it renders the live
contract registry (real hashes, each linked to [cspr.live](https://testnet.cspr.live)
for both the contract page and the exact **install deploy transaction**), the real
on-chain deploy transactions we made (`deploys.transactions.json`, pulled from
cspr.live), the deployer account, per-contract event counts, and a
filterable/​pausable event stream. Powered by `GET /api/chain` (the deployment
manifest with explorer + deploy-tx links) and `GET /api/export/events.csv` (the
full on-chain event log).
### Casper Testnet contracts (live, on-chain)
Deployed as real Odra (Rust→Wasm) contracts on **casper-test** (Casper 2.0) via the
Odra livenet deployer. Deployer account `01327e5e…1ae9`. Full manifest in
[`deploys.testnet.json`](deploys.testnet.json); browse on [cspr.live](https://testnet.cspr.live).
All **14** Odra contracts deployed live:
| Contract | Casper Testnet contract hash |
| -------- | ---------------------------- |
| AgentRegistry | `hash-e6312b89e68be91df3472a07feac489371ac542bd1e322ea2a79af1fb5f260f1` |
| AgentPassport | `hash-ee749fb49e2ff5decd80cfe35fa15df15c8cdc8e34e61f3142889404ca58e228` |
| X402ReceiptRegistry | `hash-769ad110c9e53d1de7b9813a3ae3c6b4190e7d7c427efc287533362e71351a89` |
| RWAAssetRegistry | `hash-6745f7278c0140a2e6fe3504f8e4f800b37605599516b8719b92a97dd756f7ae` |
| RWAEvidenceRegistry | `hash-2a51bdd7522538f592242f77b168f09e2e7d363d0904f9cb9910e8223400b3b6` |
| ReputationEngine | `hash-70ff456a864d4d14824c08f90a737dd82dba68647032d82fdddcf4c8304761ad` |
| AgentCreditPool | `hash-c7515e5a824a54adf4b49f8088ddc58844b1fb04ce43055f99f7e55adf88700c` |
| RiskPolicyManager | `hash-606e01827d5de2dd8e128c669fbb17d9e3165bd2817ce310303c65fe22d3a3e5` |
| DisputeCourt | `hash-f1de44616664a99bb5fe7f79af4638125a042a4b6c6a9f0ce56b05c0f0dc5fed` |
| SlashingVault | `hash-c407bcbbba74cce139926d8ead4c6b9b0d4cb7f07ca4dfb996854ae347c25f24` |
| Governance | `hash-72c3a450c2f33ec2bf24c3ecb13ba89f6becb2ce16989dd73e27aa278ecbc353` |
| FiatReceiptRegistry | `hash-9a33ce9d7c42028e99f21368d741f7d8629aa156a6100843db5d341764ad3ed8` |
| OperatorVerificationRegistry | `hash-b2aa060be4a3f9de30420cdc85806f6bc16a739218abdc1b25edb169ee0447bb` |
| RealFiAttestationRegistry | `hash-147615c028e84a681c7f69b3aac1f0ffe0a27126059b395683caaa130a1c3c37` |
Build + deploy: `cd contracts && cargo odra build`, then the Odra livenet deployer
(`contracts/deploy_all_testnet.sh`) with a funded `casper-test` key.
## The magic loop
```
1. RWA protocol needs evidence. 6. Reputation improves if the report holds up.
2. Agent buys paid data via x402. 7. Cred402 raises the agent's credit line.
3. Agent produces a verification report. 8. DeFi lenders finance future work.
4. Receipt + evidence anchored on Casper. 9. More agents join to earn, borrow, build rep.
5. Agent earns revenue.
```
`npm run demo` runs this loop end-to-end in your terminal; the live console shows it with real on-chain state.
## What's real (not mocked)
Cred402 ships real integrations behind environment flags — with sim / free-API fallbacks so the demo and the **346-test suite** run on any machine with no keys.
| Rail | Real integration |
| ---- | ---------------- |
| **Casper Testnet** | Byte-exact Casper 2.0 deploys + WASM install via `casper-js-sdk`; live node reads (`node.testnet.casper.network`). `CRED402_CHAIN=sim\|testnet`. |
| **x402 payments** | Real `402 → sign → 200` flow with **EIP-712 typed-data digests** (`@casper-ecosystem/casper-eip-712`); optional `make-software/casper-x402` facilitator settlement (x402 V2). A **Credit-Service Marketplace** sells Cred402's intelligence pay-per-call over `/x402/services/:id`. The Algorand route `/v1/x402/credit-score/:agentId` uses official `@x402/core` + `@x402/avm`, GoPlausible settlement, USDC, and Bazaar discovery. The QIE route `/v1/x402/qie/credit-score/:agentId` uses `@x402/core` + `@x402/evm` (`eip155:1983`/`1990`), a configured EVM facilitator, and independent RPC-based settlement finality — fails closed (`503`) until its asset contract and facilitator are configured. The NEAR route `/v1/x402/near/credit-score/:agentId` is a from-scratch `exact` scheme over `@x402/core`'s generic codecs, settled in native NEAR with **no facilitator** — Cred402 verifies the payer's transaction itself against the configured NEAR RPC. |
| **RWA data** | Live solar GHI from **Open-Meteo** (free, no key) + a real PV physics model — never random mock data. |
| **MCP** | 78-tool server over both a zero-dep stdio transport and the official `@modelcontextprotocol/sdk` (Claude Desktop / MCP Inspector) — incl. the KeeperHub, Flare, keeper, automations, collateral, marketplace, FAssets + scheduler tools. |
| **Event feed** | `casper-network/casper-sidecar` SSE `/events` client (faithful framing, contract-message extraction). |
| **RealFi** | Real **Stripe** test-mode webhooks (HMAC-verified) + **Plaid** sandbox → privacy-preserving on-chain envelopes (zero PII on-chain). |
| **Cross-chain** | EVM satellite compiles + deploys to **Base Sepolia** via Foundry; relayer anchors receipts back to Casper. |
| **Flare** | **Flare** satellite lends the FAsset **FXRP** against a Casper CAN, priced by the live **FTSO** XRP/USD feed, with **FDC** attesting the cross-chain payment; **Confidential Compute** (TEE) scores agents privately. An **Autonomous Credit Keeper** marks each FXRP position to FTSO and auto-deleverages a margin call, and agents can post **FTSO-priced multi-asset collateral** (BTC/ETH/USDC/XRP/FLR, LTV-haircut) to expand borrowing power. Coston2-deployable (`contracts/flare/`). `FLARE_RPC_URL`. |
| **KeeperHub** | Agents decide, **KeeperHub** executes: real KeeperHub **MCP** server (`app.keeperhub.com/mcp`) drives on-chain execution — preflight simulate → smart gas w/ backoff → private routing → audit trail, paid per-execution over **x402/MPP**. The keeper runs KeeperHub's **check → execute** pattern on live credit risk, **Credit Automations** register declarative price/health/schedule rules as KeeperHub workflows (cron), and an **Autonomous Scheduler** runs the keeper + automations unattended on a cadence. `KEEPERHUB_API_KEY`. |
| **Wallet** | Real **Casper Wallet** extension connect + sign-in (challenge → ed25519 → session, `/v1/auth/wallet/*`). |
All third-party code is documented in [`THIRD_PARTY.md`](THIRD_PARTY.md); the protocol logic is original.
## Quickstart
**One command, zero config:**
```bash
docker compose up --build # http://localhost:4021/ — sim mode, no env vars required
# or, without Docker:
./scripts/bootstrap.sh # installs deps, starts API + console, seeds a demo loop
```
Both give you a running console with a seeded demo agent in under 5 minutes
with nothing to configure. The manual path (more control, separate
terminals) still works too:
```bash
npm install
# Run the whole loop in your terminal (no server, no keys):
npm run demo # honest happy path
npm run demo:dispute # falsified evidence → watchdog slashing
npm run demo:multichain # Casper-rooted borrow across Base + Osmosis + Solana
npm run demo:realfi # Stripe/Plaid fiat receipts, zero PII on-chain
# Run the live system + dashboard:
npm run start # API + x402 on :4021 (terminal 1)
cd frontend && npm install && npm run dev # console on :5173 (terminal 2)
# Prove the real flows:
npm run casper:health # live Casper 2.0 Testnet read
npx tsx scripts/x402_client.ts energy_output # real 402 → EIP-712 sign → 200
npm run mcp:sdk # official MCP server (Claude Desktop)
npm run casper:sidecar # stream a live Casper Sidecar (set CRED402_SIDECAR_URL)
# Quality gates:
npm test # 450 cases, node:test (450 pass; see HACKATHON.md)
npm run typecheck
```
Single-origin production-style run (API serves the built console):
```bash
cd frontend && npm install && npm run build && cd ..
npm run start # console now at http://localhost:4021/
```
See [`.env.example`](.env.example) for every key; nothing is committed and each real integration activates only when its keys are present.
## Architecture
```
cred402/
contracts/
casper Odra (Rust→Wasm) ×14 AgentRegistry · AgentPassport · X402ReceiptRegistry
RWAAssetRegistry · RWAEvidenceRegistry · ReputationEngine
AgentCreditPool · RiskPolicyManager · DisputeCourt
SlashingVault · Governance · FiatReceiptRegistry
OperatorVerificationRegistry · RealFiAttestationRegistry
evm/ solana/ cosmos/ move/ bitcoin/ satellite contracts (Casper-rooted, chain-executed)
lib/
casper/ casper-js-sdk deploy signer + WASM installer + Sidecar SSE client (p8/p9)
x402/ ed25519 identities, 402 flow, real EIP-712 digests, facilitator client
realfi/ Stripe webhook + Plaid sandbox → hashed on-chain envelopes (p10)
ledger/ faithful in-memory mirror of every contract (the sim transport seam)
services/ fraud graph, credit bureau analytics, wallet auth, marketplace, …
gateway/ auth, rate-limit, validation, idempotency, webhooks, persistence
compliance/ sanctions + jurisdiction + KYB + data-retention
agents/ Buyer · EvidenceSeller · Credit · Treasury · Watchdog · DisputeJudge · LiquidityRouter
api/ node:http server — REST /api + production /v1 + GraphQL + SSE + x402
mcp/ 44-tool MCP server (stdio + official SDK transports)
sdk/ TypeScript · Python · Go · Rust clients
frontend/ Vite + React console — 20 tabs + live event feed + Casper Wallet
crosschain/ CAID/ABE/URE/UAID/EAE/CAN standards, relayers, proof service, trust ladder
services/ Go event-indexer · Python risk-engine · agent-orchestrator · notifications
infra/ Dockerfile, docker-compose, Helm chart, Terraform
docs/ architecture · risk_model · x402_flow · p8/p9/p10 (real-integration phases)
```
**Casper-rooted, chain-executed:** an agent earns x402 revenue on any chain, the receipt anchors to Casper, reputation settles on Casper, and a satellite vault may lend **only** against a Casper-signed Credit Authorization Note within the agent's global exposure cap (the cross-chain over-borrow guard). See [`PRODUCTION.md`](PRODUCTION.md) and [`ROADMAP.md`](ROADMAP.md).
### Contract ↔ simulation parity
`lib/ledger/` is a faithful in-memory mirror of the Odra contracts — same state, methods, and events — so the full agent economy is reproducible with no node or key. Going live is a **transport swap**: `CRED402_CHAIN=testnet` routes writes through the real `casper-js-sdk` signer (`lib/casper/`), verified against the live Casper 2.0 Testnet.
## Risk model
```
base_limit = 0.30 × last_30d_x402_revenue
credit_line = base_limit × stake_multiplier × dispute_penalty × accuracy_multiplier
```
The `RiskPolicyManager` is **upgradable**: the policy hot-swaps v1 → v2 (adds a throughput bonus, harsher dispute penalty) without redeploying the pool or registries — a core reason Cred402 lives on Casper. Every credit decision carries structured, judge-friendly **reason codes**. Full detail in [`docs/risk_model.md`](docs/risk_model.md).
## Casper-native building blocks
| Building block | Where in Cred402 |
| -------------- | ---------------- |
| Account abstraction | every agent owns an ed25519 identity (`lib/x402/keys.ts`) |
| x402 micropayments | real `402 → proof → report` (`lib/x402`, `api/paid_evidence_server`) |
| casper-eip-712 | real EIP-712 typed-data `PaymentAuthorization` digests (`lib/x402/eip712.ts`) |
| Upgradable contracts | `RiskPolicyManager` swaps policy without redeploying the pool |
| Streaming events | in-process bus → SSE → dashboard + WatchdogAgent; live Sidecar feed (`lib/casper/sidecar.ts`) |
| Odra (Rust→Wasm) | 14 contracts in `contracts/` |
| MCP + Casper Wallet | 44-tool MCP server; real wallet connect + sign-in |
## Integrations — sits on top of your payment rail
Already using Skyfire, Nevermined, or raw Coinbase x402 to pay agents?
cred402 doesn't compete with those — it's the underwriting layer none of
them have. One plain, scoped/rate-limited call,
`GET /v1/credit-score/:agentId` (no x402 paywall of its own), turns
whatever payment history an agent already has into a real credit decision.
Runnable samples per rail: [`docs/integrations/`](docs/integrations/README.md).
## Security
- **No secrets in source** — env-driven, validated and fail-fast at boot; `.env` gitignored.
- **AuthN/Z** — scoped API keys (SHA-256 at rest, constant-time verify); wallet sign-in via ed25519 challenge/response.
- **Multi-tenant orgs** — every paying integrator gets one org (`POST /v1/orgs`, admin-onboarded once); from then on it's self-service (`/v1/orgs/me`, `/v1/orgs/keys`) — a key can mint sibling keys only up to its own scopes and can only ever see or revoke credentials inside its own org, even with a valid key.
- **Replay protection** — nonce + payment-proof dedupe on x402 receipts; one-time CANs; global exposure cap.
- **Privacy** — no PII on-chain; Stripe/Plaid data committed only as hashes.
- **Accountability** — WatchdogAgent → DisputeCourt → SlashingVault; fraud graph gates underwriting.
See [`SECURITY.md`](SECURITY.md). This is hackathon/research software — do not use with real funds or real KYC/lending without an audit.
## Demo video
A screen recording of the **live** console driving the full loop — agents, x402
receipts, RWA evidence, credit pool, RealFi, and the Casper streaming-events feed
updating in real time.
<div align="center">
<video src="https://github.com/caelum0x/cred402/raw/main/media/cred402-demo.mp4" controls muted width="800"></video>
[![Watch the Cred402 demo](media/cred402-demo-poster.png)](https://github.com/caelum0x/cred402/raw/main/media/cred402-demo.mp4)
*▶ [Watch the 48-second demo](https://github.com/caelum0x/cred402/raw/main/media/cred402-demo.mp4) — or [`media/cred402-demo.mp4`](media/cred402-demo.mp4)*
</div>
Regenerate it any time with `npm run record:demo` (Playwright records the live
site → ffmpeg muxes to MP4).
## Demo in 90 seconds
A tokenized solar farm (SPV #A17, İzmir) wants a DeFi credit line. Autonomous agents verify production, weather risk and receivable quality; Cred402 pays them through x402, records their work on Casper, scores their reliability, and extends working-capital credit to the best performers — then `npm run demo:dispute` shows a falsified report getting caught, disputed, and slashed. Script: [`docs/demo_script.md`](docs/demo_script.md).
## License
Apache-2.0 — see [`LICENSE`](LICENSE). The permissive patent grant is
deliberate: Cred402 is an open-core protocol meant to be implemented by others,
and the explicit grant reassures enterprise adopters and fellow implementers.
Built for the Casper Innovation Track (Agentic AI × DeFi × RWA).
## More from this account
- [Scribase](https://scribase.com) — hosted Postgres, one backend instead of stitching together Supabase + Neon + Clerk + Resend
- [Toolgate](https://toolgate.scribase.com) — one key for agent tools, pay only for what you call
- All repos: [git.ereboslab.com/caelum0x](https://git.ereboslab.com/caelum0x)