Author: Arrow@go2mars, Source: Author Twitter @ArrowCrypto_eth
Today we will talk about ERC-4337 (Ethereum account abstraction) based on intent transactions. In fact, in the previous article, we have already mentioned the role of Account Abstract in the project Bob the Solver.
ERC-4337 Account Abstraction
ERC-4337 aims to achieve account abstraction without affecting decentralization and censorship resistance, and users can enjoy a single account with both smart contract and externally owned account functions.
This means that the AA wallet can access the smart contract wallet without relying on a centralized relay controlled by a single entity, enabling transactions and creating contracts in a single contract account.
Account abstraction combines the functions of the existing two types of accounts ① externally owned account (EOA) and ② smart contract account (CA), bringing smart contract functions to the wallet in a single account. This makes future innovative wallet designs more likely.
Let’s first understand the basics of these two types of accounts.
An Ethereum account has four fields: {nonce, balance, codeHash, StorageRoot}, where:
①Nonce is a counter used to display the number of transactions sent by external accounts or the number of contracts created by contract accounts;
②balance – the amount of Wei owned by this address;
③codeHash - This hash represents the account code on the Ethereum Virtual Machine (EVM). Contract accounts have programmed pieces of code that perform different operations. This EVM code is executed if the account receives a message call. Unlike other account fields, it cannot be changed. All code snippets are saved under the corresponding hash in the state database for subsequent retrieval;
④storageRoot – sometimes called storage hash.
The two account types are:
①Externally Owned Accounts (Externally Owned Accounts), that is, EOA, is an externally owned account controlled by anyone who has a private key, and the codeHash is empty.
②Contact Account (Contact Account), that is, CA, has no private key, and codeHash is not empty.
The main difference between EOA external account and CA contract account is:
External holding account (EOA): It is free to create an account, and transactions can be initiated. Only Ethereum and token transactions can be performed between all external accounts, and it consists of a pair of encryption keys: the public key that controls account activity and private key.
Contract account (CA): There is a cost to create a contract because of the need to use network storage space; transactions can only be sent when they are received; transactions initiated from external accounts to contract accounts can trigger code that can perform various operations, such as transferring tokens Coins even create new contracts; contract accounts do not have private keys and are controlled by smart contract code logic.
The combination of the two accounts of ERC-4337 brings smart contract functions to the wallet in a single account, which brings a lot of room for imagination to the functions of the AA wallet.
At present, most Ethereum wallets are external holding accounts, such as the most widely used metamask little fox wallet.
But this kind of external wallet will be limited by the set rules of the external wallet. For example, your account access depends entirely on the private key, and all transactions need to be signed. If you lose the mnemonic, you will lose control of the wallet. .
Smart contract wallets managed by smart contract accounts can also implement this function, which brings convenience. The mnemonic is no longer needed, so there is no fear of losing the mnemonic, and multi-factor authentication and account recovery are realized. At the same time, various customized services can be realized.
How ERC-4337 works
The account abstraction proposal completely avoids the need to change the consensus layer protocol. In fact, a similar concept was proposed in the previous EIP-2938, but the consensus layer protocol needs to be changed. The idea of “delegating EOA control to a smart contract” is also proposed in EIP-3074.
Instead of adding new protocol features and changing the underlying transaction type, the ERC-4337 proposal introduces a higher-level pseudo-transaction object called UserOperation.
In the actual operation process, the user sends the UserOperation object to a new separate memory pool. These objects are then packaged into a single transaction by calling a special contract through the bundler (Bundler), and the transaction will also be included in a block.
The proposal also introduces a payment mechanism where users can pay gas fees with arbitrary ERC-20 tokens (such as USDC) instead of ETH, or allow their gas fees to be fully supported by a third party, all in a decentralized manner. way.
Intent transaction with ERC-4337
In ERC-4337, UserOperation is a “pseudo transaction object” that represents the user’s transaction intention. It can contain multiple instructions and additional data to execute the smart contract call initiated by the smart contract account. Later, driven by ERC4337, more and more intentions will be adopted.
Let’s take a look at dappOS, a Web3 operating protocol that has been very popular recently and is known as leading the new narrative of “Intent-Centric”.
dappOS is a Web3 operating protocol designed to make dApps as user-friendly as mobile apps. As the first Web3 unified operating protocol, it creates a layer between users and encryption infrastructure such as public chains and cross-chain bridges, enabling users to easily interact with dappOS and complete verification and verification in a decentralized world. implement. DappOS includes the function of recovering the mnemonic words that were accidentally deleted, and users can reset their accounts through other devices or even third-party KYC services.
The solution is mainly composed of two parts:
①dappOS Account: The user uses a unified account based on account abstraction instead of an external account EOA, which makes it possible for users to restore accounts, pre-batch transactions, and automate execution. At the same time, the way of multi-chain wallet aggregation can also facilitate users. Unified management of assets on different chains;
②dappOS Network: a decentralized network that helps users automatically perform wallet and cross-chain related operations, and complete the complex interaction process behind the transaction.
So based on dappOS, in the future, it will be possible to create foolish dapps more quickly. For users, they only need to clarify the intention of what they want to do, instead of performing the operation themselves, all operations can be completed with only one signature.