Skip to main content
Smart sessions let your dapp act on the user’s behalf within an explicit policy: a set of allowed contracts, function selectors, and an expiry. The user signs once to grant the session; afterwards every UserOperation that fits inside the policy can be executed by a session signer without prompting the user again. Smart sessions are implemented as an ERC-7579 validator module. The Startale AA SDK ships first-party helpers around the Rhinestone Smart Sessions module so you can install it and grant permissions through the same StartaleAccountClient you already use.
Source: StartaleGroup/scs-aa-sdk. The flow below mirrors the production integration in the Startale super-app.

How it fits together

Two artefacts come out of the granting step:
  • A permission id that identifies the policy onchain.
  • A session key keypair. The public key is committed to the policy; the private key is used by your backend or browser to sign UserOperations within scope.

1. Check whether the module is installed

getSmartSessionsValidator builds the validator descriptor. The module is keyed by its onchain address, so you can call isModuleInstalled on the account client to check status before installing.

2. Install the module (one-time per account)

If the module is not installed, install it once. Installation is itself a UserOperation, so it goes through your bundler and (optionally) your paymaster.

3. Define the permission scope

A session scope is a list of CreateSessionDataParams. Each entry binds the session key to a contract and a function selector, with optional onchain policies.
Generate the session key with viem’s generatePrivateKey() + privateKeyToAccount() and store the private key wherever you intend to sign from (typically a backend service or a sealed browser store).

4. Grant the permission

Granting the permission is also a UserOperation, signed once by the account owner. Use smartSessionCreateActions to extend the account client with the granting action, then call grantPermission.

5. Execute UserOperations under the session

Once granted, build a separate StartaleAccountClient whose signer is the session key. UserOperations from this client are validated by the Smart Sessions module instead of the account’s default validator.
The user is not prompted; the session key signs locally, and the Smart Sessions module decides onchain whether the call is in scope.

Operational guidance

Treat session private keys like any other production secret. Keep them on a backend or in a sealed enclave, never in plain localStorage. Set the shortest expiry that still produces a good UX, and rotate keys on a schedule.

Next steps

Social recovery

Combine sessions with a guardian-based recovery module.

Sponsored paymaster

Sponsor every session UserOperation through the SCS paymaster.

Parallel transactions

Run independent session UserOperations concurrently.

Smart account setup

Refresh the underlying account and client setup.