Session Keys : A consequential unlock for next-generation UX

ETHCC 7 · 9 Jul 2024 · 17:15

Sachin Tomar, co-founder of Biconomy, explains how session keys remove repeated wallet confirmations. A session key is a limited-permission key added to a modular smart account, with set permissions, such as a spending cap on one app for a limited time. He says it also lets AI bots transact while the user is offline. He describes the limits of browser-stored sessions, then DAN, an MPC network for storing session keys built with Silence Labs and EigenLayer, shows a demo, and says mainnet may be ready in Q4.

Speakers

Topics

From ETHCC 7, hosted by Ethereum France.

Transcript

Good morning everyone. I'm Sachin Tomer. I'm one of the co-founders at Biconomy. And today we're going to talk about session keys that has the capabilities to actually unlock the user experience that we want in the applications. So before I actually deep dive into session keys, it's very important to understand where we are actually applying these session keys. So let me uh you know quickly recap on smart accounts. I'm sure you must have already seen other presentations who talk about smart accounts, so I will not take like too much time on this slide. Like we know there are mostly two types of accounts, EOA and smart accounts.

We know EOAs EOAs are like bad in terms of UX and smart account is uh where everyone wants to move. Uh but when we talk like EOA has like limited functionality controlled by single private key, uh not much you know security uh processes around EOA and uh smart accounts as the name suggests it's like smart account. It's actually smart. You can actually write code uh to uh implement any type of security on your account. And uh one of the most important uh aspects of smart account is you can actually extend the functionality of your smart account by writing these modules.

So every smart account you see today are modular smart accounts. Uh that means you can uh write new modules on the go attached to your smart account and then extend the functionality of your smart account. And one of those modules is uh session key that actually improves the user experience and how it does that, we'll see in you know um other slides. But that's where the session key actually fits. You have to have a smart account in order for session keys to work. And uh once you enable a session key module, then you can uh you know utilize it for better use user experience. So what are session keys eventually?

I've talked about session key module, you know, that you you can attach to a smart account and then uh enable it. Uh but session keys are just like any other cryptography key pair, um, just like EOAs or maybe pass keys can also act as a session keys. But the very important differentiation uh from session key to any other EOA is that session key has very limited access to your smart account. Uh while uh EOA, if you you know initialize it as a signer to your smart account, has like full control uh over your smart account. But session key, you can uh you can decide like what permissions you want to give to this session key for how long that permission remains valid.

So you have you know all these uh flexibility to uh give granular permission to these session keys. Uh I'll like also like to talk a bit more about like where these session keys are stored, how they are generated, how how can we make it more secure? Uh but you get the idea, right? Uh once you enable a session key module, you can literally uh you know generate as many session keys as you want. Uh, these session keys can be specific to an application, these session key can be specific to a wallet. Uh, it's up to you.

It's up to the dab developer or the wallets to choose uh you know what permissions they want to give to a session keys. Uh how actually, these keys you know improve user experience. So if we see the overall transaction flow without the session keys, this is how it looks like. Uh a user goes to a DAP, uh user clicks a button to send a transaction, uh DAP sends the request to the wallet, wallet will show you a nice confirmation pop-up that you are you sure you want to do this transaction. And people like user will just confirm and then the transaction is done. But here in terms of like user experience, every time you want to do a transaction, every time you want to, you have to actually confirm that dialog box and give your permission to the wallet that okay, you can actually sign this transaction on my behalf.

But that's not how a good UX looks like. And session keys actually removes those extra clicks that you do. Even though most users don't like uh you know read what actually is in the uh you know confirmation box, you actually just uh trust the DAP. So if you are already trusting the application, why just you know doing these extra clicks?

Let the DAP do this transaction for you without any confirmation. And that's where session keys comes into play. Uh there is like one time uh signature needed from the user to actually enable uh the session key on your smart account. So some things go on-chain, uh, some things go off chain, like you know, session keys uh are actually a you know public private key pair, so there has to be a private key component as well that needs to be stored off chain. So once you enable the session key on your smart account, uh of course, you have to do one-time signature. But after that, uh when you come to a DAP who has access to that session key, which you have created earlier, you just click a button, DAP knows uh that uh you know you have a session enabled already on your account.

So it will not ask you another confirmation to do the transaction. It will just use that session key. And you might like ask if DAP is doing transactions on my behalf. Like, how can I secure my account? Like DAP can do anything. But session keys are bound by permissions you give. So you decide that on Uniswap, you know, I just want to give permission to spend my USTC for a limited duration, and only 1000 USTC can be spent by the Uniswap. So you trust the application with a limited set of permission, and then you let you know the application do the transactions on your behalf.

And session keys can secure your account by ensuring that DAP cannot do beyond what you have already approved using the session key. So all the you know cryptography, you know, is working behind the scenes. And another one more like uh very interesting uh angle I see with session key that can be enabled is uh you don't need to be you know online uh in order to do transaction on your account. There is uh the AI you know uh concept has been uh gaining like interest uh recently. So you can actually combine these uh AI bots.

Uh you give some permissions to these bots that okay, this is my session key. Um you can do this and this transaction as soon as you you know uh see any opportunity in the market or you know tokens go up and down, you see any opportunity to buy some tokens on my behalf, just do it. Like don't wait for my uh confirmation or don't wait for me to initiate that transaction. So these you know, bots AI agents can actually work behind the scenes on behalf of you. And uh with session keys, you don't need to worry about security because you have already granted very limited set of permissions. And then these bots can you know work for you while you sleep, you know, they can do transactions on your accounts by this token or by this NFT or whatever you want, basically.

But this is how you you know it should be. You don't need to be online every time to interact with your accounts. Um in a very you know, uh simple three steps, you can see like how session keys actually work. First of all, you need to create these sessions. Uh, you need to have a way to store these sessions, either off uh like either in local storage or some remote storage. I'll talk about that. And then uh you assign some permissions, and uh once you have created a session key, assigned a permission, and then you can sign transactions using these session keys without uh you know any extra pop-ups or even you know being uh required um you know online to do these transactions, as I mentioned earlier. But so by economy has uh uh a production uh you know uh version live already uh with session keys.

People are using that, you know, in production as well. But the current uh version has some limitations. Um in in short, uh the session keys in the current version are stored locally on the browser storage, and that like that uh has some limitation, like you know, you cannot have interoperability. Uh for example, if you created a session on one device or on one browser, and then you connect your same wallet on a different device. I mean, you can't access those so those sessions because they are stored locally. That's one limitation.

If uh local storage is reset, you lose the sessions, and then you have to again create the sessions again. So it's like not very uh concerning, but because session keys are uh not controlling, not have are not like fully controlling your account, but still like from the user experience uh function uh from the use UX point of view, it's not very good. Uh you know, UX, you have to create sessions again and all those things. And that's what we are uh solving by building this uh uh delegated authorization network. So this is uh we we're calling it Dan.

We launched it uh you know last month uh in collaboration with Silence Labs and you know Eigenlayer. Um in short, Dan is an MPC network uh which has the capability to store these session keys. Um when you talk about session keys, you have to talk about permissions. So some of the permissions can store can be on-chain. Some permissions can also be stored off-chain on the Dan. Uh that's what you know this then also uh you know uh gives you. Uh so having said that, once you have the session key storage remotely on a network and not on local storage, you can have interoperable sessions.

Uh, you can uh access your session on multiple devices. Uh with off-chain permissions, uh, you don't have to spend more gas on-chain doing these checks, so you can save some gas. Um I mean, and you can decide like what permission you want on chain, what permissions you want off-chain, uh, depending on the requirement. Uh, security of these session keys is uh inherited by like eigenlayer. Uh and uh because these sessions are remote, you can actually give access to these session keys to automated agents and let them do automatic transactions on your account. Uh this is a very uh complex diagram of Dan.

I'll not like go deep into it uh right now because time is not permitting me. But you can uh see that there is a network uh being run by operators on AVS, and then there is AVS aggregator in between, which is actually a gateway to this network. And then a DAP usually will interact with this uh middleware or gateway to generate session keys to uh to request signatures uh from these sessions keys, and once you get the signature, uh the DAP can directly you know send the transactions uh to bundlers and you know get pay masters involved for gas sponsorship and all those things. I'll very quickly uh focus on one uh important point of Dan.

Uh I mean we are not using AVS just for the sake of using it and just because you know there's a hype of eigenlayer. Uh but it's very important to understand that once you uh are running an MPC network, and when you talk about security, it's very important to identify uh a cheating party or uh if someone is trying to collude, how can you identify these parties and slash them? That's what this uh MPC network uh by Silence Labs actually uh enables. It's not uh I I don't think you'll find this feature in any uh of uh other MPC networks, and that's very important from the security point of view.

So you can be rest assured that your session keys are safe. Uh if something is going fishy, the whole MPC network can actually identify it and uh slash those actors. It's one of the fastest MPC network in production. But that's what it is. No more pop-ups, less clicks is basically we are aiming for.

Okay. So I'll just quickly show you how it looks like. How do I can you help me play this? There's no button to play. Do you have the presentation?

This is the presentation. No, no, no, no. The earlier, the earlier one. This one. Yeah. Just click the play button. Yeah. So this is a demo you can see user connects a wallet. It can be a social wallet as well. It doesn't have to be a MetaMask. And then you create a session on DAN network. So this signature is being used to create a session on DAN, not on-chain. So nothing is going on-chain yet. So you have created a generated a session key on Dan network, get the key, and now this signature is actually to enable session key module on-chain on your smart account.

So this is uh you know one-time uh signature. And once the transaction is confirmed, uh your session key module is enabled on-chain, and your session key is generated on Dan network. So far, we have you know enabled a session uh on on our account. And now when it comes to do transactions like minting and NFT here, uh user just click the button and the DAP communicate with Dan Network to request a signature uh for this transaction. Dan network will sign the transaction using the session key stored uh remotely, and then DAP will get the signature and you know submit it on-chain uh and the transaction you know is done. Uh you can see like when you when user minted NFT, there was no pop-ups.

Um the transaction was signed using session key, which is stored on the DEN network. And uh you already assigned a very limited set of permissions to that to that session key. So that session key can only mint that NFT and cannot do like anything more. So you can trust the DAP that it will use the session key or to only do the operations that you have, you know, permitted. So that's how it looks like uh we are still building this uh DAN network. Um soon, uh maybe in Q4, we'll be ready for mainnet. Uh so if you are building any application who are interested in improving the user experience and using the session keys, or you are you have an AI background and you are building AI you know agents or bots to reach out to us.

Uh there are some uh you know AI agents working with us right now. And yeah, that's it uh from my side. Thank you for listening. Thank you. Okay, we have time for one question. Does anybody yeah hello how do you retrieve the session from Dan or you just need to pass as a user operation to the DAN network to get it signed for Yeah basically you pass the user operation to Dan uh and then Dan will give you the signature over that user operation. And uh since session key is uh like like the private key is on the Dan so once you uh request access to you know that particular session key you just get an auth token uh just like in web2 you know uh you you logged in uh via Gmail and you get an auth token then you can communicate with the server using that auth token you don't have to you know sign uh your request again and again that's how it works.

Uh so you have that auth token you send the request to the Dan network it will give you the signature over that user operation. Thank you so much. Thank you. Thank you