Integration Guide

This section walks through integrating ZKGate into an existing dApp.


5.1 Step 1 – Choose Integration Model

You can integrate ZKGate as:

  1. Full Privacy Backend

    • Your dApp runs entirely on ZKGate pools (wallet, DEX, launchpad, etc.).

  2. Hybrid Privacy Layer

    • You keep your existing public contracts.

    • You add ZKGate as an optional private mode for specific actions (e.g. private swaps, private invest).


5.2 Step 2 – Onboard & Get Your PoolKey

  • Apply to ZKGate to create a pool.

  • Receive:

    • projectId

    • poolId

    • project API key(s)


5.3 Step 3 – Frontend Integration (SDK)

Example React hook:

Usage:


5.4 Step 4 – Backend Integration (Optional)

Use backend for:

  • automated market making

  • treasury operations

  • fund strategies

  • advanced analytics

Example Node.js script:


5.5 Step 5 – UX Considerations

To keep privacy UX smooth:

  • Show a “Private Mode” toggle in UI (Public / Private).

  • Clearly label actions as “Private Swap”, “Private Deposit”, etc.

  • Add visual indicators when:

    • Proof is being generated

    • Batch is pending

    • Transaction is finalized

Last updated