Deposit
The deposit operation is the entry point into the Privacy Pools protocol. It allows users to publicly deposit assets (ETH or ERC20 tokens) into a pool, creating a private commitment that can later be used for private withdrawals or public ragequit operations.
Protocol Flow
Commitment Structure
The deposit process creates a commitment with the following structure:
Parameters
Parameter | Description |
---|---|
value | The deposit amount after fees |
label | keccak256(scope, nonce) where scope is pool-specific and nonce is incremental |
nullifier | Random value used to create unique commitments |
secret | Random value that helps secure the commitment |
precommitment | Hash(nullifier, secret) |
Deposit Steps
- Input Preparation
- User generates random
nullifier
andsecret
values - User computes
precommitment = hash(nullifier, secret)
- Deposit Transaction
- User calls Entrypoint's deposit function with asset, amount, and precommitment
- For ETH:
deposit(precommitment)
with ETH value - For ERC20:
deposit(token, amount, precommitment)
after approval
- Fee Processing
- Entrypoint calculates and retains vetting fee (configurable per pool)
- Remaining amount is forwarded to pool
- Commitment Generation
- Pool generates unique
label
using scope and incremental nonce - Computes commitment hash using value, label, and precommitment
- Inserts commitment into state Merkle tree
Fee Structure
- Vetting fee: Configurable percentage (in basis points) taken by Entrypoint
- Example: 100 basis points = 1% fee