# A primer on EIP-4337, Account Abstraction. Part 1: wallets ## Introduction This article is part of a multi-part series which hopes to get you up to speed with account abstraction and how all the components work together. ### What's the hype behind AA ? Account Abstraction is set to bring features that web2 folks are all familiar with and more such as - Custom authentication such as a username/password, 2FA, social log-in into your Ethereum account - Account recovery using social logins, OTP and security questions such as the mother's maiden name - batched transactions. No longer will you need to do two transactions to swap in a new pool in uniswap - Multi-signature accounts. - Sponsored transactions. Ads that give you free gas in case you interact with specific dapps All of these while still giving you self-custody. In-essence no more private key, seed phrase to deal with while maintaining the security! ![https://i.imgur.com/5agDNQ8.gif](https://i.imgur.com/5agDNQ8.gif) ## Let's get technical ### What is ethereum's account abstraction? The goal with account abstraction is to abstract away the logic of the account/wallet and make them more capable than current wallets such as meta mask, trust wallet, etc. Technically this will be done by moving all accounts from Externally owned wallets ( EOA ) to Smart Contract Wallets ( SCW ), thus bringing about a lot more capability and creativity in terms of the implementation of wallets. Before we get into the details, it is better to understand how wallets work and what the terms SCW and EOA mean. ## Accounts ### How do Ethereum accounts work? To use the Ethereum network, you must create an Ethereum account. A typical Ethereum account has a public address and a private key. You should not confuse Ethereum accounts for Ethereum wallets, as the latter is only an interface that helps you interact with tokens on the blockchain. An Ethereum account consists of five key components: nonce, contract code, balance, codeHash, and storageRoot. - **Nonce**: The nonce is a counter that tracks the number of transactions an account sends or contracts an account creates, depending on the account type. - **Balance**: The balance is the amount of wei owned by an account. Wei is a denomination of ether, Ethereum's native currency. - **Contract Code**: This is only present in SCW. But note, that they cannot be altered once executed. - **codeHash**: The codeHash of an Ethereum account is the code tied to that account on the Ethereum Virtual Machine, a virtual computer built on the Ethereum blockchain. Since only contract accounts (explained below) are tied in code to the EVM, in accounts without code (also known as externally owned accounts or EOA), the codeHash is an empty string. - **StorageRoot**: The storageRoot of an Ethereum account is the hash that encodes the account's storage content. Also known as the storage hash, it is a 256-bit hash of a Merkle Patricia trie's root node. A Patricia Merkle Trie is one of the key data structures for Ethereum’s storage layer and provides a cryptographically authenticated data structure that can be used to store all (key, value) bindings. Essentially, Ethereum accounts are of two types: externally owned accounts (EOA) and contract accounts (CA). Let’s have a look at both types of accounts and what differentiates them. ![https://media.geeksforgeeks.org/wp-content/uploads/20220721160225/1235311.jpg](https://media.geeksforgeeks.org/wp-content/uploads/20220721160225/1235311.jpg) ### Externally owned wallets Externally Owned Accounts (EOA) in Ethereum are a type of account that is created and managed by a private individual or entity. These accounts are used to send, receive, and store Ether (ETH) or any other Ethereum-based tokens such as ERC-20 and ERC-721 tokens. An EOA has a unique public address and a private key. The private key is used to sign transactions and is essential for the account owner to access and control the funds stored in the EOA. The public address is used as the recipient address for incoming transactions. EOAs are simple accounts and do not have any associated data storage or code. They do not have any computational or storage requirements on the Ethereum network, which means they incur no cost to create. One of the most significant advantages of EOAs is the control they give to the account owner over their funds. The private key gives the account owner full control over the funds in the EOA and the ability to initiate transactions, interact with smart contracts, and transfer ETH or tokens to other EOAs. In summary, EOAs are a type of account in Ethereum that allows individuals or entities to send, receive, and store ETH and other Ethereum-based tokens. They are simple accounts with no storage or code requirements, and the account owner has full control over the funds stored in the EOA through the private key. ### Smart contract wallets Contract accounts are a tad different from EOAs, as a code written on the EVM controls their activities. They are also commonly known as smart contracts. This code, once written, cannot be altered and will define the nature of transactions the contract account can complete. CAs do not initiate transactions, unlike their EOA counterparts. Instead, they can only send transactions in response to a transaction received. For example, if you send a token to a contract account to exchange said for ETH tokens, the CA receives your transaction and, through its code, sends the corresponding amount of ETH to your address. Apart from transferring tokens, contract accounts can also create new contracts. Since CAs are controlled by their code's logic, they do not have private keys. Also, contract accounts use network storage. As such, creating them comes at a cost. The nonce of a contract account counts the number of contracts every specific CA has created. ## Summary In essense there are two main ways to create a ethereum account for a person. These topics are important since the goal of account abstraction is to move from externally owned wallet to smart contract wallets. In the coming parts , we shall look at how signatures and verification is done using the different accounts.