
Overview
Starkzap supports multiple ways to connect wallets, each suited for different use cases and security requirements. This guide covers all available connection methods.New to wallets? A wallet is like a bank account on the blockchain—it has an address (like an account number) and uses a signer (like authentication) to authorize transactions. A signer is what proves you own the wallet, similar to how OAuth tokens prove you’re logged in. See the Glossary for more details.
Connection Methods Comparison
Choose the right method for your use case:| Method | Best For | User Experience | Gas Fees | Setup Complexity |
|---|---|---|---|---|
| Private Key | Server-side apps, development | Manual key entry | ⚠️ User pays (or configure AVNU Paymaster) | ⭐ Simple |
| Privy | Consumer apps, mobile/web | Email/social login | ⚠️ User pays (or configure AVNU Paymaster) | ⭐⭐ Moderate |
| Cartridge | Gaming applications | Social login, Face ID/Touch ID (web popup or native session) | ✅ Policy-matching calls can be sponsored | ⭐⭐ Moderate (RN: Metro + adapter) |
Quick Decision Guide
- Building a game? → Use Cartridge (web:
@cartridge/controller; React Native:starkzap-native+ React Native Integration) - Building a consumer app? → Use Privy (email/social login, configure AVNU Paymaster for gasless)
- Building a server-side service? → Use Private Key (with proper security, configure AVNU Paymaster for gasless)
- Need gasless-style UX for approved game calls? → Use Cartridge with policies that match your contract calls
- Need email-based auth? → Use Privy
- Just testing? → Use Private Key for quick setup
Connection Methods
1. Local Private Key (StarkSigner)
The simplest approach — sign transactions locally using a private key (like storing a password locally). Best for:- Server-side applications
- Trusted environments
- Development and testing
A private key is like a password—it proves you own the wallet. Unlike a password, you should never expose it in client-side code. Only use this method on secure servers or for development.For gasless transactions: Configure AVNU Paymaster separately to sponsor transaction fees.
2. Privy Signer (Server-Side Key Management)
Privy manages private keys securely on their infrastructure (like how OAuth providers manage authentication). The signing happens through your backend. Best for:- Consumer applications
- Mobile and web apps
- Applications requiring secure key management
Think of Privy like OAuth for wallets—they manage the keys (like Google manages your login), and you just call their API to sign transactions (like calling Google’s API to verify a token).For gasless transactions: Configure AVNU Paymaster separately to sponsor transaction fees.
For detailed Privy integration instructions, see the Privy Integration Guide.
{ walletId, hash } and must return { signature }.
Option B: Custom signing function (for server-side Node.js)
3. Cartridge (web Controller or native session)
Cartridge is specialized for gaming applications and provides social login and passkey authentication.- Web: opens a Controller popup (install
@cartridge/controller). - React Native / Expo: in-app browser / deep-link session flow via
starkzap-native— register the native Cartridge adapter before connecting; see React Native Integration.
- Gaming applications
- Social login integration
- Passkey-based authentication
- Policy-approved, paymastered execution (not every arbitrary call)
Key advantage: Cartridge can sponsor policy-matching transactions through its paymaster/session stack after users approve policies. Other calls may still require user fees or extra steps. See the Cartridge Controller Integration Guide.
4. Custom Signer
ImplementSignerInterface to integrate any key management solution (hardware wallets, MPC, HSMs, etc.):
Account Presets
Account presets define what type of wallet account to create. Think of it like choosing between “Personal” vs “Business” account types—different presets have different features and security models.An account preset is like selecting a user role or account type. Each preset (OpenZeppelin, Argent, Braavos) has different capabilities, just like how different user roles have different permissions in your app.
Built-in Presets
Custom Account Class
Wallet Lifecycle
Deployment
Starknet accounts are smart contracts that need to be “deployed” (created on the blockchain) before they can execute transactions. Think of it like creating a new user account in your database—it needs to exist before you can use it.Deployment is like provisioning a new service or creating a new account. The SDK handles this automatically, but you can control when it happens with the
deploy option.For sponsored wallets,
execute() automatically deploys the account in the same transaction if needed — no separate deploy step required.Ensure Ready
A convenience method that checks deployment and optionally deploys:Deployment Policy Options
"never"- Fail if account is undeployed"if_needed"- Deploy undeployed accounts automatically"always"- Force deployment flow even if already deployed
Using the Onboarding API
The onboarding API simplifies wallet connection by handling strategy selection, signer construction, and account readiness:Production Guidance
- Prefer signer separation by trust boundary:
- Server-only keys on backend
- Privy for managed end-user keys
- Cartridge for delegated UX
- Always call
ensureReady()before user actions - Use appropriate account presets for your use case
- Handle deployment errors gracefully in production
Next Steps
- Learn about Executing Transactions
- Explore ERC20 Token Operations
- Set up Staking & Delegation