Skip to main content
Devnet is the ideal environment for testing Privacy Cash before deploying to mainnet. This guide covers building, deploying, and initializing the program on devnet.

Program Information

  • Network: Solana Devnet
  • Program ID: ATZj4jZ4FFzkvAcvk27DW9GRkgSbFnHo49fKKPQXU7VS
  • RPC Endpoint: Custom Helius endpoint (configured in scripts)

Build the Program

1

Navigate to Anchor Directory

2

Build with Devnet Features

Build the program with devnet-specific features:
Or build with verifiable flag:
3

Copy Program Keypair

Copy the program keypair to the deployment directory:

Deploy to Devnet

You have multiple deployment options:

Option 1: Using Anchor Deploy

Option 2: Verifiable Deployment

For transparency and auditability:

Option 3: Using Solana CLI

Direct deployment with Solana CLI:
Ensure your deploy-keypair.json has sufficient SOL for deployment. You can request devnet SOL from the faucet:

Initialize the Program

After deployment, initialize the program state.

Initialize SOL Tree

Run the initialization script to set up the main SOL privacy pool:
This script:
  • Derives required PDAs (Program Derived Addresses)
  • Creates the Merkle tree account for SOL deposits
  • Initializes the global configuration
  • Sets up the tree token account
Key Configuration:
  • Tree Height: 26 (supports ~67M leaves)
  • Root History Size: 100
  • Fee Recipient: DTqtRSGtGf414yvMPypCv2o1P8trwb9SJXibxLgAWYhw
  • Deposit Fee: 0% (free deposits)
  • Withdrawal Fee: 0.25% (25 basis points)

Initialize SPL Token Tree

To enable privacy for SPL tokens (e.g., USDC), initialize a separate tree:
This script:
  • Creates a tree account specific to the SPL token mint
  • Sets maximum deposit limits
  • Configures token-specific parameters
Configuration:
  • USDC Mint (Devnet): 4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU
  • Max Deposit: 100,000 USDC
The global config must be initialized first (via initialize_devnet.ts) before initializing SPL token trees.

Verify Initialization

After initialization, verify the accounts on Solana Explorer:

Check SOL Tree Account

Or view on Solana Explorer

Verify PDAs

The initialization scripts output the derived PDA addresses:
  • Tree Account: Stores the Merkle tree state
  • Tree Token Account: Holds deposited SOL/tokens
  • Global Config: Stores program-wide configuration

Common Issues

Program Already Initialized

If you see:
The program state already exists. To reinitialize:
  1. Close existing accounts (if you have authority)
  2. Use a different program ID
  3. Continue with existing deployment

Insufficient Balance

RPC Errors

The scripts use Helius RPC endpoints. If you encounter rate limits, you can:
  • Use your own RPC endpoint
  • Modify the connection URL in the scripts
  • Add delays between transactions

Testing Your Deployment

1

Run Unit Tests

2

Run Integration Tests

Test SOL transfers:
Test SPL token transfers:
Test with mint-checked instruction:

Next Steps

Mainnet Deployment

Ready for production? Deploy to mainnet

Verification

Verify your build matches the deployment