Overview
Cartridge Controller is specialized for gaming applications and provides a powerful abstraction layer for managing account access and ownership on Starknet. Cartridge enables:- Social Login: Users can sign in with social accounts (Google, Twitter, etc.)
- Passkey Authentication: Biometric authentication (Face ID, Touch ID, Windows Hello)
- Policy-Based Access: Define policies for what contracts/methods can be called
- Delegated Transactions: Users can approve transactions without managing keys directly
- Built-in Paymaster: Automatic gasless transactions - Cartridge sponsors (pays for) all transaction fees automatically
Why Use Cartridge?
- ✅ Perfect for Gaming: Specialized for gaming applications with session-based transactions
- ✅ Automatic Gasless Transactions: Built-in paymaster sponsors all transactions—users never pay gas fees
- ✅ Better UX: No seed phrases or private key management
- ✅ Social Login: Users sign in with familiar accounts (Google, Twitter, etc.)
- ✅ Biometric Auth: Face ID, Touch ID, Windows Hello support
- ✅ Policy Control: Define what contracts/methods users can interact with
- ✅ Session Management: Users approve policies once, then transactions happen automatically
Key Value Proposition: Unlike Privy or Private Key strategies (which require separate AVNU Paymaster configuration), Cartridge includes a built-in paymaster that automatically sponsors all transactions. This means users never see gas fees or need to approve individual transactions—perfect for gaming where you want seamless, uninterrupted gameplay.
Setup
1. Install Cartridge Controller
The Cartridge Controller is included as a peer dependency of Starkzap:2. Initialize SDK
Integration
Basic Connection
Connect a wallet using Cartridge Controller. Define policies that specify what contracts/methods can be called, and all matching transactions will be automatically sponsored (gasless) by Cartridge’s built-in paymaster:Using Policies
Policies define what contracts and methods can be called in paymastered transactions. Users approve these policies once when connecting, and then all transactions matching those policies are automatically sponsored by Cartridge’s paymaster:Session Registration
When users connect and approve policies, a session is automatically registered. For paymastered transactions, sessions can be registered without requiring additional signatures—the initial policy approval is sufficient. This enables seamless, gasless transaction execution:Accessing Controller Features
Get access to Cartridge-specific features:Complete Example
User Flow
- User clicks “Connect with Cartridge”
- Cartridge popup appears with social login options
- User signs in with Google, Twitter, or passkey
- Wallet is created and connected automatically
- User approves policies - Defines what contracts/methods can be called
- Session is registered - Automatically registered for paymastered transactions
- Transactions execute automatically - All transactions matching policies are paymastered (gasless) without additional approval
Policy Management
How Policies Work with Paymaster
Policies serve two purposes:- Security: Define what contracts/methods can be called
- Paymaster eligibility: Only transactions matching policies are automatically paymastered
Dynamic Policies
You can update policies based on user actions. Note that updating policies requires reconnection and user approval:Policy Best Practices
- Be specific: Only allow the methods users actually need
- Start minimal: Begin with basic policies, add more as needed
- Explain policies: Let users know what they’re approving and that matching transactions will be gasless
- Group related operations: Put related game actions in the same policy set
- Review regularly: Update policies based on user feedback and game features
Error Handling
Resources
Best Practices
- Request minimal permissions - Only ask for what users need
- Handle popup blockers - Guide users if popups are blocked
- Provide clear instructions - Explain the connection process
- Test on multiple browsers - Ensure compatibility
- Monitor user experience - Track connection success rates