Session keys only work with CHIPI wallets - not READY wallets. Make sure your wallet was created with
walletType: "CHIPI".Overview
Session keys allow your application to execute transactions on behalf of a user without requiring their owner private key for every action. This enables gasless, frictionless UX for gaming, DeFi automation, social apps, and more.createSessionKey
Generate a session keypair locally. This is a synchronous operation that doesn’t make network calls.Parameters
Return Value
Never store session keys in your backend database. Store only in client-side secure storage (localStorage, sessionStorage, or platform-specific secure storage).
addSessionKeyToContract
Register a session key on the CHIPI wallet smart contract. This requires the owner’s signature (one-time setup per session).Parameters
Restricting Permissions
For enhanced security, whitelist specific function selectors:revokeSessionKey
Revoke a session key from the smart contract. After revocation, the session can no longer execute transactions.Parameters
getSessionData
Query session status from the smart contract. This is a read-only operation that doesn’t require gas.Parameters
Return Value
executeTransactionWithSession
Execute a transaction using a session key instead of the owner private key. No wallet popup required!Parameters
Call Structure
Multi-Call Example
Execute multiple operations in a single transaction:Complete Example: Gaming Session
Error Handling
Security Best Practices
- Short durations - Use 1-6 hours, not days
- Limit calls - Set realistic
maxCallsbased on expected usage - Whitelist functions - Restrict
allowedEntrypointsto only what your app needs - Revoke on logout - Always clean up sessions when user signs out
- Client-side storage only - Never store session keys in your database
