Session keys — clickless interaction
Pre-authorizing temporary, target-scoped keys to execute actions without constant wallet popups.
Even with embedded wallets and Paymasters, a user must still approve every single transaction signature by clicking a confirmation button in the frontend client. For actions like playing a game (e.g., moving a character) or engaging in a social feed (e.g., liking multiple posts in quick succession), this constant popping of auth screens makes the app unusable.
We solve this using Session Keys.
1. The Concept of Session Keys
A Session Key is a temporary, restricted key pair generated in the browser that is granted limited access to execute transactions on behalf of the user's Smart Account.
Instead of sharing the main private key:
- The client generates a new, ephemeral EOA key pair in memory (the "Session Key").
- The user signs a single transaction that authorizes this Session Key on their Smart Account contract.
- The authorization defines strict boundaries:
- Expiry Time: The key is only valid for 1 hour.
- Target Contract: The key can only call the
Socio3contract address. - Allowed Functions: The key can only call the
upvotePostfunction. It cannot transfer assets or callwithdraw. - Value Limit: The key can only execute transactions with 0 native value.
- Once authorized, the client can use this Session Key to sign and broadcast UserOperations automatically in the background, without showing any popups to the user.
2. High-Frequency Interaction
With Session Keys, the interaction flow becomes:
This brings the application UX on par with Web2 apps. The user clicks "Like," the interface updates instantly, and the system executes the transaction in the background. If the session expires, the app prompts the user to renew the authorization.
Was this lesson helpful?
Let us know what you think of this specification. (submitting anonymously)
