Skip to main content

Withdraw SOL

Withdraw SOL from the Privacy Cash privacy pool to any address. The withdrawal uses zero-knowledge proofs to break the link between deposit and withdrawal addresses.

Example

import { PrivacyCash } from 'privacycash';

const client = new PrivacyCash({
    RPC_url: 'YOUR_SOLANA_MAINNET_RPC_URL',
    owner: 'YOUR_PRIVATE_KEY'
});

async function withdrawSol() {
    const recipientAddress = 'RECIPIENT_ADDRESS';

    // Withdraw 0.01 SOL
    const withdrawRes = await client.withdraw({
        lamports: 0.01 * 1_000_000_000,
        recipientAddress
    });
    console.log(withdrawRes);

    // Check balance after withdrawal
    const privateBalance = await client.getPrivateBalance();
    console.log('Balance after withdraw:', privateBalance.lamports / 1_000_000_000, 'SOL');
}

withdrawSol();

How it Works

  1. A zero-knowledge proof is generated
  2. The proof verifies you have a valid deposit without revealing which one
  3. SOL is sent to your specified recipient address
  4. No on-chain link exists between deposit and withdrawal

Fees

  • 0.35% + 0.006 SOL per withdrawal

Privacy Tips

  • Wait some time between deposit and withdrawal
  • Withdraw to a fresh address for maximum privacy
  • Consider splitting large amounts into multiple deposits/withdrawals