# TensorCash × Paradigm — "a window becomes a proof"

A single self-contained HTML animation (`animation.html`) that merges two things:

- **Paradigm's visual language** — the generative token-generator piece on
  paradigm.xyz. Its embedded title reads "Autoregressive generation predicts token
  fragments, with attention links showing context behind each choice": text appears
  token by token, and lines are drawn from each new token back to the context that
  influenced it. This piece reproduces that motion: tokens materialise one at a time
  in a 16×16 grid, and moss-green attention arcs are swept from each fresh token back
  to deterministic earlier tokens, then fade.
- **TensorCash's brand and idea** — cream paper (`#FAF9F6` / `#F3F1EC`), ink
  (`#1F1E1C`), the moss-green ramp (`#DCE5D7 → #5F7D5B`), system-sans type with
  monospace numbers, and the thesis "proof of inference is the proof of work": a
  *window* of 256 tokens, whose draws come from a hash of the latest block plus the
  text so far, is hashed and compared to the difficulty target — "Each full window is
  one chance at a block".

## What the piece shows

A 1200×675 stage with three panels, looping in ~18 s, with a Pause control:

1. **Number from block hash** (left, types in): block `0xb967cbf2…566446`, height
   31,536, VDF tick `108,167,168`, model `Qwen/Qwen3.8-27B`, sampling
   `T 1.0 · topP 1.0 · topK 50 · bf16`, token counts `5,927 / 377 / 6,304`, and the
   VDF prefix — all read from `receipt.json` (the stored `block_hash_hex` is
   byte-reversed to explorer order).
2. **The window** (centre): all 256 steps of the window are drawn as a 16×16 grid.
   Each cell's shade is that step's `chosen_probs` value on TensorCash's green ramp;
   row labels show the `chosen_tokens` ids. A ticker streams the last draws
   (`u 0.798 → 760 · p 0.55`) from `sampling_u` / `chosen_tokens` / `chosen_probs`.
   While drawing, attention arcs link each new token to its context — Paradigm's
   gesture, with TensorCash's colours.
3. **Window → proof** (right): after the grid completes, a sweep hashes the window
   against block #31,536; the panel then spells out the mechanics quoted from
   `/docs/proof/how-it-works` and `verification` — the hash `39bd4f6a…b8024f69` vs
   target `00000231ab…`, the fact that this receipt's `is_solution` is `false` so the
   window missed and "does not get a second try", the teacher-forced replay check,
   and the closing line "The same work, read once as an answer and once as proof."

`prefers-reduced-motion` is respected: users who ask for less motion get a static
final frame (completed window + proof verdict) with the Pause control hidden, and a
small note that the static fallback is in effect.

No external assets: inline CSS, one `<canvas>`, vanilla JS; all data embedded from
`receipt.json`.

## What shaped it (sources)

Everything below is documented, with quotes, in `research/notes.md`:

- **Paradigm (visual language)** — `https://www.paradigm.xyz`: the home page embeds a
  rotating carousel of generative visuals (`visualAutoplayIntervalMs: 5000`); the
  token-generator piece is the one of kind `self-attention`, titled "Autoregressive
  generation predicts token fragments, with attention links showing context behind
  each choice." Unknowns (exact palette/easing of the original, not fetched in the
  research budget) are flagged in the notes.
- **TensorCash (colours, words, numbers)** — `https://tensorcash.org` (hero: "AI
  compute you can verify.", the "Number from block hash" label, "The same work, read
  once as an answer and once as proof.", the "256, the tokens each proof covers"
  stat): brand colours `#FAF9F6/#F3F1EC` paper, `#1F1E1C` ink, green ramp
  `#DCE5D7…#5F7D5B`, `system-ui` type. Mechanics from
  `/docs/proof/how-it-works` ("A window — A run of 256 tokens of generated text.
  Blocks are won per window.", draws "taken from a hash of the latest block
  together with the question and the text written so far", "The hash of a full
  window is the proof of work on TensorCash … the same work also serves as proof of
  inference.") and `/docs/proof/verification` (teacher-forced replay; "A block that
  fails counts for zero work.").
- **Numbers** — every value in the animation (256 probs / u's / token ids, block
  hash, VDF tick, hash/target hex, sampling config, token counts, model identifier)
  comes from `receipt.json`; the block height 31,536 comes from `BRIEF.md`.

## Files

- `animation.html` — the deliverable (generated; do not edit by hand).
- `build_animation.py` — Python 3, standard library only; reads `receipt.json`,
  writes `animation.html`.
- `research/notes.md` — URLs fetched, observations, and the quoted source sentences.

## Regenerate

```bash
python3 build_animation.py
```

Quick checks:

```bash
python3 -c "from html.parser import HTMLParser; p=HTMLParser(convert_charrefs=True); p.feed(open('animation.html').read()); p.close(); print('ok')"
```

Open `animation.html` in any modern browser; use the ⏸ pause button to freeze the loop.
