Skip to main content

Pipeline

  1. Build client-side actions.
  2. Generate proof over compiled server-side actions.
  3. Submit (directly or via paymaster).
  4. Contract verifies and executes.

Why fixed ordering exists

Ordering (SetViewingKey -> OpenChannel -> OpenSubchannel -> Deposit -> UseNote -> CreateNote -> Withdraw -> Invoke) reduces state-machine ambiguity and closes classes of ordering bugs where the same semantic operation could be encoded in multiple inconsistent sequences. The final Invoke phase holds at most one external call per transaction: either InvokeExternal or ComputeAndInvoke (see Shadow accounts).

Per-token temporary balance

Within one transaction, each token keeps a temporary balance:
  • Deposit and UseNote increase it.
  • CreateNote and Withdraw decrease it.
Invariant:
  • it must never go negative during execution,
  • and must end at 0 at the end of transaction.
“Must end at 0” means all temporary inflows are fully matched by outflows in that transaction; no unaccounted residual value remains.