How Private Trading Works
Standard DeFi swaps reveal the trader’s address and amounts on-chain. Z Trade uses the RelayAdapter pattern to make swaps unlinkable. Step 1: Assets in the ShieldedPool. Your tokens sit as private notes. Nobody outside can see your balance or that you’re present at all. Step 2: Generate a ZK proof. Your wallet generates a Groth16 proof authorizing the swap. The proof commits to the specific input notes being spent, the expected output, and anadaptParams binding:
msg.sender.
Step 4: RelayAdapter executes atomically. In one atomic transaction, the RelayAdapter:
- Unshields input tokens from the ShieldedPool to the adapter contract
- Executes the swap on Z Trade’s AMM (approve, swap, collect output)
- Reshields output tokens back into the ShieldedPool as new private notes
adaptParams binding prevents the broadcaster from changing the recipient, altering the fee, or substituting a different trade. If any bound parameter changes, the ZK proof is invalid and the transaction reverts.