cred402/.env.example
caelum0x 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

196 lines
11 KiB
Plaintext

# Cred402 environment — copy to .env and fill in. .env is gitignored.
# Everything below is OPTIONAL: with nothing set, Cred402 runs fully in
# simulation/free-API mode (deterministic demo + 87 tests stay green). Each block
# activates a REAL integration when its keys are present.
# ── p8: real Casper Testnet ────────────────────────────────────────────────
# sim (default) keeps the in-memory ledger; testnet routes writes to a live node.
CRED402_CHAIN=sim
# Casper 2.0 testnet JSON-RPC (reads work with no key — used by `npm run casper:health`).
CRED402_NODE=https://node.testnet.casper.network/rpc
CRED402_CASPER_NODE=https://node.testnet.casper.network
CRED402_CHAIN_NAME=casper-test
# Casper Sidecar SSE event feed (casper-network/casper-sidecar). Unset → in-process
# EventBus. Set to consume a live node's events: npm run casper:sidecar
CRED402_SIDECAR_URL=http://127.0.0.1:19999
# Path to a funded Testnet secret-key PEM (faucet: https://testnet.cspr.live/tools/faucet).
# Required only for live deploys / writes. NEVER commit the key itself.
CRED402_SECRET_KEY=/absolute/path/to/secret_key.pem
CRED402_KEY_ALGO=ed25519
# Alternative to CRED402_NODE/CRED402_SECRET_KEY above, for a single-env-var deploy
# (Render, CI): the PEM contents directly (newlines as literal \n) instead of a file
# path. Setting BOTH of these auto-enables live mode without needing CRED402_CHAIN=
# testnet separately — see lib/casper/factory.ts `readCasperEnv`. Generate a local
# dev keypair with `npm run casper:keygen`, then fund it with the Testnet faucet
# (https://testnet.cspr.live/tools/faucet — captcha, owner step).
CRED402_CASPER_NODE_URL=https://node.testnet.casper.network/rpc
CRED402_CASPER_SECRET_KEY_PEM=
# ── p9: real x402 facilitator + data + MCP ─────────────────────────────────
# make-software/casper-x402 facilitator (x402 V2). Run it on :4022, then set this
# to verify/settle CEP-18 transfer_with_authorization payments for real.
# Unset → Cred402's built-in ed25519 x402 verifier (the default, no service needed).
CRED402_X402_FACILITATOR_URL=http://localhost:4022
# Open-Meteo solar/GHI is free and needs NO key (used live by api/rwa_data).
# Optional real EU power-market data (ENTSO-E) — request a token at transparency.entsoe.eu.
ENTSOE_API_TOKEN=
# The official MCP server (npm run mcp:sdk) needs no env — connect any MCP client.
# ── Algorand Global x402 Challenge ─────────────────────────────────────────
# Enables GET /v1/x402/credit-score/:agentId. With no pay-to address the route
# fails closed with 503; it never advertises a placeholder wallet or becomes free.
CRED402_ALGORAND_PAY_TO=
# Develop on testnet, then change to mainnet for the public challenge submission.
CRED402_ALGORAND_NETWORK=testnet
# 10,000 micro-USDC = 0.01 USDC. Must be a positive integer.
CRED402_ALGORAND_PRICE_MICRO_USDC=10000
# GoPlausible supports Algorand Testnet + Mainnet and Bazaar discovery.
CRED402_ALGORAND_FACILITATOR_URL=https://facilitator.goplausible.xyz
CRED402_ALGORAND_FACILITATOR_TIMEOUT_MS=10000
# Independent confirmation source. Production/Mainnet requires HTTPS.
CRED402_ALGORAND_INDEXER_URL=https://testnet-idx.algonode.cloud
CRED402_ALGORAND_INDEXER_TOKEN=
CRED402_ALGORAND_INDEXER_TIMEOUT_MS=5000
CRED402_ALGORAND_MIN_FINALITY_ROUNDS=4
CRED402_ALGORAND_MISSING_TX_THRESHOLD=3
CRED402_ALGORAND_RECONCILE_INTERVAL_MS=15000
CRED402_ALGORAND_MISSING_TX_GRACE_MS=120000
# Durable attempt/receipt state is mandatory in production and on Mainnet.
CRED402_DATA_DIR=./data
# Canonical public origin for Bazaar. Required and HTTPS on Mainnet.
CRED402_PUBLIC_URL=https://api.example.com
# Mainnet additionally requires CRED402_ENV=mainnet and this deliberate release acknowledgement.
CRED402_ALGORAND_MAINNET_RELEASE_ACK=
# Safe client/preflight settings. The expected receiver and exact price are
# independently checked before any signing; the maximum is a hard spend cap.
CRED402_ALGORAND_CLIENT_URL=http://localhost:4021/v1/x402/credit-score/EvidenceSellerAgent
CRED402_ALGORAND_CLIENT_NETWORK=testnet
# Public address only; used by x402:algorand:ready for read-only balance checks.
CRED402_ALGORAND_CLIENT_ADDRESS=
CRED402_ALGORAND_EXPECTED_PAY_TO=
CRED402_ALGORAND_EXPECTED_PRICE_MICRO_USDC=10000
CRED402_ALGORAND_MAX_PRICE_MICRO_USDC=10000
# Base64-encoded 64-byte private key. Used only by x402:algorand:pay after typed approval.
CRED402_ALGORAND_CLIENT_PRIVATE_KEY=
# ── QIE Blockchain Hackathon 3.0 (AI & Autonomous Agents track) ────────────
# Enables GET /v1/x402/qie/credit-score/:agentId. QIE is EVM-compatible, so
# this reuses the generic @x402/core + @x402/evm "exact" scheme. With no
# pay-to address the route fails closed with 503; it never advertises a
# placeholder wallet or becomes free.
CRED402_QIE_PAY_TO=
# Develop on testnet (chain 1983), then mainnet (chain 1990) for submission.
CRED402_QIE_NETWORK=testnet
# QIE testnet JSON-RPC (eth_chainId must return 0x7bf / 1983). No public
# Mainnet RPC is independently confirmed yet — required explicitly there.
CRED402_QIE_RPC_URL=https://rpc1testnet.qie.digital/
CRED402_QIE_RPC_TIMEOUT_MS=5000
CRED402_QIE_MIN_CONFIRMATIONS=2
# REQUIRED, no default: QIE's QUSDC stablecoin is documented
# (docs.stable.qie.digital) but research could not confirm its ERC-20
# contract address or testnet availability. Configure the real token to
# charge in — do not guess an address. If QUSDC is unavailable on testnet,
# point this at another ERC-20 you control for development instead.
CRED402_QIE_ASSET_ADDRESS=
CRED402_QIE_ASSET_SYMBOL=QUSDC
CRED402_QIE_ASSET_DECIMALS=6
# 10,000 base units = 0.01 token at 6 decimals. Must be a positive integer.
CRED402_QIE_PRICE_BASE_UNITS=10000
# REQUIRED, no default: no x402 EVM facilitator for QIE is confirmed to
# exist yet. Point this at a self-hosted or third-party x402 V2 facilitator
# that verifies/settles "exact" EIP-3009 payments on QIE (eip155:1983 /
# eip155:1990). See docs/qie_x402.md.
CRED402_QIE_FACILITATOR_URL=
CRED402_QIE_FACILITATOR_TIMEOUT_MS=10000
# Mainnet additionally requires CRED402_ENV=mainnet and this deliberate release acknowledgement.
CRED402_QIE_MAINNET_RELEASE_ACK=
# Safe client/preflight settings for `npm run x402:qie:check` (read-only; never signs or pays).
CRED402_QIE_CLIENT_NETWORK=testnet
CRED402_QIE_EXPECTED_PAY_TO=
CRED402_QIE_EXPECTED_ASSET_ADDRESS=
CRED402_QIE_EXPECTED_PRICE_BASE_UNITS=10000
CRED402_QIE_MAX_PRICE_BASE_UNITS=10000
# ── NEAR Hackathon (Nov 1-14, 2026, nearhackathon.com) ─────────────────────
# Enables GET /v1/x402/near/credit-score/:agentId. NEAR has no x402 scheme
# package yet, so this is a from-scratch "exact" scheme over @x402/core's
# generic header codecs — and NO facilitator: Cred402 verifies settlement
# itself against the configured NEAR RPC (see docs/near_x402.md). With no
# pay-to account the route fails closed with 503; it never advertises a
# placeholder wallet or becomes free.
CRED402_NEAR_PAY_TO=
# Generate a local keypair + implicit account id offline with `npm run near:keygen`,
# fund it for free at https://near-faucet.io (owner/captcha step), then paste the
# printed implicit account id into CRED402_NEAR_PAY_TO above.
# Develop on testnet (free faucet: https://near-faucet.io), then mainnet for submission.
CRED402_NEAR_NETWORK=testnet
# Public NEAR RPC endpoints; no API key required.
CRED402_NEAR_RPC_URL=https://rpc.testnet.near.org
CRED402_NEAR_RPC_TIMEOUT_MS=8000
CRED402_NEAR_MIN_FINALITY_BLOCKS=2
# 10^22 yoctoNEAR = 0.01 NEAR. Must be a positive integer.
CRED402_NEAR_PRICE_YOCTO=10000000000000000000000
# Mainnet additionally requires CRED402_ENV=mainnet and this deliberate release acknowledgement.
CRED402_NEAR_MAINNET_RELEASE_ACK=
# Safe client settings for the buyer example (examples/near-paid-score/typescript.ts).
CRED402_NEAR_CLIENT_NETWORK=testnet
CRED402_NEAR_CLIENT_RPC_URL=https://rpc.testnet.near.org
CRED402_NEAR_CLIENT_URL=
CRED402_NEAR_EXPECTED_PAY_TO=
CRED402_NEAR_EXPECTED_PRICE_YOCTO=10000000000000000000000
CRED402_NEAR_MAX_PRICE_YOCTO=10000000000000000000000
# NEAR testnet account id + its ed25519 secret key (`ed25519:...`). Create a
# funded testnet account for free at https://near-faucet.io. NEVER commit the key.
CRED402_NEAR_CLIENT_ACCOUNT_ID=
CRED402_NEAR_CLIENT_PRIVATE_KEY=
# ── p10: real RealFi (Stripe/Plaid) + real cross-chain (Base Sepolia) ──────
# Stripe TEST mode (real signature verification on the webhook route).
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxx
# Plaid SANDBOX (real API, no real bank).
PLAID_CLIENT_ID=
PLAID_SECRET=
PLAID_ENV=sandbox
# Base Sepolia EVM satellite deploy (forge). Faucet: https://www.alchemy.com/faucets/base-sepolia
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
ARBITRUM_SEPOLIA_RPC_URL=
ETHERSCAN_API_KEY=
# Deploy inputs for contracts/evm/script/Deploy.s.sol (NEVER commit the key):
PRIVATE_KEY=0xYOUR_FUNDED_BASE_SEPOLIA_KEY
USDC_ADDRESS=0x036CbD53842c5426634e7929541eC2318f3dCF7e
CHAIN_CAIP2=eip155:84532
# ── KeeperHub — on-chain execution & reliability layer (The Last Mile) ──────
# With no key, Cred402 runs KeeperHub in deterministic sim (simulate → smart gas
# w/ backoff → private routing → audit trail). Set an org API key (Settings > API
# Keys) to execute for real against KeeperHub's MCP server and get a real tx hash.
# Create at https://app.keeperhub.com — docs https://docs.keeperhub.com/ai-tools/mcp-server
KEEPERHUB_API_KEY=kh_your_org_key
KEEPERHUB_API_URL=https://app.keeperhub.com/mcp
# MEV-protected private submission (default on). Set to 0 to submit publicly.
KEEPERHUB_PRIVATE_ROUTING=1
# Gas sponsorship on mainnet Ethereum (chain 1) — the agent pays nothing. Default off.
KEEPERHUB_GAS_SPONSORSHIP=0
# Force MPP (Tempo USDC.e) instead of the default x402 (Base USDC) pay-per-execution.
KEEPERHUB_MPP_ONLY=0
# ── Flare — interoperable FXRP credit + FTSO + FDC + Confidential Compute ───
# Sim by default. Set FLARE_RPC_URL to read the REAL FTSO XRP/USD feed on-chain.
FLARE_NETWORK=coston2
FLARE_RPC_URL=https://coston2-api.flare.network/ext/C/rpc
# Optional: pin FtsoV2 instead of resolving via FlareContractRegistry
# (0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019, same on every Flare network).
FLARE_FTSOV2_ADDRESS=
# Real FDC (Flare Data Connector) verifier base for cross-chain payment attestation,
# e.g. https://fdc-verifiers-testnet.flare.network/verifier/xrp (we append /Payment/prepareRequest).
FLARE_FDC_VERIFIER_URL=
FLARE_FDC_API_KEY=
# Flare Confidential Compute (TEE) attestation service — returns an enclave quote.
FLARE_CC_ATTESTATION_URL=
# Deploy inputs for contracts/flare/script/DeployCoston2.s.sol (NEVER commit the key):
# Coston2 faucet (C2FLR + FXRP): https://faucet.flare.network/coston2
FXRP_ADDRESS=
FLARE_VAULT_ADDRESS=
CASPER_POLICY_KEY_HASH=