How it works
How it worksOverview
The end-to-end proof → verify → settle loop, from policy to receipt.
Here is the whole loop, from defining a policy to a settled payment with a receipt.
define policy ┌────────────── on-chain (ZentraVerifier) ───────────────┐
───────────── │ authorize_action(agent, proof, recipient, amount, …) │
commit() ─► register │ 1 require_auth(agent) │
commitment + root ────►│ 2 load policy · compute effective prior state │
│ 3 assert proof's prev_* == effective state │
build action │ 4 nullifier unused? │
──────────── │ 5 verify Groth16 proof (BN254) │
SDK reads AuthorityState │ 6 write state · mark nullifier │
─► effective prior │ 7 token.transfer(agent ─► recipient) │
─► prove (snarkjs) ───►│ 8 Poseidon action_id · emit ActionReceipt │
proof + 14 signals └────────────────────────────────────────────────────────┘
│
▼ settled tx + receiptIn words
- Define & commit. You author a private policy;
commitPolicyregisters its commitment and recipient root on-chain. - Read state. The SDK reads the agent's
AuthorityStateand derives the effective prior state for the current epoch. - Prove. snarkjs builds a Groth16/BN254 proof binding the action to the policy, recipient, amount, prior state, and a fresh nullifier.
- Verify. The contract verifies the proof, checks the state binding, and confirms the nullifier is unused.
- Settle. It writes the new state, marks the nullifier, and transfers funds from the agent to the recipient.
- Receipt. It computes the Poseidon
action_idand emits anActionReceipt.
Each stage has its own page in this section.