Use this file to discover all available pages before exploring further.
By default, every transaction requires the user to sign. Session keys let your app hold a scoped key that can sign on the user’s behalf, within limits you define. The user approves once and your app executes freely until the session expires or limits are hit.This tutorial walks through a one-click trading scenario: the user grants your app permission to execute USDC transfers up to a spending limit, without prompting for every trade.This tutorial builds on the Quickstart. You’ll need a working smart account before continuing.
Smart Sessions are experimental. Expect breaking changes.
Enable the Smart Sessions module when creating the account:
import { RhinestoneSDK } from '@rhinestone/sdk'const rhinestone = new RhinestoneSDK({ apiKey: process.env.RHINESTONE_API_KEY as string,})const rhinestoneAccount = await rhinestone.createAccount({ owners: { type: 'ecdsa', accounts: [ownerAccount], }, experimental_sessions: { enabled: true, },})
If the account is already deployed, you can install the module in a separate transaction:
import { experimental_enable } from '@rhinestone/sdk/actions/smart-sessions'const transaction = await rhinestoneAccount.prepareTransaction({ chain: base, calls: [experimental_enable()],})const signed = await rhinestoneAccount.signTransaction(transaction)const result = await rhinestoneAccount.submitTransaction(signed)await rhinestoneAccount.waitForExecution(result)
2
Generate a session key
Create an ephemeral key pair that your app will use to sign on the user’s behalf. In production, store this key securely. Use localStorage for client-side sessions, or a KMS/secrets manager for server-side automation.