Withdraw
Withdraw ETH or a supported ERC-20 token from your private balance to any EVM recipient address.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
withdrawAmountInput | number | Yes | Total amount in the selected token to withdraw (fees are deducted from this) |
recipient | string | Yes | EVM address to receive the funds |
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 withdrawer’s EVM wallet address |
token | 'eth' | 'usdc' | 'usdt' | No | Token to withdraw. Defaults to 'eth' |
network | NetworkConfig | number | No | EVM network. Defaults from NEXT_PUBLIC_CHAIN_ID, then Base |
Returns
The transaction hash (string).
Example
Withdrawal Fees
Fees are deducted from thewithdrawAmountInput, so the recipient receives less than the requested amount.
| Component | Amount |
|---|---|
| Flat fee | 0.00025 ETH per withdrawal |
| Protocol fee | 0.35% of withdrawal amount |
Fee Calculation Example
How Withdrawals Work
UTXO Selection
The SDK scans on-chain events to find your unspent UTXOs (up to 2) to cover the withdrawal amount.
ZK Proof Generation
A zero-knowledge proof is generated proving you own the funds and authorizing the exact recipient and amount.
On-Chain Submission
The transaction is submitted directly to the selected EVM smart contract. No relayer is needed for EVM withdrawals.
Privacy Guarantee
The withdrawal transaction on-chain contains no information about the original depositor. The zero-knowledge proof ensures:- The recipient address cannot be modified
- The amount cannot be modified
- Any tampering causes the transaction to revert
Insufficient Balance
If your private balance is less thanwithdrawAmountInput, the SDK throws:
getBalance().