> ## Documentation Index
> Fetch the complete documentation index at: https://privacycash.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Deposit

> Deposit ETH or ERC-20 tokens into Privacy Cash on EVM

## Deposit

Deposit ETH or a supported ERC-20 token into a Privacy Cash EVM privacy pool.

```typescript theme={null}
import { deposit } from 'privacycash-evm'

const tx = await deposit({
  depositAmountInput: number,
  keyBasePath: string,
  signature: string,
  address: string,
  txSender: (unsignedTx: any) => Promise<string>,
  token?: 'eth' | 'usdc' | 'usdt',
  network?: NetworkConfig | number
})
```

### Parameters

| Parameter            | Type                        | Required | Description                                                           |
| -------------------- | --------------------------- | -------- | --------------------------------------------------------------------- |
| `depositAmountInput` | `number`                    | Yes      | Amount to deposit in the selected token (e.g. `0.1` ETH or `10` USDC) |
| `keyBasePath`        | `string`                    | Yes      | Base path to the circuit zkey file (without extension)                |
| `signature`          | `string`                    | Yes      | Wallet signature of the Privacy Cash sign-in message                  |
| `address`            | `string`                    | Yes      | The depositor's EVM wallet address                                    |
| `txSender`           | `Function`                  | Yes      | Callback that signs and submits the raw transaction, returns tx hash  |
| `token`              | `'eth' \| 'usdc' \| 'usdt'` | No       | Token to deposit. Defaults to `'eth'`                                 |
| `network`            | `NetworkConfig \| number`   | No       | EVM network. Defaults from `NEXT_PUBLIC_CHAIN_ID`, then Base          |

### Returns

The transaction hash (`string`).

### Example

```typescript theme={null}
import { ethers } from 'ethers'
import { BASE_NETWORK, ETH_NETWORK, deposit } from 'privacycash-evm'

const network = ETH_NETWORK // or BASE_NETWORK
const SIGN_MESSAGE = 'Privacy Money account sign in'

const provider = new ethers.providers.JsonRpcProvider(network.rpcUrl, {
  name: network.chainKey,
  chainId: network.chainId,
})
const signer = new ethers.Wallet(process.env.PRIVATE_KEY!, provider)

const signature = await signer.signMessage(SIGN_MESSAGE)
const address = await signer.getAddress()

const txSender = async (unsignedTx: any) => {
  const tx = await signer.sendTransaction(unsignedTx)
  await tx.wait()
  return tx.hash
}

const txHash = await deposit({
  depositAmountInput: 0.01, // 0.01 ETH
  keyBasePath: './circuits/transaction',
  signature,
  address,
  txSender,
  token: 'eth',
  network,
})

console.log('Deposit tx:', txHash)
```

### Deposit Limits

The protocol enforces a maximum deposit amount. Attempting to exceed it will throw:

```
Please deposit less than X ETH
```

There is also a minimum deposit amount of **0.001 ETH**.

<Warning>
  Depositing below the minimum will throw `Deposit amount must be at least 0.001 ETH`.
</Warning>

### Fees

| Fee Type     | Amount                                     |
| ------------ | ------------------------------------------ |
| Protocol fee | Free (0)                                   |
| Network fee  | Paid by the connected wallet in native ETH |

***

## How Deposits Work

<Steps>
  <Step title="ZK Proof Generated">
    The SDK derives your keypair from the signature, scans on-chain UTXOs, and generates a ZK proof consolidating any existing UTXOs with the new deposit amount.
  </Step>

  <Step title="Address Screening">
    Your wallet address is screened for malicious activity before the transaction is built.
  </Step>

  <Step title="Transaction Built">
    An unsigned transaction is created and passed to your `txSender` callback for signing and submission.
  </Step>

  <Step title="UTXO Created">
    An encrypted UTXO is written on-chain, decryptable only by you.
  </Step>
</Steps>

### Consolidation

New deposits are automatically consolidated with your existing private balance:

```typescript theme={null}
// First deposit: 0.05 ETH
await deposit({ depositAmountInput: 0.05, ...sharedParams })

// Second deposit: 0.03 ETH — merged into a single UTXO
await deposit({ depositAmountInput: 0.03, ...sharedParams })
// Private balance is now 0.08 ETH (minus network fees)
```
