Skip to content

Concepts

Core technical concepts behind Zylith.

Concentrated Liquidity (CLMM)

Liquidity providers allocate capital within specific price ranges instead of 0 to infinity.

Constant Product AMM              Concentrated Liquidity
━━━━━━━━━━━━━━━━━━━━━━━           ┌──────────┐
Liquidity: 0 → ∞              ━━━━│██████████│━━━━
                                  └──────────┘
                                  Focused in active range

Tick System

Prices are discretized:

tick = log₁.₀₀₀₁(price)
price = 1.0001^tick

Each tick is ~0.01% price change. LP positions specify tick_lower and tick_upper.

Q128.128 Math

Fixed-point arithmetic for precision:

sqrt_price = sqrt(price) * 2^128

Privacy Model

Commitment Scheme

Two-layer Poseidon hash binding ownership to amount:

inner_hash = Poseidon(secret, nullifier)
commitment = Poseidon(inner_hash, amount)
ComponentPurposeVisibility
secretProves ownershipNever revealed
nullifierPrevents double-spendHash revealed on spend
amountBinds balancePublic input in ZK proof
commitmentOn-chain identifierPublic, unlinkable

Verified solvency: Users cannot claim more than deposited because a different amount produces a different commitment that won't exist in the Merkle tree.

Nullifiers

Prevents double-spending:

  1. Generate random nullifier at deposit time
  2. Store nullifier_hash = Poseidon(nullifier) when spending
  3. Contract rejects if nullifier already used

Merkle Trees

BN254 Poseidon Merkle tree (depth 20, ~1M leaves):

         Root
        /    \
       H      H
      / \    / \
     C1  C2 C3  C4  ← Commitments

The ZK proof shows commitment membership without revealing which leaf.

Privacy Pools

Dual Merkle tree architecture for optional compliance:

Deposit Tree                 Association Tree
┌─────────────┐             ┌─────────────┐
│ All deposits│             │ "Clean" only│
└─────────────┘             └─────────────┘
  • Deposit Tree: Contains all commitments
  • Association Tree: Curated by ASP (relay server), excludes suspicious deposits

Users can prove against either tree—full privacy or compliance proof.

ZK Proofs

Groth16

  • Constant-size proofs (~200 bytes)
  • Fast verification (~3ms on-chain)
  • Requires trusted setup (powers of tau ceremony)
  • BN254 curve for Garaga compatibility

Public Inputs

Seven values visible to verifier:

InputPurpose
rootMerkle tree root
nullifier_hashDouble-spend prevention
recipientOutput commitment
relayerFee recipient
feeRelay fee amount
amount_inInput amount
min_amount_outSlippage protection

What the Proof Proves

  1. Prover knows secret and nullifier for a commitment
  2. That commitment exists in the Merkle tree with given root
  3. The amount matches what's encoded in the commitment
  4. nullifier_hash = Poseidon(nullifier)

Trust Model

ComponentTrust LevelCanCannot
Smart ContractTrustless--
ZK CircuitTrustless--
Relay ServerSemi-trustedCensor txsSteal funds, forge proofs
BrowserUser-trustedStore secretsSpend without user action

Released under the MIT License.