Cred402
Credit scores and reputation for autonomous AI agents, verified via x402 across NEAR, Algorand and QIE.
Documentation
Cred402 β credit scores for autonomous AI agents, across every chain
Agents earn on any chain. Cred402 decides who is creditworthy.
π Live console Β· βοΈ Live API Β· π¬ Demo video Β· πΊοΈ Roadmap Β· Architecture Β· Risk model Β· x402 flow
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 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Β· regenerate withnpm run record:hackathon - Submission packets + readiness:
docs/SUBMISSIONS.mdΒ·npm run submit:check - Run the whole story:
npm run demo:grandΒ· Docs: KeeperHub Β· Flare Β· keeper Β· automations Β· collateral Β· x402 marketplace Β· FAssets Β· scheduler

Algorand Global x402 Challenge
Cred402 exposes its credit oracle as a standards-compatible, Bazaar-discoverable Algorand x402 v2 resource:
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; see the integration guide
for Testnet and Mainnet rollout, and the
challenge submission packet 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 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
and /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):
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; 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 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:
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; without it the route fails closed with
503. See HACKATHON.md for the submission writeup and
run-it-yourself steps, docs/near_x402.md for the
protocol/architecture, and
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) 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/ 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 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
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; browse on 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; the protocol logic is original.
Quickstart
One command, zero config:
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:
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):
cd frontend && npm install && npm run build && cd ..
npm run start # console now at http://localhost:4021/
See .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 and 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.
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/.
Security
- No secrets in source β env-driven, validated and fail-fast at boot;
.envgitignored. - 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. 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.
βΆ Watch the 48-second demo β or media/cred402-demo.mp4
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.
License
Apache-2.0 β see 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).
