Getting Started
This guide walks through the core integration: set up the provider, authenticate, display balances, and perform transactions.For a minimal copy-paste example, see the React Quickstart. This guide explains each step in detail.
Prerequisites
- Both packages installed in your project
- An App ID and indexer URL (see Configuration)
- A wallet (MetaMask, WalletConnect, etc.)
- Familiarity with authentication options (optional for development, required for production)
Step 1: Set Up Provider
Wrap your application withPrivacyBoostProvider. The provider initializes the SDK and makes it available to all child components via hooks. While loading, it renders your loadingComponent; if initialization fails, it renders errorComponent.
Step 2: Connect Wallet
UseuseAuth for authentication. authenticateWithWalletAdapter() connects the browser wallet (MetaMask, etc.), derives privacy keys, and authenticates — all in one call.
Step 3: Display Balances
UseuseBalances for reactive balance data. Balances update automatically when deposits, transfers, or withdrawals complete.
Step 4: Perform Operations
UseuseVault for deposit, unshield, and transfer operations. Amounts can be passed as human-readable strings (like "1.5") or as bigint values in wei.
Step 5: Multi-Chain (Optional)
Use theuseChain hook to operate on additional blockchains beyond the primary chain in your provider:
What’s Next
You’ve completed the core React flow: provider → auth → balances → shield/send. Here’s where to go from here:Deposits
Deposit tokens into the shielded pool
Withdrawals
Withdraw tokens from the shielded pool
Private Transfers
Send tokens privately between users
Wallet Integration
Connect wallets and authenticate
Error Handling
Error codes and recovery patterns
Multi-Chain
Multi-chain hooks and patterns
API Reference
All hooks, types, and component documentation