Protocol

Deposits & Withdrawals

Depositing and withdrawing are the two core operations in Hinkal. Both follow the same path: an off-chain proof, a single on-chain call to transact, and a set of checks and state updates inside the contract. See Compliance for deposit eligibility.


Flow

  1. Generate the proof off-chain
    The user's client produces a Zero-Knowledge Proof (ZKP) for the operation.
  2. Submit on-chain
    The proof is sent to the Hinkal contract's transact function, together with a calldata hash (see Frontrunning protection below).
  3. The contract verifies
    It checks the proof, verifies the root hashes of both the Hinkal Merkle tree and the Access Token Merkle tree, and confirms the protocol's balances are accurate.
  4. The contract updates state
    Commitments tied to the provided nullifiers are nullified so they cannot be reused; new commitments are added to Hinkal's Merkle tree.
  5. Funds move
    • Deposit - the user's funds are transferred into the Hinkal contract.
    • Withdrawal - the contract pays any relayer fee (if a relayer is involved), then transfers the remaining funds to the recipient.

Frontrunning protection

A calldata hash is submitted alongside the ZKP. It commits the proof to the exact transaction details - including the relayer - so they cannot be altered in flight.

Deposit
Withdrawal