When to use this
- Streaming micropayments where on-chain fees would exceed the payment value.
- Per-call billing between agents or services.
- Pre-funded escrow with multi-step settlement.
Prerequisites
- Both counterparties have funded DIDs.
- An off-chain channel between the two parties to exchange signed updates (HTTPS, WebSocket, or Sigil Mail).
Recipe
Open the channel
Either party opens it. The opener deposits the entire channel capacity up front; the receiver may top up later via On success the chain locks the deposit in escrow and returns a channel id.
CzacDeposit.Exchange off-chain updates
Each update is a signed message that supersedes the previous one. The canonical update transcript is BLAKE3 of:Both parties sign each update. Persist the most recent fully-signed update — it’s your proof during settlement.Off-chain protocol (pseudocode):
- Sender drafts
{ nonce: N, balance_a: prev_a - amount, balance_b: prev_b + amount }. - Sender signs and transmits.
- Receiver verifies, counter-signs, and transmits back.
- Both parties persist the doubly-signed state.
Cooperative close
When both parties agree to settle, either submits the most recent doubly-signed update.The chain pays out the channel reserves accordingly.
Uncooperative dispute (optional)
If a counterparty disappears or tries to settle on a stale state, the other party submits the highest-nonce state they have:A dispute window of
timeout_blocks / 4 opens. If the counterparty posts a higher-nonce state during the window, that one settles instead. After the window, the highest-nonce state on chain pays out.Common errors
| Symptom | Cause | Fix |
|---|---|---|
channel already open | Reused id | Use unique ids — e.g. include block height in the suffix |
signature verification failed | Wrong public key or message bytes | Match the transcript byte-for-byte; both sides must use the same big-endian encoding |
update nonce not strictly increasing | Replayed an older state | Submit the highest-nonce signed update you hold |
timeout expired | Channel went stale | Open a new channel; the old escrow returns to the opener |
See also
- Primitive: CZAC channels
- Cookbook: Issue a mandate — to bound channel authority.
CZAC_SPECIFICATION.md