Zum Hauptinhalt springen

State Channels

Spin up a machine, host a web page on it. The bytes are hash-committed to your audit log, the page can compute against the kernel, and there's no separate Vercel, Netlify, or CDN to wire up.

A state channel is a hosted page bound to one of your state machines. You upload HTML; the framework serves it at /s/<your-slug>/ (and /s/<your-slug>/p/<page>/ for additional pages), records every version on your entangled state, and wires the page to compute against the kernel. It's the "spin-up-as-webapp" surface — the third of the framework's three state primitives:

  • State machine — your scoped namespace + identity (/learn/state-machines/).
  • State contract — the deployable logic that runs inside it (/state-contracts/).
  • State channel — the page the world sees, hosted on the machine. (this page)

What you get

  • Hosting with provenance. Every upload is SHA-256-committed to your audit log at the Zeqond it landed. The page you serve is the page you can prove you served — tamper-evident by construction.
  • A locked-down sandbox. Hosted pages render under a strict Content-Security-Policy with a per-request nonce. Inline scripts are nonce-stamped; there's no ambient access to other machines or the admin surface.
  • Compute from the page. A Site SDK publish key is auto-issued for each machine, so the page's JavaScript can call /api/zeq/compute (and read your contracts / entangled state) against your machine without you pasting a key into client code.
  • No extra infra. The machine is already on the entangled state and already authorized by your zsm_ key; the bytes you upload are live immediately.

Deploy a page

Three equivalent paths — same validation, same audit row:

Workbench — the build step authors and deploys the page for you (Guided or Expert), then shows the live URL.

CLI — one command (html is btoa(yourHTML)):

site deploy hello aGVsbG8= "My Page" # page slug · base64 HTML · title
site list # published pages on this machine
site get hello # title, version, html
site unpublish hello # take it offline

curl — straight to the hosting route with your machine key. html is plaintext (the CLI's base64 is just so HTML survives the terminal tokeniser); agentZid is your machine's ZID:

curl -X POST https://zeqapi.com/api/state-machines/<your-slug>/pages/hello/publish \
-H "Authorization: Bearer ${ZSM_KEY}" \
-H "Content-Type: application/json" \
-d '{ "title": "My Page", "html": "<!doctype html><h1>hello</h1>", "agentZid": "<your-machine-zid>" }'

Your page is then live at https://zeqapi.com/s/<your-slug>/p/hello/, and the machine's default channel at https://zeqapi.com/s/<your-slug>/. Full route reference: Machine Pages API.


Compute from a hosted page

Because the Site SDK key is auto-issued, a state channel can run real kernel work client-side — no key in your source:

<script type="module">
// The hosting layer injects the machine's Site SDK key; the SDK proxy is same-origin.
const r = await fetch("/s/<your-slug>/sdk/zeq/compute", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ operator: "NM19", inputs: { mass_kg: 5, acceleration_ms2: 2 } })
}).then(x => x.json());
document.body.textContent = `F = ${r.value} N · proven at Zeqond ${r.zeqond}`;
</script>

Every compute the page runs is a signed CKO envelope on your machine's entangled state — the same path the CLI and Workbench use.


Custom domains — Zeq Edge

Out of the box a channel lives under /s/<slug>/. To put it on your own hostname with caching, rules, and DDoS protection, point a CNAME at Zeq Edge (zeqedge.<your-origin>) and register the site — see the Zeq Edge app. Origin TLS is strict by default; the 60-Zeqond rollup window powers the analytics.


Guarantees

PropertyHow
Tamper-evidenteach version's SHA-256 + Zeqond on the entangled state; verify via /api/chain/<slug>/explore
Sandboxedstrict CSP + per-request nonce on every served page
Computableauto-issued Site SDK key → same-origin /s/<slug>/sdk/* proxy to the kernel
Yours to take downsite unpublish / DELETE the page; the audit history of what was served remains

Next

  • State Contracts — wire a contract behind your channel so the page reacts to events.
  • State machines — the namespace your channel is bound to.
  • Zeq Edge — custom domains, caching, and edge rules in front of your channel.