New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Based Smart Wallets Workshop - ETHGlobal Brussels 2024

ETHGlobalWed, Oct 9, 2024, 12:00 AM

Join Carl Fluke from BASE, for a Based smart wallets workshop. Join in learning a bit of 4337 account abstraction, smart wallet, and op stack upgrades to further improve UX, low-cost, and speed. This workshop took place during ETHGlobal Brussels, a 3-day hackathon held in Brussels, Belgium from July 12 to 14, 2024. ETHGlobal Brussels brought together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ---------------- Follow us: x.com/ethglobal Website: https://ethglobal.com Email us at: hello@ethglobal.com

Transcript

[Music] all right hello thank you all for coming all right good to go yeah all right he everyone my name is Carl fluke um and today I want to talk about um base and our product smart wallet um so the agenda today uh is I want to give a quick highlight to just what is account abstraction in general and what is 4337 so most of the time when I get questions about smart wallet or account abstraction in general it comes down to some of this introduction points so I always like to to do a one-on-one on that and then I want to talk about smart wallet which was a upgrade to our coinbase wallet to a V4 that now has a pass key wallet built in and then lastly what updates to base are very relevant to this that happened um two or three days ago um so first when I say account abstraction here I am following the ethereum definition which is um account abstraction is a way to solve these problems and they have like a list of six of them but they're just truly talking about an EA um that seed phrases are hard uh and all the intricacies around that uh to solve the problems of that by allowing more users flexible um security and better user experience um so I'm talking essentially when I say account abstraction I'm talking about an actual smart contract wallet um and switching signature validation to not only being an eoa but other types of keys um so why are we doing this is that I'm sure all of us today have gone through this top row as you go to AAP uh it says connect your wallet you may have one or not if you don't go find one then you connect a wallet you have to have gas to be able to do something and then you can interact um and with our smart wallet um we can skip all those steps and directly create uh a pass key based wallet in that dap and Skip all of this redirects two or three times okay so to talk high level of 4 through 37 actually I want to pull does how many people in here know what a bundler does okay and what about a pay master all right good okay then I'm glad I'm going over this all right so in 4337 world you don't have transactions you have user operations um there's only like four fields that are different and I'll show a quick version of that um next you have a bundler which its main job is to take a group of user operations and batch them into a single transaction and then it Loops through them and does all the uh all the user operations in that batch you have an entry point which this is shared across all smart contract wallets um that's probably least important in here um after that you have the actual smart contract um contract account um and that is what you deploy and what stores your funds and what has Logic for additional Security checks or if um it should approve a transaction or not uh and I'm skipping over aggregators and I'm going to pay masters so pay Master is a way that you can add a signature to have another contract pay for your transaction they could pay for it only for the gas fee or they could pay for the entire transaction and so I'm I'm going to go into all of these a little bit um but first like why are we doing this is it can create a simpler ux um one of the main things I like is multi call so in user operations you can do multiple in a single transaction so like when I go to a DI app and I want to do a liquidity position I have to go to token a and appren amount a token B and appren amount and then do my liquidity position so I'm doing three separate transactions and waiting for all three of them to complete with multi call you can actually Stack Up user operations and one user signature um so the ux for that can be drastically better um as I mentioned you can simplify gas so it doesn't have to be the native token it could be an erc20 um you can upgrade that smart contract for your users if you're using a contract proxy um you as a developer if you're using a smart contract like um smart wallet or safe or other they more or less will handle this for you so just know that some upgrades are built in um and then there's Block Level Security checks um essentially for the actual flow you'll see that there's a user operation you have a list of these they go into a bundler men pool that bundler submits a group of TR of user Ops it Loops through a validation phase and it Loops through an execution phase the pay Master is completely optional if the pay Master is involved then during the execution Loop it'll pull gas or the fee out of the pay master all right so that's high level the flow of 4337 there's a lot of complexity added there and so we'll talk a little bit about like why is that better so so on the left um your guys's left side yes um this is the normal1 1559 transaction it has Max fee PRI uh Max priority fee per gas so on the right here the only addition that we also have is there's a verification gas limit a pre verification gas both of these are used for the bundler um there is an init code so that is the the code that deploys your smart wallet and there's pay master and data so this is the the uh field that you add to say hey this pay Master is going to pay for my transaction so those that's the additional complexity on a user op versus a um transaction okay and the bundler so what does the bundler do um it collects the list of user operations um it validates them so it does non checks it does Gas payment it does simulation it sees how much gas this user op is going to cost uh it then also in the bundle makes sure that all these user Ops can play nice to each other so there's no dependent user op operations on top of each other um it also does some fancy things with like uh deployment factories and stuff like that uh and then lastly it has like a reputation system to avoid poisoning of bad user Ops all right I'm going fast here just so that uh we can talk about smart wallet and see the demo all right so pay master um pay Master is completely optional so before you actually send your user up to um the bundler you can add a pay Master field to pay for the gas or the whole transaction and so some of these policies the main reason is like cover new users or to have a subscription service to where like maybe when I when I enter into a dow five of my votes a month or for free and that's just part of like the Dow's business model um of making it easier for new users to vote is that we'll cover the gas for your votes because you you paid for like joining um so some examples of this are you can do a certain number of user operations you could do like a total cost per time frame um you can use ERC 20s uh you could also do stuff completely offchain um so this is something that um I've seen on base a few times is people doing like a subscription service where it's $20 a month and they just pay for your gas um and they give you other benefits onchain um so it's a it's a cool mix of doing an offchain and onchain use case Okay so smart wallet so coinbase um we've had a Chrome extension and a mobile app for a few years now um we've released a V4 of the SDK a month or so ago um and in that it includes a pass key wallet um so this is meant to drastically improve onboarding and kind of show uh we wrapped all that complexity of 4337 into you as a developer can do the same transaction flow you're used to if you want to do user Ops you can um but let's see that in action this look that looks fine okay so this is a demo app I'm a first-time user I have a normal connect flow and as you can see here I'm given a popup to where I'm already signed in so let me sign out real quick one more time so I do not have a wallet yet so you can this works with your own flow if you have EAS and you want to support EAS but if you want a pass key wallet I can just hit create smart wallet here um this is making a pass key so I can choose to trust Apple keychain with my pass key I can choose to do Chrome profile with my pass key I can also do like UV Keys um or I can just use this device and keep it completely non-custodial um so that's one of my favorite parts of um Pas Keys is that you truly do have a non-custodial op and if you want to pass them device to device there's like a QR code flow um but for sake of ease you can use uh Google or Apple um I think Microsoft has a flow to an edge um but then I do my normal Biometrics that people are used to and that saves my pass key and now I actually have a working wallet and so with this wallet now um we won't show the block Explorer essentially I can mint transactions and some differences here in smart wallet are that you'll see that I have a sponsored by base here so I have a pay master um there's a new spec in the smart wallet that when you initialize wagm or VM you can say hey here's my pay Master URL here's the name I want to give it um so if I want this to be like Moshi cam or Unis swap or whatever app um you can specify who is actually paying for my fees um the other big thing I want to call out here is that there is payment methods I'm not going to run through this because it I have to do tofa and stuff because I'm in a different country um but I can pay with my coinbase retail balance so that's the other big benefit is that if I'm a current coinbase user I've never set up a wallet or done stuff on chain I can actually use my balance in my retail account directly on chain um and I can go through kind of Dev docs on that that make it make more sense but uh as I sign this is a pass key so it's just Biometrics if you're on like iPhone it'll be face ID um which a lot of people like um a lot of people have been playing with like the Apple VR and that you can you have face ID in that um here's my transaction I'm going to view it on block Explorer so just standard I got an nft I didn't pay any gas um the other thing I'll call out that if you're not used to 4337 is that that wallet didn't actually exist until um until I made that first transaction uh so just a little different okay so super high level that's smart wallet so as I showed pass Keys um cross device people are familiar with them you can now like log into PlayStation Xbox in your bank with pass keys so the normal user can use pass keys and it's not like setting something new and confusing um the my favorite part of this upgrade is that it truly is wallet V3 switched to wallet V4 um so it's already pretty wide out there it is a global wallet so it's not embedded it's not not tied to one domain or one website it is a popup that's tied to keys. coinbase.com um it is also cross chain so it's not only on base it's on um six to eight chains I'll double check when we when I pull up the docks um and then I talked about magic spend so right now magic spend is only connect to coinbase and then you have a series of what assets you have on Exchange um our goal and what we're actively working on is also using your existing coinbase payment methods where you could do this as well so if you have an existing bank or um credit card or debit card tied to your coinbase account you could actually just use that directly from within the the SM smart wallet interface um so upgrade instructions you literally just need to upgrade um to version 4 the SDK I would recommend the newest hot fix um and then I have a few different quick starts put down here um probably the simplest one is Wilson's here um to where it's very Bare Bones um and I'll pull it up in a second um there's a slightly more complicated scaffold e or sorry build on chain build on chain apps has examples of mft and a couple other flows and then scaffold eth if you're trying to do a hackathon project I've always liked scaffold eth um there's also like a scaffold hyphen base version out there um that has a couple other niceties in there okay um I'm doing all right on time I'm going to talk about the base stuff and then I'm going to show some code um so the base faour update went live um local time it was like 6:00 a.m. on Wednesday or Tuesday Tuesday um time zones are hard um but the the biggest feature that it helped for smart wallets is that it includes a pre-compile for the web offin pass Keys essentially um so it switched the gas overhead from a smart account from in this example 38k to 117 and that was doing just a simple eth transfer so it used to be before this update that it was like smart wallets the transaction fees were prohibitive and it made it a little more expensive and now they're much more in line um so I'm super excited that finally came out um next there's like a a brly compression Improvement so data availability cost it actually is like 10 to 20% in main net which I'm surprised SO gas fees are even less uh and then we made the L1 data fee um drop or more accurate so that when you do estimations it's better and then lastly something else that Bas is doing is we're increasing our Target gas per block um we're doing this not necessarily tied to a um a hard Fork but like every four weeks or so we up that and that just further increases um or reduces gas costs okay so actual smart wallet I want to show some some code examples so I I talked about a couple templates if you go to smart wallet.

which is kind of small here um I can show a QR code here in a second actually let me do that if that works um this website is kind of like has a whole bunch of code examples um it shows you how to get started it shows you uh two different um templates uh it's a great starting point I'll give that a second okay cool so some of these examples so we have a sign in with ethereum batch transactions is one of my favorite Parts um so just using wagm this walks through that essentially there is a check called use capabilities and if you have a capabilities called Atomic batch then if you send it a array of transactions so in this example it has a API for um saf Min to an address and then when you use wag me to write contracts you can actually just give it an array now to say hey I now want to call uh safe Min on two different nfts and I can do that in one signature rather than multiple um so this is super simple example um if you're doing a defy this would be a prooved token one proof token two actually do your liquidity or anything that involves like a a flow of um transactions you can do as user Ops and have multiple so for ux I think that's like a a major Improvement um pay Master this is another one that this example is a little more complicated but pay masters um this is an example that shows you can literally program it to be whatever you want it to be um so if I essentially just look at this one if you want to see it it it checks that you are using coinbase smart smart contract or smart wallet and then it's it's checking if you're calling a specific function on a specific uh a specific contract so like if I only want to approve the mint B uh the mint function on my ft rather than like all the functions like transfer then um you can do that and you can do fancier things okay um then I got like two minutes left so thanks for coming does anybody have questions yeah [Applause] any take there might be a mic maybe not go ahead so ear you said you can just choose if you want to pay through crypto or through regular funds through your coinbase retail funds yes coinbase ret yeah um so if you already have a coinbase account um magic spend um there's like this other capability called auxiliary funds so essentially we're just overloading the pay Master to where the pay Master can do more than pay for gas it can pay for the entire transaction so what we're doing in that um magic spend pay Master is we're just holding that balance on your coinbase account and then doing the transaction or paying for the transaction for you and so that's one of them of if I'm only a retail user it skips the whole like getting gas and even just paying for the nft you can do it directly from your retail balance yeah what's up I think I my question in my own paying for things and understanding like what you're spending on gas transaction for tax um yes so the when you actually do the the function it does break them out so it does tell you hey here's the network fee uh and this one I don't think has an additional fee otherwise it would have another line at the top here or it may just not be big enough yeah I think this one's just because it's free all right I think we're good on time thank you all for coming greatly appreciate it [Music]

Automatic transcript — names and jargon may be misspelled.