
Quick Start
Basic Example
Here’s a minimal example to get you started:For testing, use Sepolia testnet - Replace
"mainnet" with "sepolia" and select tokens from getPresets(wallet.getChainId()). The Starknet Sepolia Faucet is only available for Sepolia testnet (not mainnet). On mainnet, you’ll need to purchase or transfer real tokens.Onboarding API (Recommended)
For most consumer applications, the Onboarding API is the recommended approach. Instead of manually setting up signers, creating wallets, and checking if accounts exist, theonboard() method does all of this in one call:
Privy login/signup already happened before this snippet.
accessToken identifies the current Privy user so your backend can return the correct signer context (walletId, publicKey) and authorize signatures.Your backend is a thin relay to Privy server APIs:- verify
accessToken - return
{ walletId, publicKey, serverUrl } - relay sign requests to Privy
rawSignusingPRIVY_APP_SECRET(kept server-side)
Supported Onboarding Strategies
Thesdk.onboard() method lets you choose how users authenticate and connect their wallets. You can pick from these strategies:
- Privy Strategy
- Signer Strategy
- Cartridge Strategy
Best for consumer apps where you want Privy to manage wallet keys securely on their servers (like how OAuth providers manage login credentials). For sponsored transactions, you’ll need to configure AVNU Paymaster separately:
What the Onboarding API Handles
Thesdk.onboard() method automatically handles everything needed to get a wallet ready:
- ✅ Chooses the right authentication method based on your strategy
- ✅ Sets up the signer (the thing that proves ownership)
- ✅ Connects and initializes the wallet
- ✅ Creates the wallet on the blockchain if it doesn’t exist yet
- ✅ Configures network settings
- ✅ Sets up fee payment options (user pays or sponsored)
Next Steps
Now that you have a basic example working:- Learn about Configuration options
- Explore different Wallet Connection methods
- See how to Execute Transactions