all right hi baby Patrick all right here you go here is your 12w seed phrase now you're going to need that in order to generate your private key which you're going to use to sign all your transactions uh now just remember if you lose your seed phrase or you lose your private key you won't be able to send any more transactions ever and if you accidentally expose or leak your key or seed phrase whoever gets it will be able to spend all of your money what this is how a lot of people feel when trying to get their friends into crypto they tell them that they have to follow all these very difficult rules and if they break one of those rules they're going to get rug pulled for all their money so the wallet user experience for getting into crypto isn't great private keys can be very difficult to handle anything you want to do costs gas preserving privacy from your wallet can be difficult sending multiple transactions at once rely on you interacting with a middleman smart contract there are a lot of issues with current private key and wallet management and account abstraction is here to try to help aid those account abstraction can be boiled down to one single thing in a traditional transaction you need to use your private key to sign the data to send the transaction with account abstraction you can sign the data with anything to reiterate normally we validate transactions by signing them with our private key imagine being able to sign a transaction with your Google account with your GitHub account a transaction can only go through if three of your buddies give you a thumbs up you can only sign a transaction during the day you can't surpass some type of spending limit so one more time just to drill it in historically private key equals wallet with account abstraction whatever the hell you want is a wallet and with this whatever the hell you want with this customization this means that we can additionally have other people pay for our transactions right now if you want to do anything on chain anything at all you always need to have at least a tiny bit of gas and sometimes depending on the chain that you're working on getting that tiny bit of gas can be a huge pain in the butt but account abstraction can help solve this so if I really want to give baby Patrick his first wallet uh gooo Gaga I can actually code in some parental controls where he can create all the transactions and then I have to approve them and all of his super likes on skibbidy toilet I will definitely be approving so this all sounds fine and dandy but how does it actually work now getting into this is where this gets a bit complicated because there are two places where account abstraction exists as of March 1st 2023 the first official account abstraction smart contract was deployed to the ethereum mainnet called the entrypoint doou and you have to interact with this smart contract in order to do this account abstraction thing and other Chang like zync have this natively baked in so let's first learn how this works with ethereum which doesn't have it natively baked in and then we'll look at how it works with ZK sync which has what's called native account abstraction in a traditional ethereum transaction you take your metamask or your rabby or whatever wall you're using you sign a bunch of data you spend some gas and you send this onchain and the ethereum node will be the one that will add this transaction to a block in the blockchain right this is pretty well known whenever your metam mass pops up any of these transactions in here are you sending a bunch of data that you signed with your metamask your metamask did the signing send it to an ethereum node and it adds to a block but as we've been saying private keys are really sucky so how can we have an account without having to deal with private keys well you still kind of do have to deal with a private key and on ethereum the first thing you have to do is you have to deploy a smart contract that defines what is the thing that can sign transactions so you have to deploy some type of smart contract first to the blockchain whereas previously only private Keys could sign transactions but you could say all of my friends have to sign the transaction with their private keys or the Friends cast has to you could use something like a Google session key to be the one to sign transactions if you can code it you can build it so this smart contract will be your new wallet and you will have a smart contract wallet so now you might be asking okay cool but how do I like send a transaction through my smart contract wallet that is deployed will it like pop up in metamask for me well this is where it gets a little bit more complicated so now just remember traditionally you use your mamass you use your private key to sign some data and then you send it to an ethereum node and now the main difference is you are no longer sending your signed transaction your signed data to an ethereum node you're going to send this someplace else now now with account abstraction you'll sign your data with whatever you use to sign it could be Google could be your friends whatever and you're going to send something that's called a user operation to an ALT mempool so according to ERC 4337 which is the eipc for this you'll actually send this thing called a user operation which has all this additional transaction information and you're not going to send this to the blockchain you're instead going to send this to something called an ultimate pool and this is still going to be all offchain this Altman pool is basically just any group of nodes that are facilitating these user operations so this is why you actually don't have to spend any gas when you sign and send this transaction cuz you're actually not sending it to an ethereum node so there is a chance that you're not even going to be making transactions in your metamask when you send to this alt menol for at least on ethereum working with these alt men pools these account abstraction accounts the wallet ux is going to have to become a little bit more clever to deal with this now these alt men pools they are going to be the ones to actually pay some gas because what they're going to do is they're going to take your user operation they're going to validate it themselves they're going to make sure everything looks good and then they are going to be the ones to actually send your signed transaction on chain so it's the alt mempool nodes that are going to be sending the transaction and doing the traditional ethereum transaction so in ethereum account abstraction or ERC 4337 is just a framework that everyone's agreed upon for sending these user operations so these alt mempool nodes are going to be the ones to send this transaction and they're going to send it to this thing called entrypoint doou a group called eth infinitism won a grant from the ethereum foundation to be the one to create and deploy this contract it's this team that actually has deployed this entry point v07 on chain to ethereum optimism Arbitron polygon blah blah blah and so it's this address it's this smart contract that handles every single account abstraction user operations sent all of these alt mempo nodes calling this contract call this function called handle Ops where they pass all the data associated with a user operation which includes pointing to your smart contract account that you deployed so these all men pool nodes are going to deploy your contract for you it's going to always be routed through this entrypoint Doo which is going to do some validation and then it's going to be routed to your contract your smart contract account which is where everything will be directed from so when you you know work with an app when you send a transaction to something like a your account will be the message. sender or the from account here and it'll go through all the logic that your account set up so for example if you set it up so that only Google could sign Keys If Google didn't sign the keys this whole transaction here sent from the alt men pool nodes would revert and then of course once everything's included your transaction will be added to the blocks blockchain now there's a couple things here there's a couple of things called add-ons one of them is a signature aggregator this is where it Aggregates this is an optional add-on to account abstraction where this entry point will let you define a group of signatures that need to be aggregated this is where you can have like your friends be on your multisig and then there's also this thing called a pay Master which this is where it gets it's really cool where you can set up your codebase to have somebody else pay for the transactions so the alt mempool nodes of course will pay for the transaction to actually send it but then you can set up a contract called a pay Master which will just have the logic of saying hey so and so is actually going to pay for my transactions here and you defined all of this in your account you set it up as such now you might be thinking okay cool Patrick well I'm always going to do this if the alt mempool nodes are always going to pay for my gas well if you don't have a pay Master the alt mempool nodes will pay pay for your transaction but they will only pay for the transaction if one of these accounts on chain is going to pay for it so if you don't have a pay Master setup it'll try to pull funds out of your account and that's how the whole system works here so simple in concept very convoluted in practice here now this process obviously involves a lot of different steps a lot of different moving Parts you have to send to these alt men poool nodes they are going to be the ones to send to the onchain entry point you have to customize your account and blah blah blah do all this stuff some chains I've said you know what let's just do this natively ZK sync is one of these chains where they combine this process together let's look at how ZK sync does a count abstraction for ZK sync the process is going to look really similar you still have to deploy a smart contract that has all your rules codified but the main difference is that the alt mempool nodes are also the ZK sync nodes so we actually get to skip this step of having to send our transactions to this alt men poool because the ZK sync nodes also work as alt mempool nodes the reason ZK sync can do this is because they have what's called default accounts for every single account every single metamask account every single account in ZK sync is technically a smart contract account that has very specific functions and behaviors that can be validated so anytime you interact with any address it will always assume it's a smart contract because that's just how they work so what I'm showing you here is their default account smart contract anytime when you load up ZK sync into your metamask and your addresses are automatically created they are automatically connected to these default accounts and this is what the code of those addresses look like I've got a video coming out next where we're actually going to create some account abstraction accounts on both ethereum and ZK sync so you can see exactly what they look like and how they flow and how everything fits together so be sure to watch that as well if you want to learn how to actually code these things and hopefully we can save baby pass from having to deal with his private Keys himself thanks for watching and I'll see you next time [Music]