Skip to main content

Withdrawals

This guide covers withdrawing tokens from your private balance to any public address.

Basic Withdrawal

Withdrawal Parameters

Progress Tracking

Withdrawal Steps

Withdrawal Result

Unwrapping WETH to ETH

WETH unwrapping is a separate step after the withdrawal settles on-chain. Call unwrapWeth() once getUnshieldStatus() confirms the withdrawal is complete:

Withdraw to Self

Withdraw to your connected wallet:

Submitting From Your Backend

If your backend tracks withdrawals, have the vault prepare the withdrawal and let your backend submit it. prepareWithdrawal() signs the withdrawal and returns a sealed package with its request id, without submitting anything. Save both on your server, and the user can close the page once you have them.
Your backend then submits the package with its server credentials and tracks it by request id:
Submitting the same package again returns the same request, so retry freely if a call times out. Nobody but the Privacy Boost server can read the package, and the user’s signature inside fixes the amount and recipient. A package expires about two minutes after it’s prepared; if it expires or the withdrawal fails, prepare a new one. The device holds the package’s notes a little past its expiry, so preparing again before then can fail with NOTES_RESERVED. Its retryAfterMs says when the notes are free.

Withdraw to Any Address

You can withdraw to any valid Ethereum address:

Partial Withdrawals

Withdraw any amount up to your shielded balance:

Error Handling

Estimating Fees

UI Example

Best Practices

1. Validate Balance Before Withdrawal

2. Validate Recipient Address

3. Handle Long Operations

Withdrawals can take time due to proof generation:

Next Steps