--- type: slide --- <!-- .slide: data-background="https://upload.cc/i1/2022/10/24/Zacl5b.png"--> <style> .small {font-size: 24px;} .medium {font-size: 30px;} .hl {color: #fcba03;} </style> # ERC 4337 # Account Abstraction (AA) --- # Ethereum Account - <span class="medium">Externally-owned account (EOA): 由私鑰控制的個人錢包,例如 MetaMask</span> - <span class="medium">Contract Account (CA): 由智能合約控制的錢包</span> --- # Ethereum Account <span class="medium">交易Transaction只能有EOA發起,並且付Gas</span> ![](https://i.imgur.com/v5m15o3.png) --- ## Classic Account Security - Authentication -- ECDSA - Replay Protection -- Sequencial nonce - Payment (Dos protection) -- Account Payment (Gas) --- ### Account Abstraction - Authentication -- <span class="medium">Different schemes (ECDSA、BLS、Quantum-resistant)</span> -- <span class="medium">Change signer</span> -- <span class="medium">Multiple signers</span> -- <span class="medium">Recovery</span> - Replay Protection -- <span class="medium">Sequencial nonce</span> -- <span class="medium">Parellel, multi-dimentional</span> - Payment -- <span class="medium">Account Payment (Gas)</span> -- <span class="medium">Paymasters</span> --- # 功能特性 - Social Recovery - Multisig - Bundled transactions -- save time & gas fee - Preapproved transactions - Sponsored transactions courtesy of Paymasters -- Any token gas -- 3rd party payment in fiat - Subscription-based models - Multi-factor authentication --- # AA history - <span class="medium">EIP-86: 引入account contracts作為「轉發合約」,任何人都可以從入口地址轉發交易</span> - <span class="medium">EIP-1014: 預測部署合約地址,發揮合約錢包CA作用,確保CA在所有EVM鏈上相同</span> - <span class="medium">EIP-2938: 創建全新的操作密碼進行AA交易,因協議變更過大而被放棄</span> - <span class="medium">EIP-3074: 創建兩個全新的OpCode,一起使用時允許CA代表EOA發送交易,但面臨安全風險未被實施</span> - <span class="medium">EIP-4337:不修改共識層,引入了User Operations,並可以Bundler打包上鏈</span> --- # AA Components-1 - UserOperation - a new transaction type - Wallet (Account) -- Wallet Contract - a contract representing a user account -- Wallet Deployer - a contract (singleton) that creates a wallet -- contract -- Wallet Software - UX to sign and send the UserOp to the nodes. --- # AA Components-2 - Paymasters - a contract that can pay for transaction instead of wallet itself - Bundlers - a network nodes that added support for AA - EntryPoint - execute UserOps as standard transactions --- ### Off-chain architecture ![](https://i.imgur.com/cX8f6od.png) --- ### on-chain flow ![](https://i.imgur.com/69Hz5sr.png) --- ## Reference - https://beincrypto.com/learn/erc-4337/ - https://bit.ly/aawallet1 - https://foresightnews.pro/article/detail/27311 - https://www.panewslab.com/zh_hk/articledetails/v2ye3h9dm9hu.html - https://beincrypto.com/learn/erc-4337/ --- # Q & A --- ### 運行流程 ![](https://i.imgur.com/aOv80GO.jpg =600x) - User Operations - Bundler 打包 - 運行交易