Deploy a state contract
A state contract is standing logic on your machine — it fires an operator when a
condition or a schedule says so, and proves every fire. This guide deploys one from a template, tries
it safely, then fires it. You'll need a zeq_ak_… key from spinning up a machine.
1 — Deploy from a template
The fastest path is a ready-made template. Each deploys onto your machine and belongs to it:
curl -sX POST https://zeqsdk.com/api/contracts/templates/force-threshold-alarm/deploy \
-H "Authorization: Bearer $ZEQ_KEY" -H "Content-Type: application/json" \
-d '{"slug":"YOUR_MACHINE"}'
# → { contract_id, version_no, … }
Browse the catalogue with GET /api/contracts/templates, or hand-write a definition and POST it to
/api/chain/YOUR_MACHINE/contracts/custom.
2 — Dry-run before you fire
A dry-run answers "what would happen?" — no audit rows, no fires, no cost:
curl -sX POST https://zeqsdk.com/api/chain/YOUR_MACHINE/contracts/CONTRACT_ID/dry-run \
-H "Authorization: Bearer $ZEQ_KEY" -H "Content-Type: application/json" \
-d '{"inputs":{"force":9.9}}'
3 — Fire it
Drive an edge with a payload, or fire a due trigger immediately:
curl -sX POST https://zeqsdk.com/api/chain/YOUR_MACHINE/contracts/CONTRACT_ID/transition \
-H "Authorization: Bearer $ZEQ_KEY" -H "Content-Type: application/json" \
-d '{"inputs":{"force":12.0}}'
Every state-changing call lands on your audit chain — you can pause, freeze, resume, version, and roll a contract back, and each fire carries a proof.
Read next
- Contract anatomy — states, triggers, and the operator a fire runs.
- The contract lifecycle — every operation, end to end.
- Contracts reference — each route with its full curl.