
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: Policy-bound sponsorship — Cartridge can sponsor fees for calls that match approved policies (and eligible session / SNIP-9 paths), not every arbitrary transaction.
@cartridge/controller; React Native / Expo uses starkzap-native with a native session adapter (register it before connecting) when your package version supports native Cartridge.
StarkZap integration
When StarkZap connects Cartridge, it forwards your SDK network configuration (for examplerpcUrl and chainId) into the Cartridge flow so you typically configure the network once on new StarkZap(...).
You do not need to pass chain settings again when calling sdk.connectCartridge() or sdk.onboard({ strategy: "cartridge" }) on the same StarkZap instance.
Web (browser) vs React Native
| Web | React Native / Expo | |
|---|---|---|
| Package | starkzap + @cartridge/controller | starkzap-native (depends on starkzap) |
| UX | Controller popup / embedded flow | In-app browser / deep link session flow |
| Before connect | Install @cartridge/controller | React Native setup: Metro withStarkzap, register the native Cartridge adapter when your SDK version exports it |
| Import | import { StarkZap } from "starkzap" | import { StarkZap } from "starkzap-native" |
React Native / Expo (native Cartridge session)
- Follow React Native Integration for Metro (
withStarkzap) and dependencies. - Register the native Cartridge adapter once at startup before
connectCartridge/onboard({ strategy: "cartridge" })(for exampleregisterCartridgeTsAdapter/registerCartridgeNativeAdapter— exact exports depend on yourstarkzap-nativeversion). - Pass policies and/or a Cartridge preset that resolves policies for your chain.
- Onboarding: native Cartridge often defaults to
deploy: "never"or recommends it when deployment differs from the browser Controller; passdeploy: "if_needed"explicitly if you need core-style deployment checks. - Sponsored execution on native is tied to the session wallet (commonly
feeMode: "sponsored"only).
examples/tic-tac-toe app in the Starkzap repository when available for a full Expo reference.
Why Use Cartridge?
- ✅ Perfect for Gaming: Specialized for gaming applications with session-based transactions
- ✅ Gasless-style UX for approved calls: Built-in paymaster can sponsor policy-matching transactions after users approve policies
- ✅ 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: Unlike Privy or private-key flows (which often use AVNU Paymaster for sponsorship), Cartridge can sponsor policy-approved calls through its paymaster/session stack—so matching game or token operations stay gasless after users approve policies. Other calls may still require user fees or extra steps.
Setup (web browser)
1. Install Cartridge Controller
For web, install the Controller peer used bystarkzap:
2. Initialize SDK
Integration (web)
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 (web)
- 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