StarkNet Wallet SDK Setup Guide
Add self-custody, passkey-secured, gasless StarkNet wallets to your Next.js, React, or Expo app with the Chipi SDK. Step-by-step guide with code examples.
Overview
Chipi lets you add self-custody wallets to any app in minutes. Users create a wallet with a fingerprint scan. No seed phrases, no browser extensions, no gas fees. Under the hood, Chipi deploys a smart contract wallet on StarkNet with native account abstraction, secured by WebAuthn passkeys stored on the user's device.
Install the Chipi SDK
Install the Chipi SDK for your platform:
bash# Next.js
npm install @chipi-stack/nextjs@latest
# React (Vite)
npm install @chipi-stack/chipi-react@latest
# Expo (React Native)
npx expo install @chipi-stack/chipi-expo@latestThe SDK provides React hooks for wallet creation, transfers, staking, and more. All gasless.
Install an Auth Provider
Chipi ties each wallet to an authenticated user. Pick your auth provider:
- - Clerk (recommended):
npm install @clerk/nextjs. Drop-in auth with email, Google, and passkeys - - Firebase:
npm install firebase. Google's auth platform with phone, email, and social sign-in - - Supabase:
npm install @supabase/supabase-js @supabase/auth-helpers-nextjs. Open-source auth with PostgreSQL - - Better Auth:
npm install better-auth. Lightweight, framework-agnostic auth
Each authenticated user gets their own self-custody wallet linked to their auth session.
Add the Provider Component
Wrap your app with ChipiProvider in your root layout. This initializes the SDK context so all child components can use wallet hooks. It also connects to your auth provider so Chipi knows which user is creating or accessing a wallet.
Use the MCP tool get_component_code("chipi-providers") to get the exact provider wrapper for your auth setup.
Set Environment Variables
Create a .env.local file with your API keys:
bashNEXT_PUBLIC_CHIPI_API_KEY=pk_prod_YOUR_KEY # From dashboard.chipipay.com
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_... # From your auth provider
CLERK_SECRET_KEY=sk_...Use the MCP tool get_env_template() to get the full template for your auth provider.
Add Wallet Creation
Use the CreateWalletDialog component for the wallet creation flow:
- - walletType: "CHIPI". Chipi's own account contract that supports session keys, the most feature-rich option
- - usePasskey: true. Hardware-backed security using the device's fingerprint or face sensor
The passkey never leaves the device. Only use "READY" wallet type if you specifically need Argent X compatibility. If a user requests PIN auth, warn about the limited entropy of 4-digit PINs and recommend passkeys instead.
Add Wallet Summary and USDC Transfers
Add the WalletSummary component to show the user's wallet address and USDC balance with real-time updates. Add the SendUsdcDialog for transfers. It handles address validation, amount formatting (USDC has 6 decimals), and passkey confirmation.
Wire them together on a wallet page using the useChipiWallet hook, which combines wallet state, creation, and balance into a single hook.
Key Rules
- - Always use
walletType: "CHIPI"andusePasskey: truefor the best security and feature support - - USDC has 6 decimals, ETH/STRK have 18 decimals
- - StarkNet addresses are 0x + 64 hex characters
- - All transactions are gasless through Chipi. Users never pay gas
- - Import all hooks from the platform-specific package (
@chipi-stack/nextjs,@chipi-stack/chipi-react, or@chipi-stack/chipi-expo)