diff --git a/README.md b/README.md index a2e554f..53b461e 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,41 @@ hand-typed. Full walkthrough (including the "won the bet and still made a mistake" single-grade reveal, and the UNGRADED honesty path) is in [`DEMO.md`](DEMO.md). +## 🔗 Live On-Chain Proof — X Layer mainnet + +**The first real x402 paid-call has settled on-chain.** A live `POST /api/grade` +call was paid from a funded **OKX Agentic Wallet** — TEE-signed EIP-3009 +`TransferWithAuthorization`, replayed as `X-PAYMENT` — and **settled on X Layer +mainnet** (`eip155:196`) through the OKX Facilitator: a real **0.01 USD₮0** +transfer, status **`SUCCESS`**. This is the exact `probe → 402 → sign → pay → +200 → settle` rail the whole product is built on, exercised end-to-end against +the deployed service (not a local demo). + +
+ On-chain settlement receipt — 0.01 USD₮0 on X Layer mainnet, status SUCCESS +
+ +| Field | Value | +|---|---| +| **Tx hash** | [`0x33e65fc9…45c903d8`](https://web3.okx.com/explorer/x-layer/tx/0x33e65fc96d1abed0bb5229337f37f0106e1fc38648095dd43567042245c903d8) | +| **Network** | X Layer mainnet · `eip155:196` (zero-gas USD₮0 promo) | +| **Asset / amount** | USD₮0 (`0x779ded0c…3736`) · **0.01** (10000 atomic, 6dp) | +| **Payer → payTo** | `0x3e86…dbeb` → `0x0000…dEaD` | +| **Paid route** | `POST /api/grade` → **HTTP 200** (`clv_grade: C`, `clv_pct: -2.08`) | +| **Settlement** | OKX Facilitator → `is_placeholder: false` | + +Re-verify it yourself against the running service (free, no wallet needed): + +```bash +curl -s -X POST https://api.clvscout.edycu.dev/api/receipts/verify \ + -H "Content-Type: application/json" \ + -d '{"txHash":"0x33e65fc96d1abed0bb5229337f37f0106e1fc38648095dd43567042245c903d8"}' +# -> {"live":true,"source":"OKX Facilitator GET /settle/status","explorer_url":"…"} +``` + +Full captured evidence (raw 402, signed authorization, paid 200 body, on-chain +tx record, balance delta) is in [`docs/screenshots/PROOF.md`](docs/screenshots/PROOF.md). + ## 🚀 Getting Started ### Prerequisites @@ -152,6 +187,11 @@ npm run api # boots on :4021 **Then open [http://localhost:4021/](http://localhost:4021/)** — a served **visible proof page** that drives the live paid API and *renders* the reveal: the tout who's "+12% / 3-2" collapsing to a red **Sharp Score 40.7/100**, the **WON-but-graded-C** card, the UNGRADED refusal, and the live calibration table. Every button fires a real x402 round-trip (probe → 402 → sign EIP-3009 → pay → 200), signed server-side with a throwaway key because browsers can't sign — nothing on the page is mocked (`web/`, `api/demoRunner.ts`). This is the 90-second demo surface — see [`DEMO.md`](DEMO.md). +
+ CLV Scout live proof page — every number is a real x402-paid call to the running service +
The live proof surface — every card is a real x402-paid call against api.clvscout.edycu.dev. +
+ Or drive it from the terminal: ```bash @@ -272,11 +312,14 @@ clvscout/ round-number CLV cutoffs decided up front — they are not tuned to make this particular 24-row seed ledger look good, and `/api/calibration` states that explicitly alongside the live truth table. -- **Live API — but no real on-chain settlement yet.** The service is deployed on Railway at +- **Live API — with a real on-chain settlement on record.** The service is deployed on Railway at **`https://api.clvscout.edycu.dev`** (`/health` 200; paid routes return real `402` challenges, - free routes 200). What's **not** done: no real paid call has settled on-chain yet (no receipt), - and the static landing/pitch on `clvscout.edycu.dev` (Pages) is still pending DNS — it's live at - `edycutjong.github.io/clvscout` meanwhile. Every number here remains reproducible from source. + free routes 200), and a real paid call has now **settled on X Layer mainnet** — tx + [`0x33e65fc9…45c903d8`](https://web3.okx.com/explorer/x-layer/tx/0x33e65fc96d1abed0bb5229337f37f0106e1fc38648095dd43567042245c903d8), + 0.01 USD₮0, status `SUCCESS` (see [§Live On-Chain Proof](#-live-on-chain-proof--x-layer-mainnet)). + Every number here remains reproducible from source. Remaining scope: only a single grade-route + settlement is captured so far (the `$0.20` audit route uses the identical rail), and per-call + settlement on the deployment depends on the server's OKX Facilitator credentials being present. - **Narrow market coverage by design.** World Cup 2026 knockout markets only (`fixtures/picks.csv`); coverage is stated in every `/api/calibration` response rather than hidden. diff --git a/docs/screenshots/PROOF.md b/docs/screenshots/PROOF.md new file mode 100644 index 0000000..7fa4105 --- /dev/null +++ b/docs/screenshots/PROOF.md @@ -0,0 +1,85 @@ +# On-Chain Settlement Proof — CLV Scout (X Layer mainnet) + +Captured **2026-07-16** against the live deployment `https://api.clvscout.edycu.dev`. +Every value below is raw tool/CLI output — nothing is hand-typed. The transaction is +independently verifiable on the X Layer explorer. + +**Explorer:** + +Screenshots in this folder: +- `onchain-receipt.png` — the settlement receipt summary +- `live-proof-page.png` — the live proof surface (`api.clvscout.edycu.dev/`) + +--- + +## 1. Unpaid probe → real 402 challenge + +`POST /api/grade` with no payment returns the x402 challenge (X Layer mainnet, USD₮0, 10000 atomic = $0.01): + +```json +{"x402Version":2,"error":"payment_required","resource":{"url":"http://api.clvscout.edycu.dev/api/grade","description":"CLV Scout — grade a placed World Cup bet against the closing line; returns grade, CLV%, and the settled truth table for that grade.","mimeType":"application/json"},"accepts":[{"scheme":"exact","network":"eip155:196","asset":"0x779ded0c9e1022225f8e0630b35a9b54be713736","amount":"10000","payTo":"0x000000000000000000000000000000000000dEaD","maxTimeoutSeconds":120,"extra":{"name":"USD₮0","version":"1"}}]} +``` + +## 2. TEE-signed EIP-3009 authorization (OKX Agentic Wallet) + +`onchainos payment pay` signs the `TransferWithAuthorization` from the funded wallet via TEE: + +```json +{ + "from": "0x3e86b9fb8092733adca846a77d64b7c56e1ddbeb", + "to": "0x000000000000000000000000000000000000dEaD", + "value": "10000", + "validAfter": "0", + "validBefore": "1784171471", + "nonce": "0x580cbce05a2eb2603e78bdba178f7ab251ece566e7e36ea7de6e4b03e83f87ac", + "signature": "0x411377736b5fcf15f654aa4656bfac8cf83079da2ad659683093d86a480819b807b37aff7ba39d4eb616b4d75e58bc6db08e6efd7a3677d46ffc1fcf115fe0991b" +} +``` +Signing wallet: `0x3e86b9fb8092733adca846a77d64b7c56e1ddbeb`, header name `PAYMENT-SIGNATURE` (replayed as `X-PAYMENT`). + +## 3. Paid replay → HTTP 200 (real grade) + +`POST /api/grade` with `X-PAYMENT` → **200**: + +```json +{"clv_grade":"C","clv_pct":-2.08,"beat_close":false,"close_odds":1.92,"close_source":"settled_ledger_snapshot","grade_truth":{"grade":"C","n":3,"win_rate":0.333,"roi_pct":-37.33,"low_sample":true},"advice":"C bets in this grade band have negative expectancy (-37.3% ROI over 3 settled rows) — size down or skip.","provenance":{"line_history_source":"settled_ledger_snapshot","snapshot_at":"2026-07-01T18:55:00.000Z"},"you":{"your_grades":1,"your_beat_close_rate":0}} +``` + +Response header `X-PAYMENT-RESPONSE` (base64) decodes to — note **`is_placeholder: false`** (real Facilitator settlement, not a local placeholder): + +```json +{"status":"pending","transaction":"","network":"eip155:196","payer":"0x3e86b9fb8092733adca846a77d64b7c56e1ddbeb","is_placeholder":false} +``` + +## 4. On-chain transaction (X Layer mainnet) — `SUCCESS` + +`onchainos wallet history --chain xlayer` shows the settled USD₮0 transfer: + +```json +{ + "assetChange": [{ "coinAmount": "0.010000", "coinSymbol": "USDT", "direction": "OUT" }], + "from": "0x3e86b9fb8092733adca846a77d64b7c56e1ddbeb", + "to": "0x000000000000000000000000000000000000dead", + "txHash": "0x33e65fc96d1abed0bb5229337f37f0106e1fc38648095dd43567042245c903d8", + "txStatus": "SUCCESS", + "txTime": "1784171368000" +} +``` + +Balance delta (same wallet): **6.10 → 6.09 USD₮0** (−0.01, the paid grade call). + +## 5. Product-native re-verification (free) + +`POST /api/receipts/verify` re-checks the tx live via the OKX Facilitator: + +```json +{"txHash":"0x33e65fc96d1abed0bb5229337f37f0106e1fc38648095dd43567042245c903d8","live":true,"source":"OKX Facilitator GET /settle/status","explorer_url":"https://web3.okx.com/explorer/x-layer/tx/0x33e65fc96d1abed0bb5229337f37f0106e1fc38648095dd43567042245c903d8"} +``` + +Reproduce: + +```bash +curl -s -X POST https://api.clvscout.edycu.dev/api/receipts/verify \ + -H "Content-Type: application/json" \ + -d '{"txHash":"0x33e65fc96d1abed0bb5229337f37f0106e1fc38648095dd43567042245c903d8"}' +``` diff --git a/docs/screenshots/live-proof-page.png b/docs/screenshots/live-proof-page.png new file mode 100644 index 0000000..5b2a33a Binary files /dev/null and b/docs/screenshots/live-proof-page.png differ diff --git a/docs/screenshots/onchain-receipt.png b/docs/screenshots/onchain-receipt.png new file mode 100644 index 0000000..61879f5 Binary files /dev/null and b/docs/screenshots/onchain-receipt.png differ