Skip to main content

Chains & DeFi hooks

zksdk isn't a shielded-pool-plus-one-DEX. It's a shielded pool with a pluggable DeFi hook system — any on-chain protocol (DEX, lending, staking, vault, bridge, whatever) plugs in as a hook and runs atomically between withdraw-and-reshield, so the user's note flows through an external protocol and back into the pool inside one private tx. No intermediate exposure, no second signature, no tx on the user's EOA.

On-chainRelayAdapt.sol executes the hook calldata atomically. It's the single contract every integration lands against.

Adding your own hook

Anyone running a pool (us or you) can add hooks without circuit changes or re-audits:

  1. Request it from us — new DEX/yield hooks typically ship within a couple of weeks. Tell us the router ABI + chain.
  2. Write your own adapter — the hook interface is stable and documented. Partners deploying their own pool can ship custom hooks tied to their product — e.g., a wallet that also runs its own staking contract can expose a privateStake that goes straight into their product's vault, not a third-party one.
  3. Reuse across chains — the adapter pattern is EVM-agnostic. The same adapter file runs on any EVM chain where the pool contracts are deployed.

Your users see one UX ("Swap Privately", "Stake Privately", "Lend Privately" — whatever buttons you wire). Under the hood it's always the same: ZK-verified withdraw → your hook → reshield.

Broadcaster, RelayAdapt, and the allowlist are pinned per deployment in privacy-pools-app/lib/env.ts.