# Deposits & Withdrawals

For Hinkal, depositing and withdrawing funds are two key operations. To interact with the protocol, users must first create and mint an access token. After that, they generate a Zero-Knowledge Proof (ZKP) off-chain and submit it on-chain using the Hinkal contract’s `transact` function. The contract then performs several checks, including verifying the proof, checking the root hashes of both the Hinkal and Access Token Merkle trees, and ensuring the protocol’s balances are accurate.

During this process, the contract nullifies any commitments tied to the provided nullifiers to prevent them from being reused. It also adds any new commitments to Hinkal's Merkle tree. For deposits, the user’s funds are transferred to the Hinkal contract. In the case of withdrawals, the contract first pays any relayer fees (if a relayer is involved) and then transfers the remaining funds to the recipient. To prevent frontrunning attacks, a calldata hash is submitted with the ZKP, ensuring that transaction details, such as the relayer, cannot be maliciously altered during the transaction.

<figure><img src="/files/Mu6cAh6xEvTaW3txlTiE" alt=""><figcaption><p>Deposit</p></figcaption></figure>

<figure><img src="/files/zWPljL8pWaaOrhPJ8Lat" alt=""><figcaption><p>Withdrawal</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hinkal-team.gitbook.io/hinkal/technical-description/transactions/deposits-and-withdrawals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
