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.
54 lines
2.5 KiB
TypeScript
54 lines
2.5 KiB
TypeScript
/**
|
|
* casper_keygen.ts — generate a fresh, unfunded Casper Testnet ed25519 keypair
|
|
* entirely offline (no network call, no faucet, spends nothing).
|
|
*
|
|
* Writes the PEM under `.secrets/` (gitignored — see .gitignore, never commit
|
|
* it) and prints the account hash + the public faucet URL to fund it. Funding
|
|
* itself is a one-click, captcha-gated step only a human can do — this script
|
|
* deliberately stops short of that and just gets the key ready.
|
|
*
|
|
* npm run casper:keygen
|
|
* # then, as the owner: paste the printed account hash into
|
|
* # https://testnet.cspr.live/tools/faucet
|
|
* # then set CRED402_CASPER_SECRET_KEY_PEM (or CRED402_SECRET_KEY) to this file.
|
|
*/
|
|
import { mkdirSync, writeFileSync, existsSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import Casper from "casper-js-sdk";
|
|
|
|
const { PrivateKey, KeyAlgorithm } = Casper;
|
|
|
|
const SECRETS_DIR = join(process.cwd(), ".secrets");
|
|
const OUT_PATH = join(SECRETS_DIR, "casper_testnet_secret_key.pem");
|
|
|
|
function main(): void {
|
|
if (existsSync(OUT_PATH) && !process.argv.includes("--force")) {
|
|
console.log(`A key already exists at ${OUT_PATH} — pass --force to overwrite (this would orphan any funds sent to the old account).`);
|
|
process.exit(1);
|
|
}
|
|
mkdirSync(SECRETS_DIR, { recursive: true });
|
|
|
|
const key = PrivateKey.generate(KeyAlgorithm.ED25519);
|
|
const pem = key.toPem();
|
|
writeFileSync(OUT_PATH, pem, { mode: 0o600 });
|
|
|
|
const publicKeyHex = key.publicKey.toHex();
|
|
const accountHash = key.publicKey.accountHash().toPrefixedString();
|
|
|
|
console.log("Generated a fresh Casper Testnet ed25519 keypair (offline — nothing broadcast, nothing spent).");
|
|
console.log(` secret key (PEM, gitignored): ${OUT_PATH}`);
|
|
console.log(` public key: ${publicKeyHex}`);
|
|
console.log(` account hash: ${accountHash}`);
|
|
console.log("");
|
|
console.log("OWNER STEP (captcha-gated, cannot be automated):");
|
|
console.log(" 1. Open https://testnet.cspr.live/tools/faucet");
|
|
console.log(` 2. Paste the public key above and claim free Testnet CSPR (no payment, no real funds).`);
|
|
console.log(" 3. Once funded, set in your .env (or the Render dashboard):");
|
|
console.log(` CRED402_CASPER_NODE_URL=https://node.testnet.casper.network/rpc`);
|
|
console.log(` CRED402_CASPER_SECRET_KEY_PEM="$(cat ${OUT_PATH} | sed ':a;N;$!ba;s/\\n/\\\\n/g')"`);
|
|
console.log(" — or, for local dev, just: CRED402_SECRET_KEY=" + OUT_PATH);
|
|
console.log(" 4. Restart the API. GET /v1/casper/live will report live:true once reachable.");
|
|
}
|
|
|
|
main();
|