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.
265 lines
16 KiB
Markdown
265 lines
16 KiB
Markdown
# Build log — 2026-10-23
|
|
|
|
Rounds of real, end-to-end feature work against the 15-item backlog in
|
|
STRATEGY-2026-10-23.md. Each round appends below; nothing here is a stub —
|
|
every claim was run against a live local server (or the real Casper Testnet
|
|
RPC) and verified before being written down.
|
|
|
|
## Round 1
|
|
|
|
### 1. Casper live write path — wired and verified against the real Testnet node
|
|
|
|
`lib/casper/factory.ts`, `lib/casper/sdk_signer.ts`, `lib/casper/transport.ts`
|
|
already existed but `api/state.ts` never called them — every write
|
|
(`register_agent`/`stake`/`set_credit_score`/`deposit_liquidity`) only ever
|
|
touched the in-memory `Ledger` twin. Fixed:
|
|
|
|
- **New `lib/casper/live_bridge.ts`** — `CasperLiveBridge`, a process-wide
|
|
singleton that mirrors the four explicit, user-triggered write actions onto
|
|
the real, already-installed `deploys.testnet.json` contracts
|
|
(`AgentRegistry`, `AgentCreditPool`) using the existing `CasperSdkDeploySigner`
|
|
+ `CasperRpcTransport`. Deliberately does **not** mirror the background
|
|
economy-tick simulation (hundreds of events/sec in demo scenes) — only the
|
|
API-triggered mutation points (`mRegisterAgent`, `mStake`, `mDeposit` in
|
|
`api/state.ts`, the public `POST /v1/agents` route, and the fire-and-forget
|
|
`set_credit_score` call inside `CreditAgent.underwrite`) — so a funded key
|
|
is never spammed into rate-limiting.
|
|
- **`lib/casper/factory.ts`** extended to read `CRED402_CASPER_NODE_URL` /
|
|
`CRED402_CASPER_SECRET_KEY_PEM` (PEM contents directly, for a one-env-var
|
|
Render deploy) in addition to the existing `CRED402_NODE` /
|
|
`CRED402_SECRET_KEY` (file path) pair; live mode now auto-enables once both
|
|
are present, no separate `CRED402_CHAIN=testnet` flag needed.
|
|
- Every mirror attempt is logged in-process and exposed at
|
|
`GET /v1/casper/live` (configured?, node reachable?, recent register/
|
|
stake/score/deposit attempts with real deploy hashes + cspr.live links).
|
|
- **Honesty flags built in, not glossed over:** `set_credit_score` is
|
|
`only_admin`-gated on-chain (the signer must be the ORIGINAL deployer key —
|
|
a freshly generated operator key will always get rejected there; the
|
|
result carries `admin_required: true` rather than hiding the failure).
|
|
`stake`/`deposit_liquidity` are Odra `#[odra(payable)]` entry points; this
|
|
submits the attached value as a plain `amount` U512 runtime arg (the same
|
|
convention the sim-side `CasperTransport` abstraction already uses), but
|
|
whether Odra's casper-backend WASM for a payable method actually reads a
|
|
direct `StoredContractByHash` call that way (vs. requiring its own
|
|
proxy-caller session) is **not yet verified against a funded account** —
|
|
every payable mirror result carries `convention_verified: false` until a
|
|
real funded deploy confirms it on cspr.live. `register_agent` has no such
|
|
caveat (non-payable, non-admin-gated, and the exact pattern already proven
|
|
by `scripts/casper_health.ts`).
|
|
- **`npm run casper:keygen`** — new script, generates a real ed25519 Testnet
|
|
keypair fully offline (no network call, nothing spent), writes the PEM to
|
|
`.secrets/casper_testnet_secret_key.pem` (gitignored), prints the account
|
|
hash and the faucet URL. Ran it this round; the generated key is real.
|
|
- **Verified live, end-to-end, against the real node:** booted the API with
|
|
`CRED402_SECRET_KEY` + `CRED402_CASPER_NODE_URL=https://node.testnet.casper.network/rpc`
|
|
pointed at the freshly generated (unfunded) key. `GET /v1/casper/live`
|
|
reported `live:true, reachable:true, chain:"casper-test"` — the transport
|
|
genuinely reaches Casper Testnet. `POST /v1/agents` and
|
|
`POST /v1/credit/deposit` both returned real RPC rejections
|
|
(`Code: -32008, err: Invalid Deploy` — the real node's own validation,
|
|
because the account has no balance yet), which is exactly the expected
|
|
failure mode for an unfunded key and proves the signing → serialization →
|
|
submission path is real, not mocked.
|
|
- **OWNER STEP (flagged, not blocking):** fund the generated key at
|
|
https://testnet.cspr.live/tools/faucet (public faucet, captcha-gated,
|
|
spends nothing). Once funded, `register_agent` calls will go fully live;
|
|
`stake`/`deposit_liquidity` need the Odra payable convention confirmed
|
|
against that funded account; `set_credit_score` additionally needs the
|
|
ORIGINAL deployer's key, not a fresh one.
|
|
- All 450 existing tests still pass unmodified — sim mode (the default for
|
|
everyone without the new env vars) has zero behavior change.
|
|
|
|
### 2. QIE / NEAR paid routes — NEAR unblocked, QIE genuinely still blocked (not by me)
|
|
|
|
- **NEAR:** no facilitator is needed (Cred402 self-verifies against NEAR RPC
|
|
— see `docs/near_x402.md`), so the only missing piece really was
|
|
`CRED402_NEAR_PAY_TO`. **New `npm run near:keygen`** generates a real
|
|
ed25519 keypair offline and derives its NEAR *implicit account id* (the
|
|
hex-encoded public key — NEAR auto-creates the account on-chain the first
|
|
time it's funded, no separate registration call). Ran it; wrote
|
|
`.secrets/near_testnet_credentials.json` (gitignored) and the real
|
|
implicit account id is in the script's output. `render.yaml` now has a
|
|
`CRED402_NEAR_PAY_TO` / `CRED402_NEAR_NETWORK=testnet` slot ready for the
|
|
owner to paste the funded account id into.
|
|
- **QIE:** re-checked the repo's own prior research (`.env.example`,
|
|
`docs/qie_x402.md`) before touching anything — `CRED402_QIE_ASSET_ADDRESS`
|
|
(QUSDC's ERC-20 contract on QIE testnet) and `CRED402_QIE_FACILITATOR_URL`
|
|
(no public x402 facilitator for QIE is confirmed to exist) are **both
|
|
still unconfirmed external facts**, not missing env-var plumbing. Filling
|
|
them with a guess would mean the route either silently fails or worse,
|
|
"succeeds" against the wrong contract. Added `render.yaml` slots
|
|
(`sync: false`) so this is one dashboard paste once those two facts are
|
|
confirmed or a facilitator is stood up — correctly left undone rather than
|
|
faked.
|
|
- **OWNER STEP:** fund the printed NEAR implicit account at
|
|
https://near-faucet.io (captcha, free, spends nothing), paste it into
|
|
Render. QIE needs real research/infra (confirm QUSDC's testnet contract,
|
|
or deploy a self-hosted x402 EVM facilitator pointed at QIE) before its
|
|
env vars mean anything — flagged as a follow-up, not an owner click.
|
|
|
|
### 3-5. Public marketing homepage + live competitor comparison + 90-second live proof
|
|
|
|
The console previously booted straight into the technical tab dashboard —
|
|
zero hero, value prop, or CTA (confirmed by reading `App.tsx` before
|
|
touching it). Built as one cohesive "Home" tab (now the default tab) rather
|
|
than three disconnected pages, since they share one visitor journey:
|
|
|
|
- **`frontend/src/components/Home.tsx`** — hero with LIVE stats pulled from
|
|
`GET /v1/analytics` (agents scored, x402 volume, credit issued, receipts
|
|
settled — zero hardcoded numbers), a 3-step "how it works", and a closing
|
|
CTA section linking into the console and `frontend/public/pricing.html`.
|
|
- **`frontend/src/components/CompetitorComparison.tsx`** — a real React
|
|
table (not prose) with the exact 6 axes from `STRATEGY-2026-10-23.md` §2:
|
|
Bank of Bots (auditability), Clawloan (chain coverage), Priors (score→loan),
|
|
Huma/Centrifuge (evidence & dispute), Skyfire/Nevermined/Coinbase x402
|
|
(layer), Nevermined (price) — cred402's own claims are all
|
|
code-verifiable, not invented numbers.
|
|
- **`frontend/src/components/LiveProof.tsx`** — the "90-second proof":
|
|
clicking one button calls the REAL hosted API in sequence
|
|
(`GET /api/credit/explain/:id` → `POST /v1/credit/lines` → draw → repay)
|
|
against the protocol's own seeded demo agent (`EvidenceSellerAgent`, which
|
|
has a real 30-day x402 revenue history from the moment the API boots —
|
|
`agents/economy.ts` `bootstrap()`), rendering each real response live.
|
|
- New `frontend/src/api.ts` helpers: `getCasperLiveStatus`,
|
|
`openCreditLine`, `drawCredit`, `repayCredit`.
|
|
- **Verified live in a real browser** (gstack `browse`, not just a build
|
|
check): loaded `http://localhost:5180/`, screenshotted the full Home page,
|
|
clicked "Run the live proof", and confirmed all three steps completed for
|
|
real — `credit score 94/100 · limit 49.193 CSPR`, `drew 5 CSPR against a
|
|
51.653 CSPR line`, `repaid 5 CSPR — line closed clean`, with real reason
|
|
codes (`LOW_DISPUTE_RATE`, `STAKE_BACKING`, `SERVICE_CATEGORY_EXPERTISE`,
|
|
`UNVERIFIED_OPERATOR`) rendered from the actual underwriting decision. No
|
|
console errors. Full frontend `tsc -b && vite build` passes clean.
|
|
|
|
### 6. Cold-start UX + keep-warm self-ping
|
|
|
|
- **New `lib/services/keepalive.ts`** — `pingSelf()` hits this service's own
|
|
PUBLIC URL (`https://cred402-1.onrender.com/v1/health` by default,
|
|
overridable via `CRED402_KEEPALIVE_URL`) on a plain 10-minute
|
|
`setInterval` (not the `AutonomousScheduler` used for keeper-sweep/
|
|
automations — those stay opt-in; this is pure uptime hygiene, kept
|
|
deliberately separate). Render's free-tier idle timer is ~15 minutes, so a
|
|
ping every 10 keeps a service with real traffic from ever going idle in
|
|
the first place — it can't wake itself up once actually asleep, but it can
|
|
stop itself from sleeping. `shouldAutoStart()` gates this to
|
|
`process.env.RENDER === "true"` (Render sets this automatically) or an
|
|
explicit `CRED402_KEEPALIVE_URL`, so local dev is unaffected — verified
|
|
`shouldAutoStart({})` is `false` and `shouldAutoStart({RENDER:"true"})` is
|
|
`true`.
|
|
- **Frontend:** `frontend/src/api.ts` adds `fetchColdStartAware()` — retries
|
|
a request with backoff (1.5s → 20s, ~56s total) on network failure or a
|
|
502/503 "still booting" response, calling an `onRetry(attempt, elapsedMs)`
|
|
callback. `x402Buy()` now takes an optional `onRetry` and
|
|
`X402Playground.tsx` shows a visible "⟳ cold start — API was asleep,
|
|
retrying automatically (attempt N, Ms so far)…" chip instead of a dead
|
|
error state, plus a real error chip if all retries are exhausted.
|
|
- **SDK:** `sdk/index.ts`'s internal `get`/`post` now route through a
|
|
`requestWithRetry` with the same backoff/502-503 handling, so a real
|
|
Node/TS integrator's first call survives a cold Render dyno instead of
|
|
throwing immediately. Python/Go/Rust SDKs still need the equivalent —
|
|
**remaining**, not done this round (see below).
|
|
- No emoji; the retry chip uses `⟳`/`✗` glyphs, matching the rest of the
|
|
console's existing symbol-only chip style.
|
|
|
|
### 8. `GET /v1/credit-score/:agentId` convenience alias + per-rail integration docs
|
|
|
|
- Discovered the backlog's literal suggested path (`/v1/x402/credit-score/:agentId`)
|
|
**collides** with the already-live Algorand x402-PAID route at that exact
|
|
path (regex-matched in `api/algorand_x402_routes.ts`, dispatched ahead of
|
|
the v1 router in `api/server.ts`) — adding a second handler there would
|
|
have been silently unreachable dead code. Used
|
|
`GET /v1/credit-score/:agentId` instead (no `/x402/` segment) — a real,
|
|
new, scoped/rate-limited `read`-scope v1 route in `api/v1/router.ts`,
|
|
thin-wrapping the same `state.x402CreditScore()` logic the three paid
|
|
chain-specific routes already serve, with a real `404 agent_not_found` for
|
|
unknown agents.
|
|
- Verified live: `curl localhost:4021/v1/credit-score/EvidenceSellerAgent`
|
|
returns a full real score (97/100, PD 0.004, reason codes, x402 revenue);
|
|
`curl .../credit-score/nope-no-such-agent` returns a real 404; the
|
|
pre-existing paid Algorand route at `/v1/x402/credit-score/:id` still
|
|
responds exactly as before (503 until `CRED402_ALGORAND_PAY_TO` is set) —
|
|
confirmed no collision.
|
|
- **New `docs/integrations/`** — `README.md` plus one real, runnable sample
|
|
per rail per the backlog's exact ask: `skyfire.md` (gate a KYA-
|
|
authenticated advance on the cred402 score), `nevermined.md` (underwrite
|
|
before a metered settlement), `coinbase-x402.md` (the "sits on top of
|
|
x402" pattern for any agent on the raw standard). Linked from `README.md`'s
|
|
new "Integrations" section.
|
|
|
|
### 15. Self-hosting quickstart — docker-compose + one-command bootstrap, both run for real
|
|
|
|
- Found an **existing but broken** `infra/Dockerfile` + `infra/docker-compose.yml`
|
|
(production-oriented, requires `CRED402_ADMIN_API_KEY` — not a quickstart)
|
|
and fixed a real latent bug in it while verifying: `VOLUME ["/data"]` was
|
|
declared after `USER cred402` switched to a non-root user, but nothing
|
|
ever `chown`'d `/data` to that user first — Docker creates a fresh named/
|
|
bind volume owned by `root:root`, so the container crash-looped on boot
|
|
with `EACCES: permission denied, mkdir '/data/algorand-payment-attempts'`
|
|
the moment a volume was actually mounted (which both compose files do).
|
|
Fixed in `infra/Dockerfile` with a `chown -R cred402:cred402 /app /data`
|
|
before the `USER` switch — this also silently fixes `infra/docker-compose.yml`,
|
|
which shares the same Dockerfile.
|
|
- **New root-level `docker-compose.yml`** — the actual zero-config quickstart
|
|
(`infra/docker-compose.yml` stays as the fuller auth-required/Postgres/
|
|
indexer production-like stack): `CRED402_AUTH_REQUIRED=false`, no other
|
|
env required, builds from the now-fixed `infra/Dockerfile`, serves the
|
|
console at the same origin as the API.
|
|
- **New `scripts/bootstrap.sh`** — the non-Docker one-command path: installs
|
|
root + frontend deps if missing, starts the API, polls `/v1/health`, runs
|
|
`scripts/seed_demo_agents.ts` against it (so the dashboard isn't empty on
|
|
first load), starts the Vite console, prints both URLs, tails both logs
|
|
until Ctrl+C (which cleanly kills both processes via a trap).
|
|
- **Verified both for real, not just reviewed:**
|
|
`docker compose up --build` → built the multi-stage image (frontend `tsc -b
|
|
&& vite build` succeeded inside the build), started, `docker ps` showed
|
|
`(healthy)`, `curl localhost:4021/v1/health` → real 200, `curl
|
|
localhost:4021/` → real console HTML, `curl .../v1/credit-score/EvidenceSellerAgent`
|
|
→ real score — then `docker compose down -v` to leave the host clean.
|
|
`./scripts/bootstrap.sh` → ran end-to-end, printed the full seeded demo
|
|
loop (agent registered, staked, x402 evidence purchased, credit line
|
|
opened/drawn/repaid), both `curl localhost:5173/` (console) and `curl
|
|
localhost:4021/v1/health` returned real 200s; caught and fixed one bug in
|
|
my own first draft (`../$FRONTEND_LOG` path concatenation against an
|
|
already-absolute `mktemp -d` path) by actually running it, not by
|
|
re-reading the script.
|
|
- `README.md`'s Quickstart section now leads with both one-command paths,
|
|
manual multi-terminal instructions kept below for people who want more
|
|
control.
|
|
|
|
## What's verified vs. what's flagged
|
|
|
|
- **Ran for real, not just typechecked:** the full local server against the
|
|
actual Casper Testnet RPC (register/stake/deposit all round-tripped to the
|
|
real node and got real RPC errors back, not mocked ones); the full
|
|
frontend in a real headless browser including clicking through the live
|
|
proof; `npm test` (450/450 passing, unchanged); `npm run typecheck`
|
|
(clean); `cd frontend && npm run build` (clean, had to `npm install` first
|
|
— frontend deps had never been installed in this checkout).
|
|
- **Explicitly flagged, not silently assumed:** the Odra payable calling
|
|
convention for `stake`/`deposit_liquidity` (`convention_verified: false`
|
|
until proven against a funded account); `set_credit_score` needs the
|
|
original deployer key; QIE needs real external research/infra, not env
|
|
plumbing; Python/Go/Rust SDK retry logic; faucet funding (Casper + NEAR)
|
|
is an owner/captcha step, flagged in script output and here, not blocking
|
|
anything else in this round.
|
|
|
|
## Remaining from the 15-item backlog (not started this round)
|
|
|
|
7. MCP server directory / Claude Desktop extension listing (manifest + docs).
|
|
9. Guided wallet-connect → multichain-link → provisional-score onboarding UI
|
|
(note: `frontend/src/components/Onboard.tsx` already covers
|
|
register→stake→verify→list — re-check against the backlog's exact ask
|
|
before rebuilding from scratch).
|
|
10. Public `/disputes` or `/trust` page surfacing real dispute/slash outcomes
|
|
(`Trust.tsx`/`Disputes.tsx` exist — check coverage first).
|
|
11. Go port of the relayer/proof-service.
|
|
12. Python ML risk/fraud scoring variant.
|
|
13. Real multi-tenant org/API-key scoping depth.
|
|
14. Webhook delivery dashboard + retry/replay UI in Developer console.
|
|
15. Python/Go/Rust SDK cold-start retry (TS SDK done this round — see item 6).
|
|
|
|
Done this round (moved out of "remaining"): 1 (Casper live wiring), 2 (NEAR
|
|
unblocked, QIE genuinely still external-research-blocked), 3/4/5 (homepage +
|
|
comparison + live proof), 6 (cold-start UX + keepalive), 8 (credit-score
|
|
alias + integration docs), 15 (docker-compose + bootstrap.sh).
|