Zum Hauptinhalt springen

Conditional release gate

Hold a thing — a deploy, an embargo, a payout instruction, a document — until either N authorised parties sign off or a deadline passes. No funds move; this is a generic state gate, the on-model replacement for the old "escrow" pattern.

This is the timelock-release template from the domain-agnostic Foundations set. Three states, two triggers: held → released on an aggregate of sign events, held → expired on a one-shot deadline.


Deploy it

Grab the ready-made template, or deploy the JSON directly. Set the at_unix on the expiry trigger to your real deadline (the template ships a far-future placeholder).

# from the catalogue (auth: your session or machine key)
curl -sS https://zeqapi.com/api/contracts/templates/timelock-release/deploy \
-H "Authorization: Bearer ${ZSM_KEY}" \
-H "Content-Type: application/json" \
-d "{\"slug\":\"${SLUG}\"}"

The definition it deploys:

{
"name": "timelock_release", "version": "1.0",
"states": { "held": {"initial": true}, "released": {"terminal": true}, "expired": {"terminal": true} },
"transitions": [
{ "from": "held", "to": "released", "operator": "KO42", "proof_required": false, "auto": false,
"trigger": { "kind": "on_aggregate", "event": "sign", "within": 1000000,
"aggregate": { "fn": "count" }, "op": ">=", "threshold": 2 },
"post_actions": [ { "type": "emit", "event": "released" } ] },
{ "from": "held", "to": "expired", "operator": "KO42", "proof_required": false, "auto": false,
"trigger": { "kind": "one_shot", "at_unix": 4102444800 },
"post_actions": [ { "type": "emit", "event": "expired" } ] }
],
"observers": [], "audit_clock": true, "zeqond_tick_rate": 1
}

Drive it

Each authorised party emits a sign event. When the count reaches the threshold (default 2), the contract auto-fires held → released and emits released — every signature a tamper-evident row on the entangled state.

# party A signs
curl -sS https://zeqapi.com/api/chain/${SLUG}/contracts/${CONTRACT_ID}/emit \
-H "Authorization: Bearer ${ZSM_KEY}" -H "Content-Type: application/json" \
-d '{ "event": "sign", "payload": { "by": "A" } }'

# party B signs → threshold met → released fires on the next scheduler tick
curl -sS https://zeqapi.com/api/chain/${SLUG}/contracts/${CONTRACT_ID}/emit \
-H "Authorization: Bearer ${ZSM_KEY}" -H "Content-Type: application/json" \
-d '{ "event": "sign", "payload": { "by": "B" } }'

If the deadline passes first, the one-shot trigger fires held → expired instead. Watch either outcome land:

curl -sS https://zeqapi.com/api/chain/${SLUG}/contracts/${CONTRACT_ID}
curl -sS https://zeqapi.com/api/chain/${SLUG}/explore

Extend it

  • More signers. Raise threshold for N-of-M.
  • A grace window. Add a past_due state and a second deadline before final expiry.
  • React downstream. Another contract can subscribe to the released event (on_event with from_slug) and act when this gate opens.

See State Contracts for the full trigger + action reference and the rest of the Foundations set.