How privacy-preserving trading works
A standard Z Trade swap follows this path:- User constructs a swap intent. The intent specifies the input asset, the input amount, the output asset, and minimum acceptable output (slippage protection). The intent is encoded as parameters to a RelayAdapter call, and the user generates a zero-knowledge proof binding the intent to a shielded input note.
- Transaction submission. The user (or a Broadcaster on their behalf) submits the transaction. The transaction calls the Z Trade RelayAdapter with the intent and the user’s proof.
- Unshield. The RelayAdapter unshields the input asset from the ShieldedPool into the adapter’s transient public balance.
- Execute swap. The adapter calls the Z Trade execution contract, which performs the swap against available liquidity. The execution contract sees a normal-looking swap from the adapter; it does not see the user.
- Reshield output. The adapter takes the output asset and reshields it back into the ShieldedPool as a new note belonging to the user.
- Atomicity. Steps 3 through 5 are atomic. A failure at any step reverts the entire transaction, leaving the user’s shielded balance unchanged.
Asset support
Z Trade supports the asset set of the ShieldedPool. This includes USDC and other ERC-20 stablecoins and tokens bridged to Z. The complete supported-asset list is maintained on the Z Trade dashboard.Liquidity provision
Liquidity for Z Trade execution comes from two sources:- Native liquidity pools. Standard AMM pools deployed alongside Z Trade. Liquidity providers can supply assets to earn fees from swaps.
- (In future) Routed external liquidity. Where direct pools are not deep enough, Z Trade can route through external AMMs on the same chain. The routing will happen inside the adapter; the user will not be able to see the path.