MetaMask Snaps and the future of Web3 Accounts

ETHCC 6 · July 2023 · 28:44

Alex Jupiter examines alternatives to accounts secured solely by a twelve-word phrase, including account abstraction, multiparty computation and hardware wallets. The EthCC[6] presentation introduces MetaMask Snaps as a way to support different account approaches, framing their broader adoption as a future possibility.

Speakers

Topics

From ETHCC 6, hosted by Ethereum France.

Transcript

[Music] foreign is that coming through awesome hi there everyone uh thanks everyone for turning up uh I'm Alex I'm a product manager at metamask and I'll be joined by my colleague Daniel who's a staff engineer at metamask as well in a second and we're going to be talking to you today about metamask snaps and the future of web3 accounts so first of all let's just establish where metamask is we're extremely proud of the scale that we've managed to achieve to put this into context more people use metamask last month than about three times the population of

Paris and we had 100 million users last year as well of course these are like big headline grabbing figures but would have only been able to achieve this scale by being a part of the ecosystem that we are that we're currently in right now with all these builders that are in Paris this week if you made a Dap that's integrated to metamask if you'd looked at our Open Source Code online filed a bug report or you've got in touch with our team cajeweled someone like myself after we've spoken and complained about metamask you've shown us a bug on your phone for example we've taken that we've iterated the product you've been part of that growth now I remember coming to these types of conferences like you know five ten years ago and this sort of scale was only sort of imagination right but we've now

achieved that and everyone in this room everyone in Paris this week everyone at home is partly responsible for that so we should all be extremely extremely proud but we want to get even bigger as a community right you're going to hear a question such as this a lot this week at Paris I'm talked on the last day so probably like a question like this is probably a little bit tiring at this stage but how can we really scale to 1 billion people well again that's by working together as a community metamask is just but one product in the ecosystem and we're here today to try and get you involved in terms of getting metamask to the next level because you know there's a lot of people working on protocols here various parts of the infrastructure if you're in ethereum called Dev you've done an amazing job switching ethereum to proof

of stake and helping to scale ethereum as well but at metamask of course we exist a couple layers up the stack at the wallet level at the UI level of course we're incredibly familiar with the problems that our users have and again it's becoming a little bit cliched at the moment but we have this thing called a secret recovery phrase it's 12 words that every single user has when they on boards to metamask and we say write this down on a piece of paper never forget it if you lose it you're going to lose all your assets we're all aware of this huge problem it's a prime fishing vector and it's just really confusing to use right for a lot of people now when we think about how to solve this problem though at metamask we're going about this in a very different way potentially to other wallets

if we take a foundational concept from product management we're here right on the left hand side with this far end of this graph we could do some small iterations on this secret recovery phrase we could do some encrypted backups shove that in Google Drive we could split the key in some ways um but that's still a little bit difficult for us to do it's going to take time and that's going to take time and precious resources around what we really need is a technological paradigm shift to get to a global maximum we don't just want to end up spending a load of work spinning the wheels to get to this low local maximum over here and when I talk about a paradigm shifting technology what I'm talking about is say how touchscreens came to smartphones right now we all have smartphones in this room social media timelines now

basically everyone in the world's use social media large language models powering the AI Revolution that we're now a part of and ethereum switching to proof of stake now there isn't some like big reveal in this presentation in terms of what that Paradigm shifting technology is but we're going to talk about how we're actually going to try and solve this problem at metamask and we're going to do this by sticking to the principles that have made metamouse successful to date we're 100 self-custodial we're open source we're free to use but more importantly we're going to go about solving problems like this by harnessing the innovation of web 3 by harnessing the innovation of all the developers in the room right now so you can help us complete that paradigm shift so there's three ways to build with metamask so you're probably all familiar

with the DAP API if you're not familiar with the actual apis yourself you probably use this if you've gone to uniswap you've connected a metamask account you submitted a transaction via adapt you use that dap API this year metamask has also launched the software development kit which is now in beta and this brings metamask to more platforms than ever before those platforms that don't have a browser it's in JavaScript iOS Unity which is incredible for game developers and Android is coming soon the SDK isn't the purpose of this presentation but if you want to learn more go to docs.metamas.io the main point of this presentation though is about metamar snaps this is what it looks like when you install a snap into metamask today what these are is a way to extend metamask they're trustless execution

environments running inside of metamask they have zero permissions by default as you can see here this snap is requesting access to give you to uh to allow websites to communicate directly with the snap and also then display dialogue windows inside metamask as well and a snap can have its own API methods it can use as many of the messages as you want in metamask and can even use snap exclusive methods as well this means the wallet is now the platform this means it's not just developers and product managers at metamask that are now going to be able to push the the wallet forward it's developers in the room such as you who potentially exist outside the consensus umbrella Snaps are available today in our flask build which is our Canary beta build so you can actually start to expand with them now

metamask.io flask and the logo that we use for flask is that orange Fox sorry the purple fox in the bottom right hand corner what can you do with snaps well if you have an idea in terms of how to improve the wallet I can tell you now you can use our existing snap API so at least get together a proof of concept but if you have more ideas for apis you think can actually help your product to extend metamask in the way you want please get in touch with us because we want to find out your requirements and build that API for you so let's show a brief demo of a snap in action so you're probably aware Stark net it's an ethereum layer 2 but it is an EVN compatible due to a different public address schema what we're doing here is we're using metamask flash to deploy a

smart contract on behalf of the user and then using flask and the snap that's installed in there we're then submitting a transaction on a non-evm chain so metamask is historically been an ethereum only wallet using the l2s but now extending metamask beyond that this is starknet but we also have a snap for Bitcoin as well this is just the tip of the iceberg in terms of the Innovation possible with snaps that are available for you going forward though let's talk about how Snaps are distributed so first of all you can publish a snap to npm you deploy adapt to invite users to install your snap then when adapt has a button that says connect to snap or whatever you choose that invokes the snap and messima and

metamask will prompt users to install that snap if you have installed some snaps inside metamask you see a settings list such as this you have a file coin snap installed and also then that start net snap that I just showed you a user can disable them and uninstall them as well and then other dapps can use that snaps as well but what's next if you've been to any metamask presentation over the last probably like 12 to 18 months you probably heard something about snaps but this year is going to be slightly different is Snaps are not just going to exist in flask they're coming to metamask extension this year so now it's never been a better time to engage with a snap developer docs start working on your snaps you can launch these in metamask extension and get your snap in

front of millions of users worldwide but that's not all we're serious about this snaps thing we've got a huge team working on snaps and snaps are also coming to mobile as well it's pretty early stage on mobile um but this is what it's going to roughly look like when you connect to snap this is using an internal threshold signing snap so you can see we're using the action sheets on mobile here to install the snap very similar to what you saw in extension let's see this in action once this loads so we're loading up the the iOS test flight version metamask flask we're going to the in-app browser on metamask mobile we're going to the DAP that this threshold signing signature

snap is invoked from my colleague Owen is setting up a threshold party here then he's going to telegram he's sending me the link for me to also join this and then using then I'm taking that link I'm putting it into the browser inside metamask mobile I'm joining the key generation round if you're familiar with multi-party computation cryptography this is what's going on behind the scenes here I'm saving that key share importantly to the snap that's installed to metamask mobile using the manage State API and then Owen is going to ask me to sign a message we set up a two of two here and so he needs both himself and me

to sign this message I'm copying that link going back into metamask Mobile and then approving this message okay so this is really early stage right um we're not going to be launching this anytime soon but this is just a proof of concept a demo a prototype to show you what could be possible in metamask Mobile and snaps in general so this week we are launching the mobile snaps beta program if you scan that QR code and you put in your email address you can then get added to the iOS test flight version and then also the Android beta as well I keep this up on the stage for now you can also go to metamaster IO snaps if you don't if you don't understand the QR code tonurl.com snaps hyphen guide I'll also display that link at the end as well

and also come and talk to me afterwards if you want to learn more so that's going to bring permissionless Innovation to 100 million people and counting but what does this mean for accounts I started off this presentation by sort of talking about this problem we have the secret recovery phrase I then went on a little bit of a tangent spoke about snaps and permissions Innovation but let's talk about how Snaps are going to help solve that problem with accounts so this week as well uh metamask we are launching a set of new account snap apis what that's going to allow if you have an idea for account abstraction multi-party compute you have some new cool Hardware wallet that you'd previously get in touch with our team and be like sorry we can't integrate this we don't have enough resources you can do this yourself in a permissionless

way so here we have um a button at the bottom of the account list that says add snap account this language may change by the time we actually take this to production what this is going to allow is a user to click this button take them to a grid such as this and then your snap can appear here they can install that into metamask and then one that will do it will then actually add your account into the account list as you can see here this little label says this is powered by a snaps this is very similar to hayata Hardware wallet into metamask today okay so to go over these apis in more detail I'll hand over to Daniel hi everyone so I'm Daniel uh I'm a software engineer at metamask and I'm going to give you a quick interview uh introduction

um on the on those apis so if you have your snaps on metamask uh until now uh it's not that ad accounts to very much they actually don't add too much too metamask because the accounts are only visible only snap UI and it cannot be directly used by the apps so this is going to change uh we are introducing a new set of apis that are going to allow developers to seamlessly integrate with metamask so I would like to start with this quick demo um to see what is possible to to achieve with those new apis so here is the snap uis and as you can see we only have the default account in metamask but we are going to create a

new account using this nav so uh it's up to you to the developers to decide how the accounts are going to be created uh what information they need it can be for example uh NPC account uh and you you can Define the thresholds for example so I just created the account and now you can see the account in metamask and you can accurate select it so after you select this uh after you have this account in metamask uh you can actually use it in any dab you can just go to any app you want to use connect to your metamask select account that was created using this map and here we are going to uh give a quick example uh on how to sign

something so this is any uh as a test step and we just want to show that you can actually use this account uh we can sign type data as well and actually everything that's supported by metamask is also supported by snaps all right sorry yeah so those apis that they are now available um on GitHub so you can check the queuing

API if you want to learn a bit more on how to create your own snap uh that can integrate like this into metamask and there's also the uh example carrying snap that we just saw uh and yeah this is uh actually the future of accounts on metamask WE strongly believe that by extending this capability to external developers we are going to be able to support uh any future type of account so this for example can be used for NPC uh for example account obstruction as well and even for non-evm icons so there's um Bitcoin is an app that exists today

it's not using this API for now but in the future it can use this this API so we would be capable of seeing Bitcoin addresses in metamask so this is uh just a quick overview of how this API works so it's quite simple so when you develop a news map this map is going to reach the the new accounts into metamask so the user is going to be able to select them uh in metamask interface and once this account is created uh the user can just go to ndap and select this account connect to this account and when adapt submits the request to metamask the request is going to be forwarded to this map and then it's up to the snap developer to decide

how the the request is going to be created sign in uh or anything so for example for um simple transaction this map can take extra steps for example it can be asking the user for a second Factor authentication uh it can it could be doing an NPC uh it's a really up to developer to decide how uh this is going to be done and then once this map has the answer the response to uh return to metamask is only going to pass the response to that to the depth and if there's something to be broadcasted mathematics is going to do this for uh for this knife as well

so we think that uh this API is going to allow developers to extend metamask uh and we are also going to release a new version of this API because right now this API only supports UAE accounts but we are going to add support for accountants production as well so if you want to add a snap which you might have mask that allows the user to create a smart contract accounts this is going to be possible uh in uh release this year so yeah cool awesome thanks Daniel let's just get this back to full screen alrighty so again you've probably heard a lot about account abstraction uh if

you've been to any ethereum comments over the last six to 12 months we just want a super super high level right you've got two different types of accounts on ethereum the externally owned account it's the signing account that's controlled by private key and can originate transactions smart contract accounts though controlled by code they cannot originate transactions but they can execute codes you can do cool things like multi-cigs like a genosis save for example now the promise of account abstraction which has been since the theme is Inception it's basically merge uh the the benefits of both types of accounts together using various propositions for protocol upgrades over the years but because of the switch to prove the state scaling those are taking a long time but importantly again you've probably seen this diagram this week go to a better technical Deep dive on this talk if

you've got time for the main of this week if you haven't heard this already but this is the ethereum request for comment 4337 not an ethereum improvement proposal which essentially allows smart contracts to submit use operations to a secondary mempool a bundler which effectively acts like an eoa will then package those user Ops together which contain all manner of different smart contract operations bonded these transactions and then submit them to ethereum blockchain now metamask uh comes like a bit of a whipping horse sometimes because of the scale that we have and because it's mainly eoas inside metamask today but that is going to change with the launch of these apis so here I'm going to be demoing an internal proof of concept called the delegator ERC 4337 smart account and that word delegate will become apparent and very

important as I take you through this demo so you have a Dap that says create smart account if a user goes to this and then clicks this button what this is then doing so let me just show you that this metamask instance just has two accounts at this moment in time in the account list by clicking that button was is actually going to happen on the back end is we're packaging those user operations we're submitting to the bundler deploying a smart contract and then that smart contract account is then going to appear inside metamask so previously metamask was just an airway account and a lot of people this week have been like metamask is doing smart contracts well there you go there's a smart contract account right in the account list of metamask but let's talk about that word delegator

as well what we're using is our delegatable framework to actually delegate a hundred trust tokens to the user once they've clicked on that link so let's fast forward and show those trust tokens inside metamask we have to import them but there you go so what you saw here is a completely frictionless onboarding experience which requires a user to sign Nothing by using account abstraction and our delegatable framework if you want to learn more about delegatable head to delegatable.org watch Dan findlay's presentation at East Denver a couple of months ago because counterfactual delegations are incredible if you have watched that demo and you're familiar with the RC 4337 you may have thought hang on a second that

transaction took a long time but by keeping those delegations off chain and then invoking them at a later date that could be instant and also have privacy enhancing potential as well because it's not actually going on chain at a later date that can allow things such as counterfactual nfts that you send to a friend but then you can pay the gas on behalf of that participant when they actually decide to Mint that nft at a later date how are you let's finish this off with some key takeaways so snaps allows anyone to add new features to metamask in a way that is secure decentralized and keeps users in control you own your snap you can operate it however you want and now is a time to build snaps you can be ready for launch the metamask extension this year and snaps are also

come to mobile 2 we're incredibly invested in snaps and we want you to be too and lastly this week we're launching the snap keyring apis which enable you to bring your own account experience to metamask it's going to be in the next build of flask which will be published on the stores roughly next week you can go to the GitHub links now start building your snap and get them into flask and again get them ready for the for the public launch to extension this year so here are some resources to get you started we covered a lot of ground so check out snaps metamaster IO snaps install flask follow the guide by my colleague Christian tanyaol.com snaps hyphen guide um sign up to the mobile synapse Beta tinyol.com mobile hyphen snaps hyphen beta the snap keyrings API go to

metamask GitHub queuing API if you want to learn more about counterfactual delegations head to delegatable.org we'd love to talk about that more and of course follow metamask Dev on Twitter lastly if you want more Graphics like this that you saw throughout the presentation head to learn.metamask.io thank you very much I'm Alex and this is Daniel yeah I think we have some five minutes for questions if anyone's going [Applause] to end up if you have any question I tell you that was a great presentation if there's none oh there's one hey first of all it's awesome and I just

wanted to ask that currently in web 3 there are a couple of use cases one of them we're signing on the foreground is like required and another one like lens protocol for example where it's kinda not is it possible to for example expose sign to a different application through an API so if I have let's say an app which does sign in on my MacBook but I want to use it through the metamask but similar to Hardware wallet but in the background is it possible to do with snaps or not yeah can you repeat the last part again because uh about the background part is an apps cannot run in the background for now we are working on this but what you can do is send the request to this app

and then this map can take uh up to a few minutes to process the uh the request it can also save a state so you can have a snap that takes multiple steps to actually complete designing designing so probably the only way you could do is you submit your request an app design ask the user to continue the the process somewhere else and then when the answer is ready you can return to design opinion app can return the answer to the extension I save it and then and that could be done in the background right without the metamask going in the foreground so I can do that multiple times yes yeah yeah cool that's awesome yeah foreign

thank you guys nice presentation um I think one question I have is around uh what's the plan for publishing snaps like from a security perspective are you gonna veto that do you already have an idea how these will be handled moving forward sure so the core concept of snaps is to be permissionless in a lot of ways as we launched it so especially for account snaps right which can have access to a private key right there are going to be some requirements for security audits for metamask to get behind said snap and actually push it so if you saw that uh list there that that would actually be displayed inside the metamask UI we are asking developers to have competed security audit for the snap for that to be pushed inside metamask I think every developer in this

room will probably probably get behind that because we can't be pushing an unsecure account snap to our users because it would just look bad on the whole community but then that will be the requirement moving forward like having these uh security audit done on each snap and then metamask approved so that is basically an equivalent app store let's say it's an app store that will veto the snaps so you can still install a snap via the DAP um we are working on more sort of permissionless distribution ideas it's a really really difficult problem to solve uh you know a security audit is is just one thing that I think the whole Community will just have a flag that's like okay this is trusted to some degree right no one's selling a hardware wallet nowadays without a security audit it's like the same thing

right and you shouldn't buy Hardware it hasn't been security audited right yeah this is the early stage right as we're rolling this out there is going to be some permissionless distribution part of this that's coming that's coming in the future um that some of my colleagues are working on uh but yeah their whole idea is is to be permissionless just as we're rolling this out there may be a slight thing where you need to get security audit but that seems to be understandable in this place thank you I have a question on the connection so for snaps when we connect is are you going to build a cross-bridge chain so

that it's not only ethereum but also alternative chains and also on the other side um how you think about how we can enhance the um you know the fiat currency conversion for example if we try to buy ethereum using Mega mask it takes a while to you know link to the bank account and so on so forth so how you kind of plan on that end should I take it again so in terms of the so you're talking about the cross chain right so in terms of when you saw that Stark net um snap with deploying a smart contract on behalf to use this they can so you can interact with it

um and the different stats are operate in their own way right a lot of the a lot of the functionality at the moment is actually happening in the DAP and so is that for the developer how they actually want to interact with with the with with metamask and derive some of the security from the private key I didn't quite get the second half of the question though in terms of buying fiat currency so because I mask account so when buying for example any of the coin we have to link to our own account so the way it's kind of linked with a bank account and so on so forth it's not real time a lot of time it goes to bank account it takes a while and come back so I'm just

asking because you have this mobile application uh what's the plan on enhance that conversion between the normal kind of currency to uh crypto asset um so do you mind if we just keep the microphone with her saying I just need to try and understand the question more you're talking about the on-ramp part so if you're using say one of our Integrations say moonpay for example and and the speed it turns if that happens okay sure yeah I think that's slightly for some of our on-ramp Partners um but I'm sure developer could make a snap and make that fast if needs to be but happy to talk after this talk yeah last last question uh

um first congratulations for your presentation a quick question is it planned to have the possibility to expand and change the UI of metamask like basically like uh we have like a use case right where you have a C20 token but everything is encrypted that you want to display in metamask the amount and the balance but you need to do special thing to decrypt it this is something planned at some point sure so yeah changing the UI via snaps is one of our largest requests that we hear from developers something I didn't touch on for example was say transaction insights there's a new tab in flask which changes UI if if you've got a certain snap installed that alerts you

to if you want to interacting with a smart contract you saw there would change the UI by adding a new account there in terms of what I sort of understand as some sort of custom asset of some kind that you want to try and display in metamask that's something we've been talking about internally and we've sort of got plans for that if you saw that delegatable token that I just showed that's where like furthered the conversation somewhat um yeah we don't have that API currently in the works right now but it's certainly on the roadmap at some point thank you for your talk [Applause] [Music] foreign

[Music]