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

Loading player…

Base 🛠 Simplify UX with Account Abstraction and Base Paymaster

ETHGlobalWed, Oct 9, 2024, 12:00 AM

Join us for a workshop titled, "Simplify UX with Account Abstraction and Base Paymaster" Embark on a journey with ETHIndia, where innovation thrives, collaboration knows no bounds, and hierarchies fade into self-sovereign ownership. The most skilled web3 developers, designers and product builders from all around the globe came together for a weekend-long adventure to advance the Ethereum ecosystem at ETHIndia in December of 2023! ----------------- Follow us: https://x.com/ethglobal Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

[Music] hey I'm Carl fluke I'm a developer relations here at Bas um the agenda today I'm going to run through really quickly kind of what is the thesis of Base what are we trying to build um I'm going to go over pretty quickly about 4 337 account abstraction just so I can um kind of level set for what is happening um what is validation execution how does a pay Master work um I'm going to run through I may actually flip this order I may do a hard hat deploy first to just show how you can use account abstraction in the deployment process um and then lastly end with a front- end demo of how an enduser experience looks when you're trying to use um account abstraction with pay master um so y base that's always the first question we get is um why did uh coinbase decide to roll out a layer two um so the big thesis that we have is that onchain users continue to grow um we've seen ethereum scale um and we see it Contin continuing to scale so as we have more of those users we have more developers on chain uh and that's um kind of a key thing that we want to keep growing is having developers actually Building Products um to help consumers be successful on chain um as we get more developers then we actually have the the bandwidth to start to tackle new use cases um so some examples that we have on base here are like friend. Tech was a new social fi application that brought a ton of users on chain uh and it was very user friendly with the user on board in um if you're ever in New York City Blackbird is a restaurant loyalty they offer a bunch of like coupons and loyalty programs for um certain select restaurants um parallel um has brought a card game on Shane um they're starting to innovate in that gaming space um Bas paint. XYZ if you've never seen them it's kind of like Reddit art place to where uh it's pixel art um every day they have pixel artists make a new um image and then you have one day to Me Mint it so very consumer friendly to where there's a lot of crypto behind the scenes um but it's usable um and then lastly we have like our crypto stand with crypto um so just bringing more ad advocacy and government uh things on chain so most importantly um you can see this Oh I thought the internet wouldn't work um so you should see a blue line that has ethereum essentially at uh capacity for the past two or three years um and then you'll see there should be a red line to where l2s are now like 5x the throughput of what L1 is and we expect that to continue to grow um okay this one worked so although that we've seen all this growth we have more users on chain um we're still far from actually bringing the the mass adoption um we're less than 10 million people and there's eight billion in the world um so we have a long way to go and some of the key blockers that we see um is cheap block space um so L1 was very expensive I think we saw that after defi summer um people were much more questionable about like can I spend $15 or $20 for a dow vote um and some of that onchain activity started to slow just due to the price um wallet technology um so although like developers are very used to the current wallets they're used to the Chrome extensions and the mobile apps um they're still very financially focused and I think we have a long way to improve them and lastly identity um the blockchain is a permissionless Anonymous World um but once you start to add identity things you can start to have Primitives like credit um so that there's definitely some interesting growth for Iden on chain coming um base has been live since August so we're four four and a half months in now um here's a a long list of our uh which is not loading also sorry there should be like a hundred Dots here with eight categories um but we're continuing to grow uh so that's the quick thesis of base is we want to bring more developers and more users on chain um coinbase has 120 some million kyc retail users and we're trying to slowly bring that audience and that capital on chain so what is some fun things that Bas has been trying to improve in the op stack um the first was that we had a canyon Fork upgrade um this was uh three weeks ago I believe we deployed it to testnet and this makes it so that it's fully equivalent to L1 you can use the newest versions of solidity um it has a couple other upgrades to it um we moved our test net to spolia so um if you're not aware Gorly test net is going away at the end of January um so it's going to be a slow migration of all of our Dev tools to seia some teams have started but there's still a way to go um something very relevant to this talk is that we've been um experimenting with the pay master so how can base as a protocol make a pay master and help onboard apps and make them more usable um I'll go into depth as we get there um one two big protocol upgrades that we're actively working on um currently target targeted for like early February is the Denon uh layer One ethereum update and this would make um the first step of D sharting happen happing which should reduce gas cost for l2s by 60 to 80% um and so everybody's looking forward to that as far as the L2 world uh and then one more recently um EIP 7212 that makes it so pass Keys could natively use their signatures on chain um today you kind of have to do some trickery of you can still use um the pass key signature but then you're kind of using a temporary key and so we're looking at actually enshrining that into the base uh L2 okay so super quick run through of Base there um now let's talk about actual 4337 so we can level set so the demos make a little more sense um and my picture is still not loading okay so the first most important part is you have user operations I do have it now um so we have user operations here instead of transactions you have these things called user Ops uh the main advantage of user operations is that with 4337 you can batch these in multi call so if you're doing defi things um in traditional World you'd say hey I want to join this usdc uh usdt pool I have to approve usdc I have to approve usdt I then need to put what amount I want and then I get some kind of C token and I probably want to stake that for more rewards um so in the account abstraction world you can actually do all four of those in one batch transaction and the user approves something once um so that's kind of user Ops is they more or less replace transactions it just means you can also do more than one at a time um next is the bundler there's quite a few bundlers out there but the bundler is a a resource out there that essentially collects all these user operations and they bundle them into transactions so that's what makes multi call possible uh and that's also what can help reduce the gas cost of user operations next is the entry point it's probably the least exciting thing that is just where the bundler sends these user operations to and that entry point knows how to validate or execute um transaction actions um then we have our contract account so that's actually Which smart contract wallet am I using um there's a lot of interesting stuff happening in that space now um there's another EIP out there called um 6900 that's like uh standardized plugins um and some like bomy and uh Alchemy are starting to bring that third part or first party which is interesting um I'll skip over aggregators but then you have the pay master so the pay Master essentially allows the bundler to say hey this pay Master contract is actually going to pay for my gas for my user um and you can set kind of dynamic criteria of which users you want to pay gas for um and for the U ux of this that's really what um I think matters the most for today um so to run through kind of that in more of like a hey what actually happens with these user Ops um this did load perfect um so we have this collection of user operations they sit in this M Pool the bundler looks at that m poool it bundles them um then you see this Loop for validation so it looks through all those user Ops and says hey can I actually execute this and that's where the smart contract wallet can actually say yes I want to or no so if you want to put guard rails over like spending a certain amount per day um or you want to put custom validation logic you can um after you validate all of them then you look through actually executing them um so that's taking that call data and actually calling what you're trying to do so that's approv token one proof token two um or whatever your use case is specifically um and then lastly is that simplify gas so you can have the pay Master sign that they want to pay for this user operation um and then I'll show code examples of kind of like how you can actually do that okay so we're going to do a demo uh I'm going to do this backwards we're going to do the hard hat one first so let me how does this look that's good enough okay so in a traditional hard hat project you'd probably see it very common that you would just say hey I want to deploy a contract um and you would just give it the name and the system would be smart enough to actually look at what is the file that matches that in your contracts folder um so here's just an example I'm deploying a smart contract um I'm logging what is its address I'm storing a number in it um and then I'm just showing that I can also read read that number um if you need an example and you want to deploy through smart contracts um this is kind of like the easy code example to start so once I take that to the account extraction World um this will show you how to do it with um alchemy's account kit so this kind of runs through the setup of how do you actually go from a eoa to being a smart contract wallet so I'm extra I'm pulling out the pay Master part here um I'll end this section with that um the difference in is since we have to pull that ABI and bite code um out of the of the compiled contract so once you actually compile a contract you get these artifacts and the parts that actually Deploy on chain that matter is this storage. Json file and so you want this ABI which is your definition of saying hey what are my read methods what are my write methods and then equally importantly you want what the bite code that gets compiled that's what actually gets sent um over the transaction uh so once I have those I just am doing some setup of of what chain what addresses do I want to deploy I'm loading my eoa um I'm creating that Alchemy provider so this is very similar to just this is my RPC provider on what chain and then this is the part that's uh C abstraction specific so what this is doing is it's um it's specifying my eoa as the owner it's setting what is my entry point address which I'm just using alchemy's default and then it's setting the Factory address so you can customize both the entry point and the factory but this is just using the defaults so what's interesting here is this smart contract wallet actually doesn't get deployed until it it uh needs to be called so it's called a counterfactual deployment so you can find out the address of this account before it's us okay um so this is just showing that you can call get address uh before it's actually deployed um I'm setting up that paymaster middleware I'll dive into that in a second the main difference that you'll do uh for user Ops versus transactions is you encode your uh call data um as uh you'll either call encode deploy data or encode function data um and that just takes that AI invite code um since I'm a little tight on time I'm going to skip through I'm doing a create two deployment here just so I can know what that smart contract address is so I don't have to like use an indexer to find out I can find out counterfactually and then I can use that smart contract wallet to um call that deploy transaction so it's coming from my smart contract address I'm sending it to a a deployment proxy um and then I'm just passing in that that new contract and then I'm finding out that what that contract address is because I have create two um and then I'm doing the exact same stuff I did before um I'm saying hey I want to write a value one two three there uh just instead of me using a transaction like you would I have to encode the data as a function data here so I'm calling that function store um and I'm just giving it that new value so high level that's like you can use hard hat uh to deploy smart contracts or yeah to deploy new smart contracts tracks and the main advantage of that is like I don't need a faucet anymore I don't need to go to this permissioned situation uh I know that this network has a pay Master out there that will pay for my deployments so the the nitty-gritty of how our pay Master actually works um is there's two things in um the Alchemy SDK that I set up I'm going to skip over dummy because it's kind of the same thing um but what this does is you get these properties of what was that user operation um and you have these extra values here so you have um gas limit you have prever verification gas uh and you have your max priority fees um so all this is doing is it's taking all of those fees from your user op and it's sending it to this um pay Master it's just a simple rest call I'm posting that data and if it says that hey I will pay for this I can save that to the user up and then it's paid for um the bundler knows how to read that and pay for it okay so that is hard hat really quick um I'm going to run out of time so I will just quickly show oh my internet may not be good enough I should be seeing my smart contract wallet here let me okay yep I'm gonna run out of time so I'm GNA skip over the front end um most importantly you can find these examples the hard hat example which is probably the most useful for actually deploying is just a more or less a hard hat plug-in that lets you do that pay Master for you um that front end example is just a very barebones Alchemy example to M an FD and that's showing you the front-end experience of you can create a net new address that doesn't have any gas and you can do transactions uh and then lastly I net new added a bomy example that just shows how you can also set up that middleware and bomy um so that you have more choices than just alch me um and then yeah so that's my talk I went super quick um thanks for coming uh if you have any questions I'll be outside and I'll be at the base Booth all weekend

Automatic transcript — names and jargon may be misspelled.