<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>SteveIsEmployed</title>
        <link>https://paragraph.com/@steveisemployed</link>
        <description>Current Student @Wharton, Researcher @ThreeDAOspace, Frontend and Protocol Developer, prev. @Foresight Ventures</description>
        <lastBuildDate>Mon, 09 Nov 2026 05:33:41 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>SteveIsEmployed</title>
            <url>https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/a148436306a84ce61eb953cddb37fe7a602d63735b9fe9cf84cb4e61e69b4a5a.jpg</url>
            <link>https://paragraph.com/@steveisemployed</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[Web3的下一个十亿级用户市场？全面深度解读账户抽象和EIP 4337的技术和应用场景]]></title>
            <link>https://paragraph.com/@steveisemployed/web3-eip-4337</link>
            <guid>b9wObRbHMYDL5SGiYJ8S</guid>
            <pubDate>Tue, 11 Apr 2023 18:28:56 GMT</pubDate>
            <description><![CDATA[作者：Steve Wang，万物岛独立研究员，沃顿商学院在读，前端和合约工程师 推特：@SteveIsEmployed（欢迎关注） 微信：clairvoyant_98（欢迎交流探讨）简介以太坊改进提案4337（EIP 4337）定义的账户抽象是一组协议层的接口。它不仅集成了web2用户熟悉的交互形式，如多因素认证（multi-factor authentication），还给web3特有的用户痛点提出了解决方案，如无需手续费（gasless）的交易。作为引入下十亿用户的协议接口，用户体验是账户抽象最关注的重点。 虽然许多现有的文章很好地解释了账户抽象，但是大多偏科普向，也有少数十分深入于技术细节。**本文旨在融合两者：既提供关于账户抽象概念的全面技术解读，也分类剖析现有应用和基础设施的案例。**因此本文分为三部分：在第一部分，我们将探讨EIP 4337的起源，并深入了解其技术细节，包括用户操作（UserOperation）、打包器（Bundler）、入口点合约（Entry Point Contract）、代付合约（Paymaster）、钱包工厂（Wallet Factory）和签...]]></description>
            <content:encoded><![CDATA[<p>作者：Steve Wang，万物岛独立研究员，沃顿商学院在读，前端和合约工程师</p><p>推特：<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/SteveIsEmployed">@SteveIsEmployed</a>（欢迎关注）</p><p>微信：clairvoyant_98（欢迎交流探讨）</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">简介</h2><p>以太坊改进提案4337（EIP 4337）定义的账户抽象是一组协议层的接口。它不仅集成了web2用户熟悉的交互形式，如多因素认证（multi-factor authentication），还给web3特有的用户痛点提出了解决方案，如无需手续费（gasless）的交易。作为引入下十亿用户的协议接口，用户体验是账户抽象最关注的重点。</p><p>虽然许多现有的文章很好地解释了账户抽象，但是大多偏科普向，也有少数十分深入于技术细节。**本文旨在融合两者：既提供关于账户抽象概念的全面技术解读，也分类剖析现有应用和基础设施的案例。**因此本文分为三部分：在第一部分，我们将探讨EIP 4337的起源，并深入了解其技术细节，包括用户操作（<code>UserOperation</code>）、打包器（Bundler）、入口点合约（Entry Point Contract）、代付合约（Paymaster）、钱包工厂（Wallet Factory）和签名聚合器（Signature Aggregator）。在第二部分，我们将分析现有的市场玩家，包括智能合约钱包和第三方基础设施提供商。在第三部分，我们将讨论账户抽象的发展方向，包括该领域的创新展望和预测。</p><p>本文篇幅较长，第一部分主要为账户抽象的技术解读，只对账户抽象的应用场景感兴趣的读者可以直接跳到第二部分。</p><h2 id="h-eip-4337" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">第一部分：EIP 4337的全面技术分析</h2><p>首先来简要回顾一下基础知识，<strong>以太坊有两种类型的账户：外部拥有的账户（externally owned accounts，即EOA）和合约账户</strong>。</p><ul><li><p><strong>EOA</strong>是用户控制的账户，可以发送交易。EOA通过其私钥控制账户的所有权，可以通过签名执行交易，从而改变EOA的内部状态或外部合约账户的状态。由于私钥（或种子短语）是EOA所有权的唯一代表，EOA不适合定义复杂的所有权或交易逻辑，如使用社交媒体账户登录（social login）和多方签名（multisig）的交易。**EOA的局限性导致用户体验不佳：一些冗杂的步骤，如私钥和种子短语管理，更是直接阻碍了Web2用户进入Web3。**大多数最受欢迎的钱包，如MetaMask，都是基于EOA的账户模型。</p></li><li><p><strong>合约账户</strong>可以托管任意的Solidity代码，因此可以发挥EVM全部的图灵完备特性。遗憾的是，合约账户不能发送交易，因此它们的功能必须由EOA触发。智能合约钱包是一种合约账户，通过钱包提供商的EOA网络间接地被其用户触发，无论是通过中继器（relayer）还是打包器（Bundler）。</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/d4604853b09c3efad1d52db8614b840ec24006faed3019b5966496c858e67b95.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：EOA与合约账户（来源：Bitcoin Insider）</em></p><p>智能合约钱包早在EIP 4337之前就已存在。EIP 4337的提出是为了标准化设计智能合约钱包及其相关基础设施的通用功能。EIP 4337遵循以下几个设计原则：</p><ul><li><p>总体而言，<strong>所有的技术实现都在顶层（智能合约层）</strong>，从而避免触及共识层和执行层等底层基础设施。账号模型这种基本设计如果在底层改动会成为像以太坊PoS主网合并一样的重要升级。因为开发人员的精力有限，只能采用合约层实现的轻量级技术路线。</p></li><li><p><strong>协议接口的设计应该是模块化的</strong>，这样用户可以自定义选项，包括交易打包处理（Bundler）、gas代付（Paymaster）和签名聚合（Aggregator）。</p></li><li><p>理想情况下，<strong>上述每项服务都将成为一个具有竞争性的开放市场</strong>。用户可以根据提供商的价格和声誉选择最佳的服务。</p></li></ul><p>EIP 4337为标准化智能合约钱包定义了<strong>六个合约接口</strong>：</p><ul><li><p>首先，<strong>智能合约钱包本身</strong>，会通过打包器触发入口合约来间接触发，在链下验证交易，然后在链上执行。</p></li><li><p>其次，<strong>打包器（Bundler）</strong>，用于批量验证和执行用户操作（<code>UserOperation</code>，即EIP 4337定义的智能合约钱包的交易类型）。</p></li><li><p>第三，**入口合约（Entry Point Contract）**是在以太坊只存在一份的全局合约，用于标准化交易执行并防止打包器受到恶意交易的DoS攻击。</p></li><li><p>第四，<strong>代付合约（Paymaster）</strong>，用于代表钱包用户处理gas支付。</p></li><li><p>第五，<strong>合约工厂（Wallet Factory）</strong>，用于标准化钱包创建的参数和流程。</p></li><li><p>第六，<strong>签名聚合器（Signature Aggregator）</strong>，用于将多个交易的签名聚合为字节，以便更快地验证和执行交易。</p></li></ul><p>下面我将详细介绍用户操作（<code>UserOperation</code>）和上述的六个合约接口，是对官方EIP 4337文档和David Philipson@Alchemy账户抽象系列的解读。</p><h2 id="h-1-useroperation" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">1. 账户操作（UserOperation）</h2><p><code>UserOperation</code>**本质上和普通交易相同，只是基于EIP 4337的合约接口定义了额外的参数。**这里回顾一下，一个EOA触发的普通以太坊交易有交易目标地址、转账以太坊数量、gas数量和gas价格等参数。</p><p>此外，考虑到EIP 4337合约接口的模块化设计，<code>UserOperation</code>包括以下主要参数用于定义接口的触发：</p><ul><li><p><code>calldata</code>：定义要在智能合约钱包上调用的<strong>函数签名（function signature）和输入参数</strong>，<code>calldata</code>在普通交易中也有</p></li><li><p><code>signature</code>：验证交易确实来自某智能合约钱包地址，<code>signature</code>在普通交易中也有</p></li><li><p><code>nonce</code>：防止重放攻击，在普通交易中也有</p></li><li><p><code>sender</code>：指定执行<code>UserOperation</code>的智能合约钱包地址</p></li><li><p><code>paymasterAndData</code>：<strong>用于交易手续费抽象（gas abstraction）</strong>，包含代付合约（Paymaster）地址和gas支付的具体参数</p></li><li><p><code>initCode</code>：<strong>用于钱包创建</strong>，包含钱包工厂（Wallet Factory）合约地址和创建智能合约钱包的参数，如钱包的合约代码</p></li></ul><p><strong>除了需要额外的参数以外，</strong><code>UserOperation</code><strong>的工作流程与普通交易类似：它们都被广播到mempool中进行验证、执行并最终完成出块。</strong><code>UserOperation</code><strong>的验证和执行由打包器（Bundlers）触发</strong>，我将在下文中解释。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/806e6bbf71fd7f1664acc7b729fde22a1c8a7d827a506d451ab04bdce22f6a3f.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：官方EIP 4337文档对</em><code>UserOperation</code><em>参数的定义</em></p><h2 id="h-2-bundler" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">2. 打包器（Bundler）</h2><p><strong>Bundler是一个外部账户（EOA），代表用户在智能合约钱包上验证和执行</strong><code>UserOperation</code><strong>交易</strong>，因为在以太坊上，所有交易都必须由EOA触发。<strong>Bundler使用户不用创建和记忆EOA的私钥就可以触发智能合约钱包交易</strong>，这也是智能合约钱包存在的初衷。</p><p>虽然Bundler具有很强的公共物品（public goods）属性，<strong>他们也可以获得经济上的利益</strong>，因为：</p><ul><li><p>Bundler可以在执行<code>UserOperation</code>后将最大优先gas费（maximum priority fee）与实际gas花费之间的差额收入囊中</p></li><li><p>与普通交易的中继器（Relayer）类似，Bundler可以通过排序捆绑交易（bundle）中的<code>UserOperation</code>来获取MEV</p></li></ul><p>尽管用户付出了成本，<strong>但Bundlers对于节省gas是有好处的</strong>，因为每执行一笔交易都需要21,000 gas的固定成本，而执行捆绑交易可以把一笔交易的固定成本分摊给捆绑交易里的多<code>UserOperation</code>，从而节省gas成本。此外，在同一笔交易中多次修改storage，每次额外操作的gas费都会边际递减。</p><p>需要注意的是，尽管以太坊上的交易是线性执行（非并行）以避免状态冲突（state conflict），多个<code>UserOperations</code>可以放在一个捆绑交易里执行，因为Bundlers可以设置同一智能合约钱包地址最多包含一个<code>UserOperation</code>，这样捆绑交易在修改状态时不会相互冲突。</p><p>除了这些差异之外，<strong>Bundlers与区块构建者（Block Builder）类似</strong>，因为它们都将经过验证的<code>UserOperation</code>广播到公共或私有的mempool中。接下来，我们将介绍<strong>入口点合约（Entry Point Contract）</strong>，Bundler需要与之交互来执行<code>UserOperation</code>。</p><h2 id="h-3-entry-point-contract" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">3. 入口点合约（Entry Point Contract）</h2><p>入口点合约是一个全局单例（global singleton）合约，<strong>所有Bundlers都需要调用它来执行</strong><code>UserOperation</code><strong>。它充当了Bundler与智能合约钱包之间的中间人：</strong></p><ul><li><p>一方面，Bundlers调用入口点合约的<code>handleOp</code>函数，该函数接受一个<code>UserOperation</code>作为输入参数。<code>handleOp</code>负责根据<code>UserOperation</code>的<code>calldata</code>验证并执行智能合约钱包的函数</p><ul><li><p><code>handleOp</code>首先在链上验证<code>UserOperation</code>，检查它是否由指定的智能合约钱包地址签名，以及钱包是否拥有足够的gas来补偿Bundler</p></li><li><p>如果验证成功，<code>handleOp</code>将根据<code>UserOperation</code>的<code>calldata</code>中定义的函数签名和输入参数执行智能合约钱包函数</p></li></ul></li><li><p>另一方面，<strong>智能合约钱包需要向入口点合约存入代币用于支付gas费用给Bundlers</strong>。当Bundler使用EOA触发<code>handleOp</code>函数时，会产生gas费用。</p><ul><li><p>除此之外，智能合约钱包也可以用自己的账户余额支付gas费用给Bundler，也可以请求代付合约（Paymaster）代为支付，我们稍后会详细解释</p></li><li><p>没有足够gas的<code>UserOperation</code>在目标智能合约钱包中无法通过验证步骤，因此在执行之前就会失败</p></li><li><p>即使有足够的gas，<code>UserOperation</code>在执行步骤中仍可能失败，例如runtime error</p></li><li><p>无论执行是否成功，入口点合约都将支付gas费用给Bundler触发<code>handleOp</code>函数</p></li><li><p>入口点合约提供了智能合约钱包添加或提取代币抵押的函数</p></li></ul></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/95b8b4a9bfc2ed06658e714bfe3c56f3f0e82f83fcd283e4d97d833194a7e675.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：官方EIP 4337文档中的入口点合约工作流程</em></p><h2 id="h-4" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">4. 智能合约钱包主合约</h2><p>智能合约钱包主合约将<code>UserOperation</code>的验证和执行步骤分开：</p><ul><li><p>验证步骤在<code>validateOp</code>函数中定义。此函数会被调用两次：第一次是Bundler在链下模拟验证，验签<code>UserOperation</code>中的签名，并确保智能合约钱包有足够的gas余额；第二次是入口点合约在执行<code>UserOperation</code>之前进行链上验证</p></li><li><p>执行步骤在<code>UserOperation</code>的<code>calldata</code>中定义，用于指定智能合约钱包函数的签名和输入参数</p></li></ul><p><strong>通过分离</strong><code>UserOperation</code><strong>的验证和执行，Bundler可以在链下验证</strong><code>UserOperation</code><strong>，从而不需支付gas就可以过滤掉恶意交易。</strong> 因此<code>validateOp</code>函数也起到了链下debug API的作用。</p><h2 id="h-5-paymaster" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">5. 代付合约（Paymaster）</h2><p>代付合约（Paymaster）定义了智能合约钱包的gas抽象的逻辑。**Gas抽象的形式包括用ERC20同质化代币支付以太坊gas和无需gas的交易，两者都可以由Paymaster来实现。**ERC-4337的模块化设计允许<code>UserOperation</code>通过<code>paymasterAndData</code>参数指定任意的Paymaster地址和输入参数。Paymaster具有以下功能和要求：</p><ul><li><p>本质上，Paymaster是由dApp部署的智能合约，可以通过Bundler触发Paymaster的<code>validatePaymasterOp</code>函数以任意逻辑有选择性地为合约指定的<code>UserOperation</code>支付gas</p></li><li><p>Paymaster需要在入口点合约上存入以太坊用于支付<code>UserOperation</code>的gas</p></li><li><p>除了存入gas外，Paymaster还需要在入口点合约上额外质押以太坊。这个质押不会被slash，但可以防止机器人恶意批量创建Paymaster</p></li></ul><p>Paymaster（至少在官方的愿景中）是一个充满竞争的开放市场。虽然官方没有定义Paymaster的链上信誉系统，<strong>Bundlers可以在链下记录Paymaster的服务质量并停止使用质量较低的Paymaster</strong>，<strong>从而激励Paymaster为</strong><code>UserOperation</code><strong>提供可靠的服务。</strong></p><p>Paymaster接口定义了两个函数：</p><ul><li><p><code>validatePaymasterOp</code>：定义gas抽象逻辑。例如，在一个智能合约钱包以ERC20代币支付gas的场景中，此函数将确保钱包具有足够的余额。<code>validatePaymasterOp</code>在执行<code>UserOperation</code>之前被调用，<strong>符合将验证步骤和执行步骤分开的设计逻辑</strong></p></li><li><p><code>postOp</code>：在智能合约钱包执行某一函数的最后一步被调用。如果钱包没有足够的ERC20余额来支付gas费给Paymaster，<code>postOp</code>会取消函数执行。即使在此步骤中函数执行因为runtime error失败，gas仍然会被扣除。</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/ae4c0b6bb40c83b76b24f555454940ec6909f8502891ef19fe1f24b685d45a06.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：官方EIP 4337文档中的Paymaster工作流程</em></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/994f855c6883803444ddafc3604f441241c60ae7b8b8b8f19b07b6c99c6ef17c.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：官方EIP 4337文档中的Paymaster接口</em></p><h2 id="h-6-wallet-factory" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">6. 钱包工厂（Wallet Factory）</h2><p><strong>Wallet Factory是一个创建智能合约钱包的合约。</strong> 回顾一下，<code>UserOperation</code>有一个可选的<code>initCode</code>字段。当<code>initCode</code>为空时，<code>UserOperation</code>只是触发智能合约钱包的功能。当<code>initCode</code>填充了Wallet Factory地址和新智能合约钱包的参数时，Bundler将触发相应的Wallet Factory使用指定参数创建智能合约。</p><p>Wallet Factory在以下方面有助于实现账户抽象：</p><ul><li><p>用户可以通过提交填充了<code>initCode</code>的<code>UserOperation</code>来请求Bundler创建智能合约钱包，而无需拥有EOA来自行创建</p></li><li><p>用户可以通过选择具有特定定制选项的Wallet Factory并传入自己的参数来定制智能合约钱包。此外，因为<strong>Wallet Factory合约是公开的，而且受欢迎的Wallet Factory会经过全面的代码审计，所以使用Wallet Factory创建新钱包对用户更安全</strong></p></li><li><p>用户可以选择让Paymaster代付创建钱包的gas或者用任意ERC20代币支付gas，无需拥有以太坊。此外，Paymaster可以选择只为其信赖的Wallet Factory部署的智能合约钱包支付gas</p></li><li><p>用户可以在创建钱包之前通过调用<code>CREATE2</code>函数获取他们的智能合约钱包地址。该函数使用触发智能合约钱包创建的EOA地址、一个salt和<code>initCode</code>确定性地生成智能合约地址。<strong>用户在创建钱包时不需要支付gas，只需要在用钱包进行第一笔交易时同时支付创建钱包和交易的gas，从而提高用户体验</strong>。</p></li></ul><p>Wallet Factory还有其他职责。与Paymaster类似，它们需要在入口点合约上抵押ETH并持续性地为<code>UserOperations</code>提供良好的服务，以便从Bundler那里获得更多流量。</p><h2 id="h-7-signature-aggregator" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">7. 签名聚合器（Signature Aggregator）</h2><p>因为不同的智能合约钱包使用不同的签名算法，所以需要先将使用相同签名算法的<code>UserOperations</code>聚合起来，然后分别进行验证。此外，由于链上密码学计算会消耗大量gas，<strong>支持聚合的签名方案（如BLS）可以在链上验证过程中节省gas</strong>。因此我们需要一个名为签名聚合器（Signature Aggregator）的EIP 4337智能合约接口。它可以通过实现以下两个函数来支持特定的签名算法：</p><ul><li><p><code>aggregateSignatures</code>：输入参数为一个<code>UserOperations</code>数组，并使用特定的签名算法输出一个聚合签名</p></li><li><p><code>validateSignatures</code>：输入参数为一个<code>UserOperations</code>数组和一个聚合签名，用于对数组里的所有<code>UserOperation</code>进行验签</p></li></ul><p>与其一次验证一个<code>UserOperation</code>，Bundler首先会使用多个签名聚合器合约（每个签名算法使用一个）生成多个聚合签名（每个签名算法生成一个）。之后，Bundler将<code>UserOperation</code>数组、聚合签名和聚合器地址传递给入口点合约，每个<code>UserOperation</code>数组会调用其对应的签名聚合器的<code>validateSignature</code>函数。验证通过后，Bundler就会在智能合约钱包上执行这组<code>UserOperations</code>。</p><p>与Paymaster和Wallet Factory类似，聚合器也需要在入口点合约上质押以太坊并保持为<code>UserOperations</code>提供良好服务的记录。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/1c2644de9c9ddea5a9c6963a4d0467d67b71d1ade415645b145cb39e583f807f.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：官方EIP 4337文档中的签名聚合器接口</em></p><h2 id="h-8" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">8. 整体工作流程总结</h2><p>EIP 4337的模块化设计将智能合约钱包的账户抽象功能分为多个接口。这些接口的功能合在一起可以总结为如下的工作流程：</p><ul><li><p>用户向Bundler发送<code>UserOperation</code></p></li><li><p>如果<code>UserOperation</code>填写了<code>initCode</code>参数，Bundler会触发Wallet Factory来创建有确定地址的新钱包</p></li><li><p>如果<code>UserOperation</code>填写了<code>paymasterAndData</code>参数，Bundler会收取Paymaster在入口点合约上质押的以太坊来支付gas。如果没有填写<code>paymasterAndData</code>，Bundler会收取智能合约钱包在入口点合约上质押的以太坊来支付gas</p></li><li><p>Bundler可以选择性地使用签名聚合器</p></li><li><p>Bundler会使用<code>validateOp</code>、<code>validatePaymasterOp</code>和<code>validateSignatures</code>函数在链下模拟验证<code>UserOperation</code>，确保签名正确且<code>UserOperation</code>有足够的gas</p></li><li><p>如果链下模拟验证通过，Bundler将使用上述函数在链上验证<code>UserOperation</code></p></li><li><p>如果链上验证通过，Bundler将在链上执行<code>UserOperation</code>，无论执行是否成功，都会扣除gas</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/0c274d72add6901efa93e5a073c84c4f56da8892343d82b44cb7a4a26d50ba74.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：没有签名聚合器的账户抽象工作流程（Alchemy提供）</em></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/7a3b92350f39a6eeb2f5d15f5643f7d451279061da823d980f2056ea133f9e0d.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：带签名聚合器的账户抽象工作流程（Alchemy提供）</em></p><h2 id="h-9" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">9. 其他注意事项</h2><p><code>UserOperation</code>在链下和链上都会触发<code>validateOp</code>等函数进行交易验证。为了防止智能钱包合约外部的状态变化（state change）导致链下和链上的验证结果不一致，EIP 4337禁止验证函数使用读取合约外部storage和读取全局状态（如时间戳）的OpCodes。这种禁止适用于<code>validateOp</code>、<code>validatePaymasterOp</code>和<code>validateSignatures</code>这些验证函数。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">第二部分：账户抽象市场参与者</h2><h2 id="h-1-sdk" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">1. 智能合约钱包及配套SDK</h2><p>智能合约钱包是账户抽象市场中最大的参与者。为了与EIP 4337兼容，它们通常会实现自己的打包器（Bundler）、代付合约（Paymaster）、钱包工厂（Wallet Factory）和签名聚合器（Signature Aggregator）。这些钱包还配备了方便dApp集成钱包的SDK。<strong>智能合约钱包市场比较拥挤</strong>，既有老牌大玩家如多签钱包Gnosis Safe在原有产品基础上实现账户抽象功能，也有市场新人如Candide专注于构建完全兼容EIP 4337的智能合约钱包。本节将介绍这些钱包的共同特点以及每个特点中的差异化。</p><h2 id="h-a-social-loginsocial-recovery" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">a. 社交登录（social login）和社交恢复（social recovery）</h2><p><strong>社交登录为智能合约钱包提供了Web2用户非常熟悉的交互体验</strong>，例如使用已有的Google帐户创建和登录钱包。同样的逻辑也可以延伸到社交恢复上，例如使用邮箱重置智能合约钱包的密码。<strong>社交登录和社交恢复的逻辑一般在钱包的主合约中定义。</strong></p><p>这里我们引入<strong>守护者（Guardian）的概念。守护者是指可以授权用户访问某账户或帮助用户重制恢复某帐户的实体。守护者可以是Web2账号也可以是邮箱地址</strong>。这个概念在Web2中已经有了很广泛的应用，现在也可以通过账户抽象的概念在智能合约钱包中实现。</p><p>一个智能合约钱包可以有多个守护者。用户需要在创建钱包过程中或之后设置守护者，并达到一定的守护者验证阈值，例如3个守护者中的2个，以登录或恢复钱包。这个过程通常被称为<strong>多因素认证（multi factor authentication）</strong>。以下是常见的智能合约钱包守护者类型：</p><ul><li><p>Web2服务提供商：例如钱包用户的社交媒体帐户，通常通过实施OAuth（Open Authorization，即开放授权）标准来实现。该标准允许钱包获取用户授权来访问由另一个Web2应用托管的用户账号信息</p></li><li><p>用户设备：例如浏览器存储和移动端存储</p></li><li><p>电子邮件：例如通过点击可以发送签名的电子邮件链接进行授权</p></li><li><p>多签名：用户可以设置多个个人拥有的EOA或智能合约钱包作为守护者</p></li><li><p>MPC：用户可以将私钥分割成多个份额，每个份额由MPC网络中的一个节点控制，且不会泄露完整的密钥</p></li><li><p>SWIE（sign in with Ethereum，即用以太坊登录）</p></li></ul><p>让我们看看一些市场上玩家对此功能的实现：</p><ul><li><p><strong>Web3Auth是许多高流量智能合约钱包使用的社交登录和MPC服务</strong>，这些钱包包括Biconomy、Etherspot和0xPass。<strong>Web3Auth把用户密钥分割成多份给社交登录、用户设备和其MPC节点网络等守护者</strong>。产品逻辑实现完全在链下，且没有任何一个守护者会存储完整的私钥。（请参见下图。）</p></li><li><p>BLS Wallet和Argent使用多签技术（multisig）通过用户指定的多个EOA地址进行密钥恢复。</p></li><li><p><strong>UniPass实现了一种创新的方法，通过电子邮件进行社交恢复</strong>。用户在链上提交守护者的邮箱，并通过智能合约在链上验证邮箱的DKIM签名。DKIM（Domain Keys Identified Mail，即域名密钥识别邮件）是一种电子邮件身份验证协议，用于创建数字签名。邮箱供应商可以使用该数字签名验证邮件发送者的身份。UniPass还使用零知识证明对链上的用户信息进行脱敏处理。UniPass也支持邮件之外的社交恢复方法。</p></li><li><p>Soul Wallet在链上验证守护者的邮箱地址以进行社交恢复。</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/9399335367bdf20b777c0530e0504fa4d5fea43d0425e257d17ecb865e43410a.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：Web3Auth社交登录和社交恢复，此案例中有三个守护者</em></p><h2 id="h-b-gas-abstractiongasgas" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">b. Gas Abstraction（gas抽象，gas即交易手续费）</h2><p><strong>Gas abstraction包含无gas交易和使用任意ERC20代币支付gas。这些逻辑可以在代付合约（Paymaster）中实现，也可以通过中继器（Relayer）实现。</strong></p><p>许多智能合约钱包自己实现了与EIP 4337兼容的Paymaster合约，并在入口点合约上质押代币，帮助用户支付gas。</p><p><strong>Relayer是在EIP 4337之前就存在的另一个gas abstraction的解决方案。</strong> Relayer是用户信任的交易转发者，执行一种称为“元交易”（meta-transaction）的特殊类型的无gas交易。元交易是一种以太坊交易，它在原始交易中插入另一个交易。用户使用私钥对元交易进行签名，并将其发送给Relayer，后者对其进行验证，将其提交给区块链，并代付gas。<strong>Relayer只是执行交易，而不改变交易本身。</strong> Relayer会获取经济上的利益，因为它们会向执行交易的合约收取gas费用加上一小笔利润。例如，Relayer可以向支持无gas交易的去中心化应用（dApp）收费。Relayer可以是中心化的可信第三方，也可以是去中心化的网络。Relayer与代付合约（Paymasters）的区别在于以下几点：</p><ul><li><p>除了支付gas外，Relayer还会对交易进行签名，类似于EIP 4337中的Bundler所做的事情</p></li><li><p>Relayer不只处理<code>UserOperations</code>类型的交易</p></li><li><p>Relayer不在入口点合约上质押gas</p></li></ul><p>让我们看看一些市场上玩家对此功能的实现：</p><ul><li><p>Biconomy不仅自行实现了与EIP 4337兼容的Paymaster，还有一个支持任意ERC20代币支付gas的Relayer网络。</p></li><li><p>Argent使用第三方Relayer以元交易的形式支付gas。</p></li><li><p>Candide自行实现了Paymaster。</p></li><li><p>UniPass使用自己的Relayer节点支付gas，计划在未来添加“观看广告免gas交易”模式并支持使用跨链桥（bridge）支付gas。</p></li></ul><p><strong>到目前为止，大多数ERC20支付gas的解决方案（如Candide和Soul Wallet）仅支持非常有限的代币类型，主要是稳定币</strong>，尽管我预见这在未来会发生变化。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/0bfc69a02adee07e3dc232d8d789790d89a1fd0f482e8a5c89d86ffff58258b9.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：Biconomy 使用Paymaster支持无gas交易（基于EIP 4337的技术实现）</em></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/aeec667e1e57fda45600e1a975a5a10847b87dff791f81ca4bcecf8f2789b0fc.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：Biconomy 通过Relayer使用任意ERC20支付gas（并非基于EIP 4337的技术实现）</em></p><h2 id="h-c-rampsbridges" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">c. 法币出入金通道（ramps）和跨链桥（bridges）</h2><p>许多现有的钱包，如MetaMask，已经通过和第三方供应商合作的方式把法币出入金通道和跨链桥集合在钱包中。<strong>这些出入金通道和跨链桥可以进一步与gas abstraction中的代付合约（Paymaster）进行集合。</strong></p><p>让我们看看一些市场上玩家对此功能的实现：</p><ul><li><p>Biconomy和0xPass与Transak合作提供法币通道。Biconomy还提供跨链桥和跨链通信服务。</p></li><li><p>Argent Vault与Moonpay、Transak和Wyre合作提供法币通道，并具有内置的DeFi协议聚合器。</p></li><li><p>Etherspot、UniPass和Braavos支持法币通道、swap和跨链桥。</p></li></ul><h2 id="h-d-transaction-batching" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">d. 交易批处理（transaction batching）</h2><p>**交易批处理是智能合约钱包独有的功能，允许钱包用户在一个链上交易中执行多个交易。**一种实现方法是调用一个<code>multiCall</code>函数，它接受两个参数：一个<code>calldata</code>数组（每个<code>calldata</code>定义一个函数调用）和一个合约地址数组（每个函数调用的合约地址）。<code>multiCall</code>函数中有一个循环（loop）并在每次循环里执行一个函数调用。<strong>交易批处理可以使多个交易分摊一个以太坊交易的固定gas费，从而减少成本。</strong></p><p>请注意，交易批处理不同于签名聚合（signature aggregation），后者接受一个<code>UserOperations</code>数组作为输入参数并输出一个聚合签名字节以加快多个签名验证的速度。而这个数组中的每个<code>UserOperation</code>都可以调用一个<code>multiCall</code>来执行交易批处理。</p><p>在EIP 4337中实现交易批处理的方式如下：入口点合约调用<code>handleOp</code>函数，然后该函数再调用智能合约钱包主合约内定义的<code>multiCall</code>函数。</p><p>让我们看看一些市场上玩家对此功能的实现：</p><ul><li><p>Biconomy设置了一个<code>MultiCall</code>合约，智能合约钱包可以调用这个合约来批量执行交易。</p></li><li><p>Argent通过名为Transaction Manager的智能合约模块来批量执行交易，该模块支持<code>multiCall</code>和用户会话密钥（session key）。</p></li><li><p>Etherspot、Candide、Openfort和0xpass都支持交易批处理。</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/4cf7aad72fd1eee8261140f57464a6b7f258756270546bd9bc0b6d425ca31bea.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：示例 MultiCall 合约（Solidity by Example提供）</em></p><h2 id="h-e-modular-design" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">e. 智能合约钱包的模块化设计（modular design）</h2><p>**智能合约钱包相对于EOA的一个主要优势是其模块化设计。钱包的功能可以通过钱包提供商开发的合约模块进行扩展。这些模块提供了EIP 4337接口中未定义的功能，并可以由用户自定义。**模块化设计下，智能合约钱包是可升级的。这种做法在EIP 4337发布之前就已经是行业标准，由诸如Gnosis Safe之类的产品率先推出。Gnosis Safe是一款主要针对商业用户的多签名钱包，提供一系列EIP 4337没有定义的功能：</p><ul><li><p>支出限制：限制有签名权限的帐户可以从钱包中提取的金额。</p></li><li><p>定期打款：根据自定义时间自动打款。</p></li><li><p>角色和授权：为钱包不同的交易和行为定义所需的角色和授权。</p></li><li><p>组织权限：基于组织内不同角色的权限设置。</p></li><li><p>白名单和黑名单</p></li></ul><p>同样的模块化设计也被EIP 4337兼容的钱包继承，包括Argent、Candide、Soul Wallet和zeroDev。</p><p>**另一种扩展智能合约钱包功能的方法是在钱包里原生地集成去中心化应用（dApps）。**例如，Gnosis Safe为dApps提供了一个SDK。使用此SDK的dApp可以直接出现在钱包界面中，等同于为钱包提供了一个内置的应用商店。其他类似解决方案包括WalletConnect。然而，这些前端解决方案并不是协议层的设计，因此超出了本文讨论的范围。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/f272e803b41cb0a5600568f4d5a3f39fb1272d4326852daae4bbdaf3bd3fe894.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：Candide钱包的模块化设计与Safe（即Gnosis Safe）类似（Candide钱包官网提供）</em></p><h2 id="h-2" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">2. 基础设施提供商</h2><p>下面将讨论各种Layer 2对账户抽象的支持以及打包器（Bundlers）和代付合约（Paymasters）的第三方基础设施提供商。</p><h2 id="h-a-layer-2" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">a. Layer 2上的账户抽象</h2><p>鉴于最近L2的爆炸式增长，<strong>许多智能合约钱包已将开发重点转向L2。许多L2都原生地支持与EIP 4337非常相似的账户抽象合约标准</strong>，本节将对此进行探讨。</p><p><strong>Optimism</strong></p><p>Optimism的第一版通过引入三个EVM不支持的OVM OpCodes来实现账户抽象。在Optimism的技术实现中，智能合约是唯一的账户类型（不存在EOAs），因此所有用户钱包都是智能合约钱包。智能合约钱包还可以通过调用<code>upgrade</code>函数升级合约代码。</p><p>不幸的是，为了与EVM保持完全一致和出于安全方面的考虑，Optimism的第二版移除了这三个OVM Opcodes和对账户抽象的支持。</p><p>虽然目前有少数智能合约钱包正在Optimism上构建，但是<strong>尚无关于支持账户抽象的官方声明</strong>。</p><p><strong>Arbitrum</strong></p><p>虽然目前有少数智能合约钱包正在Arbitrum上构建，但是<strong>尚无关于支持账户抽象的官方声明</strong>。</p><p><strong>Starknet</strong></p><p>与以太坊不同，Starknet不区分EOA和合约账户。因此，<strong>所有Starknet账户都是智能合约账户</strong>。Starknet的账户模型受到EIP 4337的很大影响，具体表现在以下方面：</p><ul><li><p>所有Starknet智能合约账户都必须包含<code>validate</code>和<code>execution</code>函数。<code>validate</code>是必需的函数，通过验证签名确保只有账户所有者才能发起交易，同时保证交易执行者可以获得足够的gas费。用户可以在<code>validate</code>和<code>execute</code>函数中实现任意逻辑，从而灵活扩展账户的各种功能。例如，用户可以在<code>validate</code>函数中实现不同的验签算法。</p></li><li><p>为了防止交易通过验证但无法执行，Starknet禁止<code>validate</code>函数调用外部合约的状态（state）。</p></li></ul><p>Starknet对账户抽象的实现和以太坊相比依旧存在显著的差异：</p><ul><li><p><strong>Starknet不区分常规交易和</strong><code>UserOperations</code><strong>，因为所有交易都是由合约账户触发的</strong>。在以太坊中，Bundlers执行<code>UserOperation</code>交易，而在Starknet中，序列器（Sequencer）执行所有交易。</p></li><li><p><strong>Starknet尚未实现类似Paymaster的交易手续费抽象协议。</strong></p></li><li><p>Starknet要求有代币余额的账户通过调用一个专门的<code>deploy_account</code>函数来创建新的合约账户。而在EIP 4337中，Bundler通过执行<code>initCode</code>参数不为空的<code>UserOperation</code>交易来部署合约账户，部署过程不必须有代币余额的账户，因为gas费可以由Paymaster代付。</p></li><li><p>如果通过验证的交易在执行步骤失败，Starknet的序列器将无法抽取任何gas费，而以太坊没有这个问题。</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/585a2751ba054be08ac0d3b119d1ce23ea40b33e8cf5dedaaf7c7a740bdfe73f.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：Starknet没有EOA账户类型，只有合约账户（Starknet官网提供）</em></p><p><strong>zkSync</strong></p><p><strong>zkSync也不区分EOA和合约账户</strong>，因此原生地支持账户抽象。zkSync的账户模型与EIP 4337十分类似，具体表现在以下方面：</p><ul><li><p>账户（智能合约钱包）接口也将<code>validateTransaction</code>和<code>executeTransaction</code>函数分开。</p></li><li><p>代付合约（Paymaster）接口也包括<code>validateAndPayForPaymasterTransaction</code>和<code>postOp</code>函数。前者定义了Paymaster代付交易的逻辑。后者可以确保在交易执行后，Paymaster能够抽取gas费补偿，尽管这部分功能尚未实现。</p></li><li><p>用户也通过填写交易中的<code>paymaster</code>地址和<code>paymasterInput</code>两个参数来调用Paymaster，类似于EIP 4337中的<code>UserOperation</code>。</p></li></ul><p>然而，zkSync实现的账户抽象和以太坊也存在显著差异：</p><ul><li><p><strong>zkSync允许</strong><code>validateTransaction</code><strong>函数调用已部署的外部合约，因为已部署的合约在zkSync中是不可更改的（immutable）。</strong> 以太坊禁止验证函数调用外部合约，以防止状态更改（state change）造成交易验证通过而交易执行失败。</p></li><li><p>zkSync允许<code>validateTransaction</code>调用发出此交易合约账户的外部存储，例如合约账户在外部合约上的代币余额，理由同上。</p></li><li><p>在交易验证期间，Paymaster可以调用外部存储，理由同上。</p></li></ul><h2 id="h-b" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">b. 第三方基础设施提供商（非智能合约钱包）</h2><p>如上所述，账户抽象基础设施包括可以发送<code>UserOperations</code>的客户端SDK、打包器（Bundlers）、代付合约（Paymasters）和签名聚合器（Signature Aggregator）。**这些基础设施通常由智能合约钱包自身实现，从而更好地整合产业上下游，但是大多数都不是为第三方使用而设计的。因此市场上需要第三方基础设施提供商来提供模块化和可定制的Bundler和Paymaster服务。**一些知名的基础设施玩家比如Alchemy也进入了这个市场。本节会深入探讨这些第三方基础设施提供商。</p><p><strong>Stackup</strong></p><p>Stackup是一个Bundler和Paymaster的提供商。其Bundler采用Go语言实现，通过了所有EIP 4377测试套件的要求，完全开源且免费使用。Stackup Bundler支持不同的模式：</p><ul><li><p>私有模式（private mode）：<code>UserOperations</code>进入一个<strong>私有内存池（mempool）</strong>，以更慢的交易执行速度换取更好的隐私。<code>UserOperation</code>不会显示在公共内存池中，从而避免了MEV攻击。</p></li><li><p>搜索模式（searcher mode）：<strong>由以太坊生态的机器人运营者（即bot operator，也称为searcher，例如DeFi套利机器人）使用，并与诸如Flashbot之类的区块构建者（block builder）集成</strong>，通过MEV-Boost发送<code>UserOperations</code>，允许searcher为特定的交易排序出价，以供block builder选取MEV最大的交易排序构建区块。</p></li></ul><p>Stackup还支持两种类型的Paymaster：</p><ul><li><p>Verification Paymaster：提供需要链下交易（如法币出入金）的gas抽象。例如，用户可以选择使用信用卡订阅Paymaster服务来支付gas费。用户也可以定制gas代付的逻辑。Stackup将通过“按需付费”（pay as you go）模式向用户收费。</p></li><li><p>Deposit Paymaster：允许用户用ERC20代币支付gas费。</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/27fc995008642799693f204777464bc89cb9e2162b1e781e72116f22c97e5c4e.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：Stackup的基础设施产品套件</em></p><p><strong>Blocknative</strong></p><p>Blocknative主要是一个内存池浏览器和可视化工具提供商。得益于其对于内存池较强的理解，Blocknative提供了具有独特功能的打包器（Bundler）服务，例如：</p><ul><li><p>使用EIP 4337交易浏览器（EIP 4337 UserOps Explorer）可视化内存池中<code>UserOperations</code>的状态，方便钱包和dApp实时监控交易的状态</p></li><li><p>Blocknative的核心产品内存池浏览器也可以监听入口点合约中待处理和已确认的Bundler交易</p></li></ul><p><strong>Alchemy</strong></p><p>Alchemy目前正在开发其Bundler和Paymaster服务，潜在用户可以加入waitlist。</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/eb0bd1f39ad611b6493ae21fed6ea57b89de421a81ccbd865b0b633364b10209.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>图：Alchemy的EIP 4337基础设施服务还在开发中</em></p><p><strong>eth-infinitism</strong></p><p>eth-infinitism是以太坊基金会的官方团队，目前已经实现了EIP 4337标准定义的Bundler和Paymaster。关于该团队的文档很少，但是根据Stackup的一篇文章，<strong>截至2023年2月，eth-infinitism是通过EIP 4337官方测试套件的唯一两个Bundler之一（另一个是Stackup）</strong>。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">第三部分：账户抽象的未来之路</h2><h2 id="h-1-eip-4337" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">1. 归根结底，账户抽象市场的生死存亡取决于生态对EIP 4337的采用，而这个市场还非常早期</h2><p>根据Web3Caff Research最近的一篇研报，以太坊中所有交易的发起地址（<code>from</code>参数）去重后的总数约为1.5亿。然而，智能合约钱包的总数，以Gnosis Safe和Argent账户的总和来估算（这两个产品的用户最多），仅为15万。</p><p><strong>假设在终局，EOA和智能合约钱包的数量相等，我们可以预测智能合约钱包的市场规模有1000倍的潜力。</strong> 尽管如此，生态对智能合约钱包的采用并不会一帆风顺。像MetaMask这样的EOA钱包巨头仍未宣布采用EIP 4337的计划。尽管我们不知道他们的意图，但也不难推断，主流EOA钱包的巨大利润并不足以支持其团队内部采用一个基础设施都不完善的新标准。<code>UserOperation</code>仍然不是dApps广泛使用的主流交易类型。虽然如此，<strong>我依旧对智能合约钱包市场保持乐观态度，也可以预见到智能合约钱包对用户体验的大幅改善会为账户抽象市场带来的指数级的增长，尽管这种爆发可能还需要一两年才发生。</strong></p><h2 id="h-2-eip-4337" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">2. EIP 4337尚未完成，同志仍需努力</h2><p>尽管EIP 4337定义了诸如打包器（Bundler）、代付合约（Paymaster）和签名聚合器（Signature Aggregator）等基础设施的合约接口，以太坊官方并没有给出很多重要技术问题的解决方案，而这些问题需要项目方反复尝试不同的技术实现，比如：</p><ul><li><p><strong>目前Bundler主要在私有内存池（private mempool）广播交易，</strong><code>UserOperation</code>被直接发送给指定的区块构建者（block builder）。Bundler网络是否有可能使用公共内存池（public mempool）？</p></li><li><p>Bundler能否通过对<code>UserOperations</code>进行排序来抽取MEV？区块构建者能否通过对捆绑交易（bundle）进行排序来抽取MEV？MEV将如何在Bundler和区块构建者之间分配？<strong>我们是否应该将Bundler和区块构建者分开？</strong></p></li><li><p>考虑到Bundler需要完成大量的链下模拟和链上验证，它们能否同时作为可靠的区块构建者？</p></li><li><p><code>UserOperation</code><strong>的内存池和常规交易的内存池应该如何协调以避免状态冲突？</strong></p></li></ul><h2 id="h-3-l2eip-4337" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">3. L2采用EIP 4337的速度各异</h2><p>尽管<strong>zkSync和Starknet已经原生地支持账户抽象</strong>，但它们仍未实现所有的EIP 4337接口，并且在技术实现上与以太坊存在差异。尽管许多项目团队正在为<strong>Optimism和Arbitrum构建智能合约钱包、打包器（Bundlers）和代付合约（Paymasters），但这些L2尚未宣布官方支持EIP 4337的计划</strong>，账户抽象也并非他们的开发重点。</p><p>从纯技术的角度来看，<strong>L2账户抽象基础设施的实现比L1更为复杂</strong>。例如，在验证步骤中，一个L2智能合约钱包需要同时估算L1和L2的gas费，并分摊给捆绑交易（bundle）里的每个<code>UserOperation</code>。</p><h2 id="h-4" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">4. 抛开技术细节，一个优秀的智能合约钱包需要有哪些特点？</h2><p>尽管钱包市场上有许多创新的功能（如gas抽象、社交恢复、MPC等），大多数智能合约钱包都支持所有上述功能，因为这些功能的技术实现并不困难。因此，<strong>智能合约钱包的商业层面与用户体验层面同样重要</strong>。重要的商业因素包括：</p><ul><li><p><strong>与dApps合作</strong>：与每个L1或L2链的流量入口级dApps合作，尤其是基础设施类的dApps（如稳定币或DeFi协议），是吸引用户的主要途径</p></li><li><p><strong>实用功能</strong>：如钱包内部集成的NFT市场、launchpad或快速集合新的交易对</p></li><li><p><strong>外部支持</strong>：如来自VC或以太坊基金会的官方支持，这些支持可以帮助钱包找到第一批用户</p></li></ul><h2 id="h-5-bundler" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">5. 一个优秀的打包器（Bundler）需要有哪些特点？</h2><p><strong>无需许可（permissionless）且模块化（modular）的Bundler服务是一种公共物品（public good）</strong>。绝大多数Bundler的开源性质决定它们是非排他性和非竞争性的。任何RPC端点都可以通过复制开源代码来运行一个Bundler。即使运行Bundler的RPC端点通过API密钥来收取服务使用费，<strong>Bundler服务也比其他基础设施（如代付合约Paymaster）更难盈利</strong>，因为后者可以通过与第三方出入金或DeFi协议聚合器提供商合作轻松赚取费用差价。虽然更难商业化，但是Bundler是一种重要的公共物品，因为<code>UserOperation</code>的验证和执行需要尽可能多的Bundler参与从而更好地去中心化。因为Stackup和eth-infinitism是目前唯二可用的第三方Bundler服务提供商，所以<strong>我们肯定需要更多这样的Bundler服务提供商。</strong></p><p>Bundler服务提供商需要克服许多技术难点：</p><ul><li><p>对链下和链上的多个验证步骤进行深入研究，从而确保<code>UserOperation</code>可以成功执行。<strong>技术难点包括理解多个</strong><code>UserOperations</code><strong>之间可能出现的状态冲突（state conflict）</strong>。</p></li><li><p><strong>理解验证函数对某些OpCode的禁用</strong>：</p><ul><li><p>由于读取可变的外部状态（external state）可能导致交易验证成功但执行失败，因此EIP 4337禁止验证函数调用读取外部状态的OpCodes。</p></li><li><p>不同的L2对读取外部状态的OpCode有略微不同的禁用，会对多链开发造成挑战。</p></li><li><p>正在构建Bundler的项目方需要通过<code>traceCall</code>函数来获取每个函数调用的OpCodes。然而，大多数第三方RPC节点都不支持<code>traceCall</code>，因此Bundler项目方可能需要运行自己的节点，这也存在技术壁垒。</p></li></ul></li><li><p>目前大多数Bundler项目方的开发重点都在L2，需要<strong>分别计算L1和L2的gas费</strong>。</p></li><li><p>实现私有和公共内存池的P2P network。私有内存池需要为searcher和dApps提供定制化的服务，例如白名单。<strong>公共</strong><code>UserOperation</code><strong>内存池的行业标准尚未完成</strong>。</p></li></ul><p>Bundler服务提供商的差异化在于：</p><ul><li><p>Bundler服务是专为钱包构建的，还是第三方基础设施提供商构建的？</p><ul><li><p>Bundler只是钱包项目方需要构建的众多事物之一，因此他们更可能专注于为钱包构建一个最基础的可用的Bundler。</p></li><li><p><strong>第三方基础设施提供商需要构建无需许可和模块化的Bundler</strong>，并为不同的场景提供优质的服务。</p></li></ul></li><li><p>类似于以太坊节点，Bundler服务采用不同的语言实现。<strong>这种语言多样性可以防止单点故障</strong>，对以太坊生态有益。</p></li><li><p>对私有和公共内存池的支持以及对私有内存池进行定制的选项。</p></li><li><p>对L1和不同L2链的支持，每个链在接口实现上略有不同。</p></li></ul><h2 id="h-6" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">6. 让我们聊聊创新</h2><p>本节将列举智能合约钱包和账户抽象基础设施中最需要的创新。</p><p><strong>无需许可和模块化的EIP 4337基础设施</strong></p><p>让我们首先设想一下EIP 4337基础设施的终局：</p><ul><li><p>许多打包器（Bundler）、代付合约（Paymaster）和签名聚合器（Signature Aggregator）提供商会在一个开放市场上竞争。用户可以用最低费用获取高质量服务</p></li><li><p>市场上既存在无需许可的Bundler、Paymaster和Signature Aggregator公共端点，也存在专门为某个智能合约钱包或dApp部署的端点</p></li><li><p>**智能合约钱包、dApp和个人用户可以以无需许可（permissionless）、模块化（modular）和用户友好的方式部署上述的基础设施。**换句话说，第三方基础设施提供商允许从任意地址快速且可定制地部署Bundler、Paymaster和Signature Aggregator</p></li></ul><p>在当前市场状态下，<strong>许多智能合约钱包已经构建了自己的基础设施，但是这些基础设施并未针对第三方的不同使用场景</strong>。诸如Stackup之类的第三方基础设施提供商正在开发模块化的Bundler和Paymaster，但是它们的部署过程仍然远未达到无需许可。因为EIP 4337尚未完成，这些基础设施的模块化功能还没有被全部定义。此外，<strong>由于</strong><code>UserOperation</code><strong>交易量依旧较低，启用了签名聚合的钱包（如BLS Wallet）仍然不是主流。</strong></p><p><strong>EIP 4337下游基础设施</strong></p><p>这些包括EIP 4337未定义但实现EIP 4337基础设施所需的下游基建，比如可以集成到Paymaster的法币出入金聚合器和DeFi聚合器。因为这些解决方案已经存在，所以<strong>创新最有可能在现有提供商内部发生</strong>，提供商只需重新配置它们公开的接口。</p><p><strong>dApp SDK和脚手架</strong></p><p>尽管现有的智能合约钱包都为了方便dApp集成而构建了自己的客户端SDK，但市场仍然缺少：</p><ul><li><p><strong>支持账户抽象功能的类似于ether.js的dApp开发标准库</strong>，比如对如下功能的封装：</p><ul><li><p>使用Web2社交媒体账户和电子邮件创建钱包和恢复钱包地址</p></li><li><p><code>UserOperations</code>的创建、签名、发送以及的事件监听</p></li><li><p>快速部署Paymaster和Signature Aggregator</p></li></ul></li><li><p><strong>聚合所有主要智能合约钱包的SDK和UI工具</strong></p></li><li><p><strong>用于快速前端部署的脚手架工具</strong>，以便dApp开发人员可以专注于他们产品的业务逻辑</p></li><li><p><strong>由账户抽象赋能的新型dApp的模板</strong>，例如支持gas抽象的游戏</p></li></ul><p><strong>更激进的做法：将账户从智能合约钱包分离</strong></p><p>EIP 4337的智能合约钱包接口只需要一个<code>validateOp</code>函数，<strong>将所有的核心业务逻辑，如用户注册、权限控制和社交恢复等，留给钱包开发者自由决定</strong>。虽然这提供了更多的灵活性，但<strong>不同的智能合约钱包会更加割裂以太坊生态</strong>，因为一个钱包中的数据不能轻易地转移到另一个钱包。dApp也可能通过支持某些智能合约钱包而不支持其他钱包加剧这种分裂。</p><p>此外，尽管用户可以通过邮箱或其他在Web2常见的流程登录智能合约钱包，他们仍需要通过“连接钱包”这类Web2用户不熟悉的操作流程来登录dApp。</p><p><strong>解决这些问题的一个激进方案是通过创建新的账户标准，将账户与智能合约钱包分离</strong>，例如Hexlink倡导的EIP 6662。EIP 6662定义了一个<code>IAccountMetadata</code>的账号接口，使用户可以自定义自己账号的认证方法（如Web2社交媒体账号），从而将认证逻辑从钱包主合约转移到单独的账户接口。支持此接口的智能合约钱包可以允许用户将其账户数据转移到另一个钱包。支持此接口的dApp可以允许用户使用账户接口中定义的Web2认证方法登录他们的Web3账户。dApp可以验证来自Web2认证方法的签名，以此查询Web3账户地址，向Web2账户推送通知，并连接到Web3账户。用户不需要为不同的dApp创建其支持的不同的钱包。相反，<strong>dApp会自动连接到与用户Web2认证方式关联的Web3账户</strong>。用户账户和钱包不再是一体也不再受制于钱包，<strong>钱包本质上成为了用户可以登录账户来进行资产管理的dApp</strong>。</p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">结论</h2><ul><li><p>EIP 4337将智能合约钱包及其相关基础设施标准化为<strong>六个合约接口</strong>：智能合约钱包主合约、打包器（Bundler）、入口点合约（Entry Point Contract）、代付合约（Paymaster）、钱包工厂（Wallet Factory）和签名聚合器（Signature Aggregator）。<code>UserOperation</code>是EIP 4337支持的新交易类型。</p></li><li><p>账户抽象市场有两类参与者：</p><ul><li><p>具有社交登录、社交恢复、gas抽象、交易批处理，以及集成和聚合第三方服务（如法币出入金和DeFi协议）等功能的<strong>智能合约钱包</strong>。</p></li><li><p><strong>基础设施（如Bundler或Paymaster）的第三方提供商</strong>，专注于模块化设计。</p></li></ul></li><li><p>我对账户抽象市场有如下预测：</p><ul><li><p><strong>智能合约钱包市场竞争激烈</strong>，因为竞品的功能类似，技术壁垒也较低。</p></li><li><p><strong>Bundler是一种盈利较难但是生态十分需要的公共物品</strong>。</p></li><li><p><strong>账户抽象仍然是一个非常早期的市场</strong>，因为采用率仍然很低，EIP 4337尚未完成，许多L2尚未实现对账户抽象的支持。</p></li><li><p>账户抽象市场需要许多创新，如：<strong>无需许可的模块化基础设施、与现有法币和DeFi服务的集成、dApp SDK以及潜在的独立帐户层</strong>。</p></li></ul></li></ul><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">鸣谢与免责</h2><p><em>在撰写本文时向几位行业专家和朋友进行了请教交流，特别在此感谢陈剑Jason、PlanckerDAO的王奕翔Aaron、独立研究员菠菜菠菜、Hexlink团队、AntAlpha Ventures的Circle Fang、Skyhigh等各位的交流探讨！</em></p><p><em>因本人认知有限，调研时间有限，可能会出现错误和疏忽。如有不同意见，欢迎交流指正，非常感谢！研究为个人兴趣，与文章里提到的所有项目都不存在经济利益关系，但也不作为投资建议。</em></p><p><em>欢迎大家关注我的推特@SteveIsEmployed，如果你想深入探讨交流，也可以添加微信clairvoyant_98。</em></p><h2 id="h-" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">参考文献</h2><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://ethereum.org/en/roadmap/account-abstraction/">https://ethereum.org/en/roadmap/account-abstraction/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://eips.ethereum.org/EIPS/eip-4337">https://eips.ethereum.org/EIPS/eip-4337</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://antalphaventures.notion.site/2edc5e36f69a44fe9a27dad0ef6ac3fb?v=a0fad60e889a4b2f831a2349d92ca11b">https://antalphaventures.notion.site/2edc5e36f69a44fe9a27dad0ef6ac3fb?v=a0fad60e889a4b2f831a2349d92ca11b</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.stackup.sh/blog/a-guide-to-the-top-erc-4337-bundlers-features-performance-and-more">https://www.stackup.sh/blog/a-guide-to-the-top-erc-4337-bundlers-features-performance-and-more</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/PaymagicXYZ/awesome-account-abstraction">https://github.com/PaymagicXYZ/awesome-account-abstraction</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://camiinthisthang.substack.com/p/account-abstraction-for-everyone">https://camiinthisthang.substack.com/p/account-abstraction-for-everyone</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://research.web3caff.com/zh/archives/4660">https://research.web3caff.com/zh/archives/4660</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://research.web3caff.com/zh/archives/3212">https://research.web3caff.com/zh/archives/3212</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/blog/account-abstraction">https://www.alchemy.com/blog/account-abstraction</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/blog/account-abstraction-paymasters">https://www.alchemy.com/blog/account-abstraction-paymasters</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/blog/account-abstraction-wallet-creation">https://www.alchemy.com/blog/account-abstraction-wallet-creation</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/blog/account-abstraction-aggregate-signatures">https://www.alchemy.com/blog/account-abstraction-aggregate-signatures</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.starknet.io/documentation/architecture_and_concepts/Account_Abstraction/approach/">https://docs.starknet.io/documentation/architecture_and_concepts/Account_Abstraction/approach/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://era.zksync.io/docs/dev/developer-guides/aa.html#example-of-using-the-library">https://era.zksync.io/docs/dev/developer-guides/aa.html#example-of-using-the-library</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/account-abstraction">https://www.alchemy.com/account-abstraction</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.zerodev.app/">https://docs.zerodev.app/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://eips.ethereum.org/EIPS/eip-4361">https://eips.ethereum.org/EIPS/eip-4361</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://beta-docs.0xpass.io/">https://beta-docs.0xpass.io/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://braavos.notion.site/Public-Docs-d98f625edb2e4399acab2e30d060ef8e">https://braavos.notion.site/Public-Docs-d98f625edb2e4399acab2e30d060ef8e</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/proofofsoulprotocol/soul-wallet-contract">https://github.com/proofofsoulprotocol/soul-wallet-contract</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.wallet.unipass.id/introduction/intro">https://docs.wallet.unipass.id/introduction/intro</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.blocknative.com/4337-tools/blocknative-bundler">https://docs.blocknative.com/4337-tools/blocknative-bundler</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.candidewallet.com/develop/getting-started">https://docs.candidewallet.com/develop/getting-started</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.stackup.sh/docs/packages/bundler/introduction">https://docs.stackup.sh/docs/packages/bundler/introduction</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/web3well/bls-wallet">https://github.com/web3well/bls-wallet</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.etherspot.dev/">https://docs.etherspot.dev/</a></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/5592367d37e5084ccbb191c74708b8c159ba6c653f01924d7368f6ff79f18cef.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure>]]></content:encoded>
            <author>steveisemployed@newsletter.paragraph.com (SteveIsEmployed)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/cc4c370c3064649d65347818af1d14614c4f7a9ab13a4368e27a9990d2f23ad1.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Onboarding the Next Billion Web3 Users — A Deep Dive into the Technicalities and Applications of Account Abstraction and EIP 4337]]></title>
            <link>https://paragraph.com/@steveisemployed/onboarding-the-next-billion-web3-users-a-deep-dive-into-the-technicalities-and-applications-of-account-abstraction-and-eip-4337</link>
            <guid>ArCSqrRrlf08A61glY2A</guid>
            <pubDate>Tue, 11 Apr 2023 17:40:11 GMT</pubDate>
            <description><![CDATA[Author: Steve Wang, current student @UPenn Wharton, frontend and smart contract developer, prev. @Foresight Ventures Twitter: @SteveIsEmployedIntroductionAccount abstraction, as defined in Ethereum Improvement Proposal 4337 (EIP 4337), is a set of protocol interfaces that not only integrate web2-familiar user interactions such as multi factor authentication, but also address web3-specific user pain points such as gasless transactions. Alternatively termed as the protocol that onboards the nex...]]></description>
            <content:encoded><![CDATA[<p>Author: Steve Wang, current student @UPenn Wharton, frontend and smart contract developer, prev. @Foresight Ventures</p><p>Twitter: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/SteveIsEmployed">@SteveIsEmployed</a></p><h2 id="h-introduction" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Introduction</h2><p>Account abstraction, as defined in Ethereum Improvement Proposal 4337 (EIP 4337), is a set of protocol interfaces that not only integrate web2-familiar user interactions such as multi factor authentication, but also address web3-specific user pain points such as gasless transactions. Alternatively termed as the protocol that onboards the next billion users, account abstraction focuses on smooth user experience at the forefront.</p><p>Although many existing articles explain account abstraction very well, they are either entirely introductory or too focused on the technicals. <strong>This article aims to provide both a high level understanding of account abstraction concepts and a deep dive into existing applications.</strong> In part 1, we will explore the origins of EIP 4337 and delve into its technical details, including <code>UserOperation</code>, Bundler, Paymaster, Wallet Factory, and Signature Aggregator. In part 2, we will profile and analyze existing market players in the space. In part 3, we will discuss the way forward for account abstraction, including innovations that are still lacking in the space.</p><h2 id="h-part-1-eip-4337-and-technical-review" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Part 1: EIP 4337 and Technical Review</h2><p>To very briefly go through the basics, <strong>there are two types of accounts in Ethereum: externally owned accounts (EOA) and contract accounts.</strong></p><ul><li><p><strong>EOAs</strong> are user controlled accounts that can send transactions. EOA defines the ownership of an account through its private key, which can sign and execute transactions to change the EOA’s internal state or external smart contracts’ states. Because private key (or its alternative form, seed phrases) is everything, EOA isn’t good for defining complex ownership or transaction logics such login with social media accounts and multi-party signed transactions. <strong>The limitations of EOA translate into poor user experience, where counterintuitive things like private key and seed phrase management deters Web2 users from entering Web3.</strong> The most popular wallets, such as MetaMask, are based on this model.</p></li><li><p><strong>Contract accounts</strong> host arbitrary Solidity codes and therefore can access all the Turing-complete functionalities of EVM. Because they cannot send transactions, their functions must be triggered by EOAs. Smart contract wallet is a contract account which is indirectly triggered by its user through the wallet provider’s EOA network, whether Relayers or Bundlers.</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/d4604853b09c3efad1d52db8614b840ec24006faed3019b5966496c858e67b95.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: EOA vs contract accounts (credit to Bitcoin Insider)</em></p><p>Smart contract wallets exist before EIP 4337, which was only later proposed to codify the common functionalities of a smart contract wallet and its related infrastructures. EIP 4337 follows a few design principles:</p><ul><li><p>Overall, <strong>all implementations should be on a high level (smart contract level)</strong> and shouldn’t touch lower level infrastructures such as the consensus and execution engines, due to the constraint on developer resource, most of which had been focused on the Merge.</p></li><li><p><strong>The protocol design should be modular</strong>, so that users can customize options including transaction processing (Bundler), gas payment (Paymaster), signature scheme (Aggregator).</p></li><li><p>Ideally, <strong>each service will become a competitive open market</strong>, where users select the best service based on providers’ price and reputation.</p></li></ul><p>EIP 4337 defines <strong>six contract interfaces</strong> for standardized smart contract wallets:</p><ul><li><p>First, the <strong>smart contract wallet itself</strong>, which allows Bundler to validate a transaction off-chain and then process it on chain.</p></li><li><p>Second, the <strong>Bundler</strong>, which validates and executes smart contract wallet transactions (called <code>UserOperation</code>) in batch.</p></li><li><p>Third, the <strong>Entry Point</strong> contract, a global singleton contract which standardizes transaction execution and insulates the bundler from potentially malicious transactions.</p></li><li><p>Fourth, the <strong>Paymaster</strong>, which handles gas payment on behalf of the wallet user.</p></li><li><p>Fifth, the <strong>Wallet Factory</strong>, which standardizes wallet creation.</p></li><li><p>Sixth, the signature <strong>Aggregator</strong>, which aggregates the signatures of multiple transactions to bytes for faster validation and execution.</p></li></ul><p>Now, I will elaborate on <code>UserOperation</code> and the six contract interfaces defined above. I drew my inspiration from the official EIP 4337 doc and a series of technical reviews by David Philipson @Alchemy.</p><h2 id="h-1-useroperation" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">1. UserOperation</h2><p><code>UserOperation</code> <strong>is essentially a transaction with additional account abstraction specifications.</strong> Recall that a regular ethereum transaction, which can only be triggered by an EOA, has fields such as recipient address, ethereum amount, gas amount, and gas price.</p><p>Besides, given the highly customizable nature of account abstraction, <code>UserOperation</code> include the following important fields:</p><ul><li><p><code>calldata</code>: defines the signature and <strong>input parameters of the function to call on the smart contract wallet</strong> (also in a regular transaction)</p></li><li><p><code>signature</code>: verifies that the transaction is indeed from the smart contract wallet (also in a regular transaction)</p></li><li><p><code>nonce</code>: prevents replay attacks (also in a regular transaction)</p></li><li><p><code>sender</code>: specifies which smart contract wallet should execute the <code>UserOperation</code></p></li><li><p><code>paymasterAndData</code>: <strong>used for gas abstraction</strong>, containing Paymaster address and specifications for gas payment</p></li><li><p><code>initCode</code>: <strong>used for wallet creation</strong>, containing Wallet Factory address and parameters for the smart contract wallet</p></li></ul><p><strong>Other than the additional fields,</strong> <code>UserOperation</code> works similarly to a regular transaction, such that they are both broadcast to a mempool for validation, execution, and inclusion in a block. Validation and execution of <code>UserOperation</code> is handled by <strong>Bundlers</strong>, which we explain next.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/806e6bbf71fd7f1664acc7b729fde22a1c8a7d827a506d451ab04bdce22f6a3f.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure:</em> <code>UserOperation</code> parameter definition by official EIP 4337 doc</p><h2 id="h-2-bundler" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">2. Bundler</h2><p><strong>Bundler</strong> <strong>validates and executes</strong> <code>UserOperation</code> transactions on the smart contract wallet on behalf of its user and acts like an EOA, because all transactions must be triggered by an EOA on Ethereum. <strong>Bundler saves the user from creating and remembering the private key of an EOA</strong> in order to trigger smart contract wallet transactions, which defeats the very purpose of having a smart contract wallet.</p><p>Despite the public good they contribute to, <strong>Bundlers</strong> <strong>are economically self-interested</strong>, because:</p><ul><li><p>Bundlers can pocket the difference between the maximum priority fee and the actual gas spent after executing a <code>UserOperation</code></p></li><li><p>Same as relayers of regular transactions, Bundlers can extract MEV by ordering transactions in a bundle</p></li></ul><p>Despite the cost, <strong>Bundlers are good for gas savings</strong>, because executing each transaction costs a fixed overhead of 21,000 gas, so that executing a bundled transaction spread the fixed cost over multiple transactions, thereby saving gas cost. Besides, modifying storage in the same transaction is incrementally cheaper for each additional operation.</p><p>Note that although transactions are executed linearly (non-parallel) on Ethereum to avoid state conflicts, <code>UserOperations</code> can be executed as a bundle, because Bundlers will try to include at most one transaction for each smart contract wallet address, so that <code>UserOperations</code> don’t clash with each other when modifying the state.</p><p>Apart from these differences, <strong>Bundlers are similar to block builders</strong> because both broadcast validated <code>UserOperation</code> transactions to a public or private mempool.</p><p>Next, we introduce the <strong>Entry Point Contract</strong>, which the Bundler has to interact with in order to execute a <code>UserOperation</code>.</p><h2 id="h-3-entry-point-contract" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">3. Entry Point Contract</h2><p>Entry Point Contract is a global singleton contract that <strong>all Bundlers need to call to execute a</strong> <code>UserOperation</code>. It acts as the middleman between Bundler and smart contract wallets:</p><ul><li><p>On one hand, Bundlers calls the Entry Point Contract’s <code>handleOp</code> function, which takes a <code>UserOperation</code> input. <code>handleop</code> is responsible for validating and executing a smart contract wallet function according to the <code>calldata</code> of the <code>UserOperation</code></p><ul><li><p><code>handleOp</code> first validates the <code>UserOperation</code> on chain, by checking that it’s signed by the designated smart contract wallet and that the wallet has enough gas to pay the Bundler</p></li><li><p>If validation is successful, <code>handleOp</code> executes the smart contract wallet function according to the function’s signature and inputs defined in the <code>calldata</code> of <code>UserOperation</code></p></li></ul></li><li><p>On the other hand, <strong>smart contract wallets are required to deposit tokens to the Entry Point Contract to pay gas to Bundlers</strong>. Gas is incurred when Bundler triggers <code>handleOp</code> function using an EOA.</p><ul><li><p>Alternatively, smart contract wallet can pay gas to Bundler using its own balance, or ask a Paymaster to handle the payment, which we will elaborate later</p></li><li><p>A <code>UserOperation</code> without enough gas held by its destination smart contract wallet won’t pass the validation step, thereby failing before execution</p></li><li><p>Even with enough gas, a <code>UserOperation</code> can still fail at the execution step, for example, due to a runtime error</p></li><li><p>Whether the execution is successful or not, the Entry Point Contract will pay gas to the Bundler for triggering the <code>handleOp</code> function</p></li><li><p>The Entry Point Contract provides methods for smart contract wallets to add or withdraw stakes</p></li></ul></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/95b8b4a9bfc2ed06658e714bfe3c56f3f0e82f83fcd283e4d97d833194a7e675.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: Entry Point Contract workflow by official EIP 4337 doc</em></p><h2 id="h-4-smart-contract-wallet" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">4. Smart Contract Wallet</h2><p>The smart contract wallet separates the validation and execution steps of a <code>UserOperation</code>:</p><ul><li><p>Validation is defined in the <code>validateOp</code> function. It’s called twice: once off chain by the Bundler to validate the signature of the <code>UserOperation</code> and gas balance of the smart contract wallet as a simulation; then again on chain by the Entry Point Contract to validate the <code>UserOperation</code> before execution</p></li><li><p>Execution is defined in the <code>calldata</code> of the <code>UserOperation</code>, which specifies the signature and inputs of a smart contract wallet function</p></li></ul><p><strong>Therefore, validation and execution are separated, so that the Bundler can validate</strong> <code>UserOperation</code> off chain and filter out malicious transactions without paying gas. The <code>validateOp</code> function is similar to an off chain debugging API.</p><h2 id="h-5-paymaster" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">5. Paymaster</h2><p>Paymaster defines the gas abstraction logics of a smart contract wallet. <strong>Gas abstraction means gas payment in alternative ERC20 tokens or gasless transaction, which requires gas sponsorship from a Paymaster</strong>. The modular design of ERC-4337 means that a <code>UserOperation</code> can choose an arbitrary Paymaster by specifying its address and input parameters using the <code>paymasterAndData</code> field. Paymaster has the following features and requirements:</p><ul><li><p>It is essentially a smart contract deployed by a dApp to selectively pay gas for <code>UserOperation</code> using arbitrary logic defined an exposed <code>validatePaymasterOp</code> function that the Bundler triggers</p></li><li><p>Paymaster is required to deposit ETH on the Entry Point Contract to pay gas for <code>UserOperation</code></p></li><li><p>In addition to the gas deposit, Paymaster also need to deposit an ETH stake on the Entry Point Contract; this stake won’t be slashed, but acts as a barrier to prevent Paymaster creation spam</p></li></ul><p>The open market nature of Paymasters (anyone can implement the interface) encourages competition. There’s no centralized or on chain reputation system, but Paymasters are incentivized to reliably serve <code>UserOperations</code>, as <strong>Bundlers can keep a track record of their operations and stop using lower quality Paymasters</strong>.</p><p>Paymaster interface exposes two functions:</p><ul><li><p><code>validatePaymasterOp</code>: defines the gas abstraction logic. For example, in a scenario where the smart contract wallet pays gas in a ERC20 token, this function will make sure that the wallet has enough balance. <code>validatePaymasterOp</code> is called before a <code>UserOperation</code> is executed. <strong>The same design logic that separates validation and execution applies here</strong></p></li><li><p><code>postOp</code>: is called at the last step of a smart contract wallet function call, and will revert the function call if the wallet doesn’t have enough ERC20 balance to reimburse gas to the Paymaster. <code>postOp</code> double checks that gas is still sufficient after executing a function. Gas is still extracted if a function call fails at this step</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/ae4c0b6bb40c83b76b24f555454940ec6909f8502891ef19fe1f24b685d45a06.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: workflow with Paymaster by official EIP 4337 doc</em></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/994f855c6883803444ddafc3604f441241c60ae7b8b8b8f19b07b6c99c6ef17c.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: Paymaster interface by official EIP 4337 doc</em></p><h2 id="h-6-wallet-factory" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">6. Wallet Factory</h2><p><strong>Wallet Factory is a contract that creates smart contract wallets.</strong> Recall that <code>UserOperation</code> has an optional <code>initCode</code> field. When <code>initCode</code> is empty, the <code>UserOperation</code> simply triggers a smart contract wallet function. When <code>initCode</code> is filled with a Wallet Factory address and the parameters for the new smart contract wallet, the Bundler will trigger the corresponding Wallet Factory to create a smart contract with specified parameters.</p><p>Wallet Factory helps achieve account abstraction in the following aspects:</p><ul><li><p>User can ask a Bundler to create a smart contract wallet without ever owning an EOA, by submitting a <code>UserOperation</code> with <code>initCode</code> filled</p></li><li><p>User can customize their smart contract wallet by selecting a specific Wallet Factory with predefined customization options and passing in their own parameters. Besides, because <strong>Wallet Factory contracts are public and well known ones are likely thoroughly audited, creating new wallets using factories is safe for users</strong></p></li><li><p>User can choose to have a Paymaster sponsor gasless wallet creation or pay gas in alternative ERC20 tokens, without even owning ETH. On the other hand, Paymasters can choose to pay gas for smart contract wallets deployed by approved Wallet Factories</p></li><li><p>User can know their smart contract wallet address before creating the wallet by calling the <code>CREATE2</code> function, which generates a smart contract address deterministically using the EOA address that triggered the smart contract creation, a salt, and the <code>initCode</code>. This <strong>delays gas payment for wallet creation until the user conducts their first transaction, thereby improving user experience</strong>.</p></li></ul><p>Wallet Factories have additional responsibilities as well. Similar to Paymaster, they need to stake ETH on the Entry Point Contract and keep a good track record of serving <code>UserOperations</code>, in order to generate more traffic from Bundlers.</p><h2 id="h-7-signature-aggregator" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">7. Signature Aggregator</h2><p>Because different smart contract wallets use different signature schemes, it’s essential to aggregate <code>UserOperations</code> with the same scheme for separate validations. Besides, because on chain cryptographic arithmetic can be gas intensive, <strong>signature schemes that support aggregation such as BLS can help save gas during on chain validation</strong>. These considerations require another EIP 4337 interface called <strong>Signature Aggregator, which is essentially a smart contract that supports a specific signature scheme</strong> by implementing two functions:</p><ul><li><p><code>aggregateSignatures</code>: takes an array of <code>UserOperations</code> and returns an aggregated signature using a specific scheme</p></li><li><p><code>validateSignatures</code>: takes an array of <code>UserOperations</code> and the aggregated signatures</p></li></ul><p>Instead of validating one <code>UserOperation</code> at a time, Bundlers will first generate multiple aggregated signatures (one for each signature scheme) using multiple Aggregator contracts (one for each signature scheme). Then, the Bundler passes <code>UserOperation</code> arrays, aggregated signatures, and Aggregator addresses to the Entry Point Contract, which calls each Aggregator’s <code>validateSignature</code> function. Once validated, the Bundler executes <code>UserOperations</code> on smart contract wallets.</p><p>Similar to Paymasters and Wallet Factories, Aggregators need to stake on the Entry Point Contract as well and keep a good track record of serving <code>UserOperations</code>.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/1c2644de9c9ddea5a9c6963a4d0467d67b71d1ade415645b145cb39e583f807f.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: Signature Aggregator interface by official EIP 4337 doc</em></p><h2 id="h-8-overall-workflow-summary" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">8. Overall Workflow Summary</h2><p>The modular design of EIP 4337 splits the account abstraction features of smart contract wallets to multiple interfaces. However, they are simply moving pieces in one giant work flow summarized below:</p><ul><li><p>User sends a <code>UserOperation</code> to Bundler</p></li><li><p>If <code>UserOperation</code> contains an <code>initCode</code> field, Bundler triggers Wallet Factory (through the Entry Point Contract) to create a new wallet deterministically</p></li><li><p>If <code>UserOperation</code> contains a <code>paymasterAndData</code> field, Bundler collects gas payment from Paymaster’s stake on Entry Point Contract. If not, Bundler collects gas payment from smart contract wallet’s stake on Entry Point Contract</p></li><li><p>Bundler can elect to aggregate signatures</p></li><li><p>Bundler will simulate <code>UserOperation</code> off chain using a combination of <code>validateOp</code>, <code>validatePaymasterOp</code>, or <code>validateSignatures</code> functions</p></li><li><p>If off chain simulation passes, Bundler validates <code>UserOperation</code> on chain using a combination of the functions above</p></li><li><p>If on chain validation passes, Bundler executes <code>UserOperation</code> on chain, and collects gas payment whether execution succeeds or not</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/0c274d72add6901efa93e5a073c84c4f56da8892343d82b44cb7a4a26d50ba74.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: account abstraction workflow without Signature Aggregator (credit to Alchemy)</em></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/7a3b92350f39a6eeb2f5d15f5643f7d451279061da823d980f2056ea133f9e0d.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: account abstraction workflow with Signature Aggregator (credit to Alchemy)</em></p><h2 id="h-9-other-considerations" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">9. Other Considerations</h2><p>Because <code>UserOperation</code> is validated both off chain and on chain, to prevent inconsistent validation results due to changing contexts, <strong>EIP 4337 restricts access to storage and OpCodes that read the global state such as the timestamp</strong>. This restriction applies to <code>validateOp</code>, <code>validatePaymasterOp</code>, and <code>validateSignatures</code> functions.</p><h2 id="h-part-2-account-abstraction-market-players" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Part 2: Account Abstraction Market Players</h2><h2 id="h-1-smart-contract-wallet-with-sdk" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">1. Smart Contract Wallet with SDK</h2><p>Smart contract wallets are the most obvious players in the account abstraction wallet. To be compatible with EIP 4337, they often implement their own Bundler, Paymaster, Wallet Factory, and Signature Aggregator. These wallets also come with SDKs for dApp integration. <strong>The market is relatively crowded</strong>, with existing players such as Gnosis Safe implementing additional account abstraction features, and new players such as Candide building a new smart contract wallet. This section will introduce the common features of these wallets and minor differentiating points within each feature.</p><h2 id="h-a-social-login-and-social-recovery" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">a. Social Login and Social Recovery</h2><p><strong>Social login provides a very familiar Web2 feel for smart contract wallets</strong>, such as creating and logging in a wallet with an existing Google account. The same extends to social recovery as well, such as resetting the password of a smart contract wallet using a recovery email. <strong>Social login and social recovery logics are defined in the wallet’s main contract.</strong></p><p>Here we introduce the concept of <strong>Guardian, which refers to the entities that grant access to or helps recover an account, whether a Web2 login or an email address</strong>. This concept was well developed in Web2 and now comes to smart contract wallets as well thanks to account abstraction.</p><p>There can be multiple Guardians for one smart contract wallet. User needs to set up the Guardians during or after wallet creation and reach a certain threshold of Guardian authentications, such as 2 out of 3 Guardians, in order to login or recover a wallet. This process is familiarly termed as <strong>multi factor authentication</strong>. Here are the common types of smart contract wallet Guardians:</p><ul><li><p>Web2 service provider: such as your social media account, usually achieved by implementing the OAuth (Open Authorization) standard, which allows the wallet to access login information hosted by another Web2 app on behalf of the user</p></li><li><p>User device: such as browser storage and mobile storage</p></li><li><p>Email: such as sending a signature by clicking an authorization email link</p></li><li><p>Multisig: user can set up multiple EOA or smart contract wallet controlled by trusted individuals as Guardians</p></li><li><p>MPC: user can split private key into shares, each controlled by a node in an MPC network without revealing the full key</p></li><li><p>SWIE (Sign-In With Ethereum)</p></li></ul><p>Let’s see a few market players’ implementations:</p><ul><li><p><strong>Web3Auth is a social login and MPC service used by many notable smart contract wallets</strong> including Biconomy, Etherspot, and 0xPass. <strong>Web3Auth splits and secures user key shares under social login, user device, and their MPC node network</strong>. The implementation is entirely off-chain, and no party stores the full private key. (See figure below.)</p></li><li><p>BLS Wallet and Argent allow social key recovery with nominated EOA addresses using Multisig.</p></li><li><p><strong>UniPass implemented an innovative approach that uses email for social recovery.</strong> Guardian’s email is submitted on-chain and its DKIM signature is verified on chain using a smart contract. DKIM, or Domain Keys Identified Mail, is an email authentication protocol that creates a digital signature that mailbox providers use to verify the identity of an email sender. UniPass also uses zk proofs to desensitize user information on chain. Other non-email social recovery methods are also supported.</p></li><li><p>Soul Wallet verifies Guardian’s email on chain for social recovery.</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/9399335367bdf20b777c0530e0504fa4d5fea43d0425e257d17ecb865e43410a.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: social login and social recovery by Web3Auth with multiple guardians</em></p><h2 id="h-b-gas-abstraction" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">b. Gas Abstraction</h2><p><strong>Gas abstraction refers to sponsored gasless transaction or gas payment in arbitrary ERC20 tokens.</strong> <strong>The logics can be implemented in a Paymaster contract or through Relayers.</strong></p><p>Many smart contract wallets implement their own EIP 4337 compatible Paymaster contract and stake tokens on the Entry Point Contract to handle gas payments on behalf of users.</p><p><strong>Relayer is another gas abstraction solution that exists before EIP 4337.</strong> Relayers are trusted forwarders that execute a special type of gasless transactions called “meta transactions”. A meta transaction is an Ethereum transaction that inserts another transaction in the original one. The user signs it using their private key and sends it to the Relayer, which verifies it, submits it to the blockchain, and handles the fee. <strong>The Relayer only executes the transaction without changing it.</strong> Relayers are economically incentivized, as they charge the transaction’s recipient contract the gas payment plus a small fee. For example, Relayer can charge a dApp which sponsors gas fees for its users. Relayers can be centralized trusted parties, or a decentralized network. Relayers are different from Paymasters in the following ways:</p><ul><li><p>Besides paying gas, Relayers also sign transactions, similar to what a Bundler does in EIP 4337</p></li><li><p>Relayers don’t exclusively handle <code>UserOperations</code></p></li><li><p>Relayers don’t stake gas payments on Entry Point Contract</p></li></ul><p>Let’s see a few market players’ implementations:</p><ul><li><p>Biconomy has not only its own EIP 4337 compatible Paymaster, but also a Relayer network that handles ERC20 gas payments.</p></li><li><p>Argent uses third party Relayer to pay gas fees in the form of meta transactions.</p></li><li><p>Candide has its own Paymaster implementation</p></li><li><p>UniPass uses its own Relayer node to pay gas fees. It plans to add a “watch ad for free transaction” mode and to support gas payment using bridge in the future.</p></li></ul><p><strong>So far, most ERC20 gas abstraction solutions, such as Candide and Soul Wallet, only support very limited token types, mostly stablecoins</strong>, though I foresee that this will change in the future.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/0bfc69a02adee07e3dc232d8d789790d89a1fd0f482e8a5c89d86ffff58258b9.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: Biconomy supporting gasless transactions using Paymaster (EIP 4337 implementation)</em></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/aeec667e1e57fda45600e1a975a5a10847b87dff791f81ca4bcecf8f2789b0fc.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: Biconomy paying gas in ERC20 token using Relayer (non-EIP 4337 implementation)</em></p><h2 id="h-c-ramps-and-bridges" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">c. Ramps and Bridges</h2><p><strong>Fiat on and off ramps and bridges are already natively integrated in many existing wallets</strong> such as MetaMask, <strong>through third party partnerships</strong>. Integrating these with gas abstraction into one click gas payment solutions is super exciting.</p><p>Let’s see a few market players’ implementations:</p><ul><li><p>Biconomy and 0xPass partner with Transak to provide fiat ramps. Biconomy also offers multi-chain bridge and messaging.</p></li><li><p>Argent Vault partners with Moonpay, Transak, and Wyre for fiat ramps and also has a built-in DeFi protocol aggregator.</p></li><li><p>Etherspot, UniPass, and Braavos support fiat ramps, swaps, and bridges.</p></li></ul><h2 id="h-d-transaction-batching" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">d. Transaction Batching</h2><p><strong>Transaction batching is a feature uniquely enabled by smart contract wallets, allowing wallet user to perform multiple transactions in one single on-chain transaction.</strong> One implementation is by calling a <code>multiCall</code> function which takes an array of <code>calldata</code> and an array of contract addresses corresponding to multiple function calls. The <code>multiCall</code> function loops through the arrays and executes multiple function calls in one transaction. <strong>Transaction batching helps reduce the fixed gas cost per Ethereum transaction.</strong></p><p>Note that transaction batching is different from signature aggregation, which takes an array of <code>UserOperations</code> and returns an aggregated signature for faster validation. Here, each <code>UserOperation</code> can perform a <code>multiCall</code> that performs transaction batching.</p><p>In the context of EIP 4337, the Entry Point Contract will call the <code>handleOp</code> function, which calls the <code>multiCall</code> function defined by a smart contract wallet.</p><p>Let’s see a few market players’ implementations:</p><ul><li><p>Biconomy sets up a multi-call contract which smart contract wallets will call and batch execute functions.</p></li><li><p>Argent performs transaction batching through a smart contract module called Transaction Manager that enables multi-call and user sessions.</p></li><li><p>Etherspot, Candide, Openfort, and 0xpass all support transaction batching.</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/4cf7aad72fd1eee8261140f57464a6b7f258756270546bd9bc0b6d425ca31bea.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: example MultiCall contract (credit to Solidity by Example)</em></p><h2 id="h-e-modular-design-of-smart-contract-wallet" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">e. Modular Design of Smart Contract Wallet</h2><p>One major advantage of smart contract wallet over EOA is its modular design. <strong>The wallet’s functionalities can be extended by pluggable contract modules developed by wallet provider. These modules offer features that are not defined in EIP 4337’s interfaces, and can be customized by users.</strong> The modular design makes smart contract wallets upgradeable, and is an industry standard practice before EIP 4337 came out, pioneered by products such as Gnosis Safe, a multisig wallet mainly targeting business users. Non EIP 4337 features offered by Gnosis Safe include:</p><ul><li><p>Spending policies: Limit the amount that a signing account can withdraw from a Safe.</p></li><li><p>Scheduled transactions: Automatically execute transactions on a schedule.</p></li><li><p>Roles and Permissions: Set fine grain rules on what types of actions specific accounts can perform.</p></li><li><p>Hierarchies: Different permission sets based on roles within an organization.</p></li><li><p>Allow and deny lists</p></li></ul><p>The same modular design has been inherited by EIP 4337 compatible wallets, including Argent, Candide, Soul Wallet, and zeroDev.</p><p><strong>Another way of extending a smart contract wallet’s functionality is by natively integrating dApps.</strong> For example, Gnosis Safe provides an SDK for dApps to directly appear in the wallet interface, essentially providing a built-in App store for the wallet. Other similar solutions include WalletConnect. These, however, are not protocol level designs, and are therefore out of our scope.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/f272e803b41cb0a5600568f4d5a3f39fb1272d4326852daae4bbdaf3bd3fe894.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: Candide Wallet’s modular design is similar to Safe’s (prev. Gnosis Safe)</em></p><h2 id="h-2-infrastructure-providers" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">2. Infrastructure Providers</h2><p>I will talk about support for account abstraction on various Layer 2s and pure-play infrastructure providers of Bundlers and Paymasters.</p><h2 id="h-a-account-abstraction-on-layer-2s" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">a. Account Abstraction on Layer 2s</h2><p>Given the recent explosion of L2, <strong>many smart contract wallets have pivoted development efforts towards L2, many of which have native support for account abstraction adapted from EIP 4337</strong> that this section will explore.</p><p><strong>Optimism</strong></p><p>The first version of Optimism implemented account abstraction by introducing three OVM OpCodes that aren’t in EVM. In practice, the only type of account is a smart contract (no EOAs) and all user wallets are smart contract wallets. Smart contract wallets are also upgradeable by sending a transaction that calls an <code>upgrade</code> function.</p><p>Unfortunately, these features were removed in their second version in order to be identical to the EVM and due to security concerns.</p><p>Although a handful of smart contract wallets are building on Optimism, there’s <strong>no official announcement for account abstraction support yet</strong>.</p><p><strong>Arbitrum</strong></p><p>Although a handful of smart contract wallets are building on Arbitrum, there’s <strong>no official announcement for account abstraction support yet</strong>.</p><p><strong>Starknet</strong></p><p>Unlike Ethereum, Starknet doesn’t distinguish between EOA and contract account. Therefore, <strong>all Starknet accounts are smart contract accounts</strong>. Starknet’s account model is heavily influenced by EIP 4337 in the following ways:</p><ul><li><p>All Starknet accounts must include <code>validate</code> and <code>execution</code> functions. <code>validate</code> is required, so that only account owners can initiate transactions and that transaction executors are guaranteed gas payments. Users can implement arbitrary logics in <code>validate</code> and <code>execute</code> functions for full flexibility of their account. For example, different signature schemes can be implemented in the <code>validate</code> function.</p></li><li><p>Starknet restricts <code>validate</code> from calling external contracts, to prevent scenarios where a transaction passes validation but not execution.</p></li></ul><p>There are notable implementation differences from Ethereum, though:</p><ul><li><p><strong>Starknet doesn’t distinguish between regular transactions and</strong> <code>UserOperations</code>, because all transactions are triggered by contract accounts. In Ethereum, Bundlers execute <code>UserOperation</code> transactions, whereas in Starknet, sequencers execute all transactions.</p></li><li><p>Starknet <strong>has yet to implement a native gas abstraction protocol like Paymaster</strong>.</p></li><li><p>Starknet requires an existing funded account to call a special <code>deploy_account</code> transaction in order to create a new contract account. In EIP 4337, contract account is deployed by executing a <code>UserOperation</code> transaction with the <code>initCode</code> field and the deployment doesn’t require a funded contract account, because gas payment can be sponsored by a Paymaster.</p></li><li><p>If a validated transaction fails at the execution step, sequencer won’t be reimbursed for gas payment. Ethereum doesn’t have this problem.</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/585a2751ba054be08ac0d3b119d1ce23ea40b33e8cf5dedaaf7c7a740bdfe73f.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: Starknet doesn’t have EOA account type, only contract accounts</em></p><p><strong>zkSync</strong></p><p><strong>zkSync also doesn’t distinguish between EOA and contract account</strong> and therefore natively supports account abstraction. zkSync’s account model is similar to EIP 4337 in the following ways:</p><ul><li><p>The Account (smart contract wallet) interface separates <code>validateTransaction</code> and <code>executeTransaction</code> functions.</p></li><li><p>The Paymaster interface includes <code>validateAndPayForPaymasterTransaction</code> and <code>postOp</code> functions. The former defines a Paymaster’s arbitrary logic for sponsoring transactions. The latter will ensure that Paymaster is refunded with gas payment after transaction execution, though this is not implemented yet.</p></li><li><p>A transaction invokes Paymaster by filling in the <code>paymaster</code> address field and the <code>paymasterInput</code> field, similar to EIP 4337’s <code>UserOperation</code>.</p></li></ul><p>There are notable implementation differences, however:</p><ul><li><p><strong>In</strong> <code>validateTransaction</code>, zkSync allows OpCodes for calling deployed contracts, which are immutable on zkSync. Ethereum restricts these to prevent changing contexts between transaction validation and execution</p></li><li><p><code>validateTransaction</code> is allowed to access external storage associated with the contract account that calls the transaction, such as the contract account’s token balance</p></li><li><p>Paymaster has no external storage restriction during transaction validation</p></li></ul><h2 id="h-b-pure-play-infrastructure-providers" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">b. Pure Play Infrastructure Providers</h2><p>As elaborated above, account abstraction infrastructures include client SDKs that can send <code>UserOperations</code>, Bundlers, Paymasters, and Signature Aggregators. <strong>These infrastructures are commonly implemented by smart contract wallets themselves to achieve vertical integration, but are mostly not designed for third party use. That’s why there exists pure play third party infrastructure providers of modular and customizable Bundler and Paymaster services</strong>, including notable infrastructure players such as Alchemy. This section lists a few of them.</p><p><strong>Stackup</strong></p><p>Stackup is a Bundler and Paymaster provider. Its Bundler is implemented in Go, passes all EIP 4377 test suite requirements, and is fully open-source and free to use. Stackup Bundler supports different modes:</p><ul><li><p>Private mode: <code>UserOperations</code> enter a <strong>private mempool</strong>, which trades off slower transaction execution for better privacy. <code>UserOperation</code> won’t be displayed in a public mempool, thereby avoiding MEV.</p></li><li><p>Searcher mode: <strong>used by Ethereum bot operators (called searchers) and integrates with block builders like Flashbot</strong> to send <code>UserOperations</code> via MEV-Boost, which allows searchers to bid bundles of ordered transactions for block builder to include in a block.</p></li></ul><p>Stackup also supports two types of Paymasters:</p><ul><li><p>Verification Paymaster: provides gas abstraction linked to an off-chain process such as fiat ramps. For example, a user can elect to pay gas fee using credit card or a subscription service. Users can define their own logics for gas sponsorship. Stackup will charge users based on a “pay as you go” model.</p></li><li><p>Deposit Paymaster: allows user to pay gas in ERC20 token.</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/27fc995008642799693f204777464bc89cb9e2162b1e781e72116f22c97e5c4e.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: Stackup’s infrastructure product suite</em></p><p><strong>Blocknative</strong></p><p>Blocknative is primarily a provider of mempool explorer and visualization tools. Consistent with its mempool expertise, Blocknative offers a Bundler service with unique features such as:</p><ul><li><p>Visualize <code>UserOperations</code> moving through the mempool using a “EIP 4337 UserOps Explorer”</p></li><li><p>Blocknative’s core product, the mempool explorer, can also monitor for pending and confirmed Bundler transactions going through the Entry Point Contract</p></li></ul><p><strong>Alchemy</strong></p><p>Alchemy is currently developing its Bundler and Paymaster services, which are available for early sign ups.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/eb0bd1f39ad611b6493ae21fed6ea57b89de421a81ccbd865b0b633364b10209.webp" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p><em>Figure: Alchemy’s EIP 4337 infrastructure service open for early access</em></p><p><strong>eth-infinitism</strong></p><p>eth-infinitism, an official Ethereum Foundation team, provides Bundler and Paymaster implementations. There are little documentations about the team, but they provide <strong>one of the two Bundlers (the other one being Stackup) that passed EIP 4337’s official test suites as of February 2023</strong> according to an article by Stackup.</p><h2 id="h-part-3-whats-the-way-forward-for-account-abstraction" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Part 3: What’s the way forward for account abstraction?</h2><h2 id="h-1-at-the-end-of-the-day-its-a-game-of-adoption-an-incredibly-early-one-as-well" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">1. At the End of the Day, It’s a Game of Adoption, an Incredibly Early One As Well</h2><p>According to a recent research article by Web3Caff Research, the total number of unique <code>from</code> address in all Ethereum transaction is ~150 million. However, the total number of smart contract wallets, proxied as the sum of Gnosis Safe and Argent accounts, the two most famous products, is only 150 thousand.</p><p><strong>Assuming that there will be an equal number of EOA and smart contract wallet at the end game, we see a 1000x market size potential for smart contract wallets.</strong> That said, the path to adoption won’t be a smooth one. Incumbent giants like MetaMask still haven’t announced plans to adopt EIP 4337. While we don’t know their intention, it’s not hard to deduce that profit from mainstream EOA wallets doesn’t justify adopting a new standard whose infrastructures are still budding. <code>UserOperation</code><strong>** still isn’t a mainstream transaction type used by dApps</strong>, though I do foresee that smart contract wallets will grow exponentially due to great user experience improvement.</p><h2 id="h-2-eip-4337-still-isnt-finalized" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">2. EIP 4337 Still Isn’t Finalized</h2><p>Although EIP 4337 defined the high level interfaces of infrastructures like Bundler, Paymaster, and Signature Aggregator, there are still adjacent problems not covered by official interfaces and would require implementations to battle test different solutions, such as:</p><ul><li><p><strong>Current Bundler implementations mostly work with private mempools</strong>, where <code>UserOperation</code> Bundlers are relayed directly to specific Block Builders. Will public or P2P mempool be possible for the Bundler network?</p></li><li><p>Can Bundler extract MEV by ordering <code>UserOperations</code>? Can Block Builders extract MEV by ordering bundles? How will MEV be distributed between Bundler and Block Builders? <strong>Should we prefer separating Bundler and Block Builder?</strong></p></li><li><p>Can Bundlers be reliable Block Builders, given the vast amount of simulation and validation work they need to do?</p></li><li><p>Will <code>UserOperation</code> succeed at validation but fail at execution due to state conflicts with regular transactions? <strong>How would</strong> <code>UserOperation</code> and regular transaction mempools coordinate to avoid conflicts?</p></li></ul><h2 id="h-3-l2s-are-at-various-speed-of-eip-4337-adoption" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">3. L2s Are at Various Speed of EIP 4337 Adoption</h2><p>Although <strong>zkSync and Starknet are already natively supporting account abstraction</strong>, they still haven’t finished implementing all EIP 4337 interfaces and have diverged from Ethereum’s implementation. While many project teams are building smart contract wallets, Bundlers, and Paymasters for <strong>Optimism and Arbitrum, these L2s haven’t announced official EIP 4337 integration roadmaps</strong> and account abstraction hasn’t been their development focus.</p><p>From a purely technical stand point, <strong>L2 account abstraction infrastructure can be more complicated to implement</strong>. For example, an L2 smart contract wallet will need to estimate and divide both L1 and L2 gas fees among a bundle of <code>UserOperations</code> during the validation step.</p><h2 id="h-4-technicalities-aside-what-makes-a-great-smart-contract-wallet" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">4. Technicalities Aside, What Makes a Great Smart Contract Wallet?</h2><p>Despite the great number of innovative features (gas abstraction, social recovery, MPC, and etc.), most smart contract wallets support all of the features, because their implementation aren’t technically difficult. Therefore, <strong>the business side of smart contract wallets, or wallets in general, matter as much as the user experience side</strong>. Important business factors include:</p><ul><li><p><strong>dApps partnership</strong>: partnering with the top dApps of each L1 or L2 chain, especially infrastructure-type ones such as stablecoin or DeFi protocols, is a major way to onboard users</p></li><li><p><strong>Utility features</strong>: such as integrated NFT market place, launchpad, or quick integration of new trading pairs</p></li><li><p><strong>External backing</strong>: such as VC or official support from Ethereum Foundation, which can help a wallet find its first batch of users</p></li></ul><h2 id="h-5-what-makes-a-great-bundler-service-provider" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">5. What Makes a Great Bundler Service Provider?</h2><p><strong>Permissionless and modular Bundler service is a public good.</strong> It’s non-excludable and non-rivalrous due to its open source nature. Any RPC end point can run the service by forking an implementation. Even if the RPC end point charges service usage using an API key, <strong>it’s harder to run a Bundler service as profitably as other infrastructures such as Paymaster</strong>, which can easily charge a fee spread by partnering with a third party fiat ramp or DeFi protocol provider. However, Bundler is an important public good that diversifies Ethereum’s <code>UserOperation</code> transaction entry points. Because Stackup and eth-infinitism are the only two functional third party non-wallet Bundler service providers, <strong>we definitely need more of them</strong>.</p><p>There are many technical barriers a Bundler service provider needs to overcome:</p><ul><li><p>Heavy research on multiple off chain and on chain validation steps, to make sure a <code>UserOperation</code> can get executed. <strong>One difficulty is understanding the potential state conflicts among multiple</strong> <code>UserOperations</code><strong>.</strong></p></li><li><p><strong>Understanding OpCode bans</strong>:</p><ul><li><p>Because reading changing external states can cause successful validation but failed execution, some OpCodes that read external contexts are banned by EIP 4337.</p></li><li><p>Different L2s can implement slightly different bans, which is hard to navigate through.</p></li><li><p>Bundler builder needs to call the <code>traceCall</code> function to get the OpCodes that are called by each function. However, most third party RPC end points don’t support <code>traceCall</code>. Therefore, Bundler builders might need to set up their own nodes, a technically intensive step.</p></li></ul></li><li><p>Most Bundler services are focusing on L2, which requires <strong>the difficult step of estimating gas fee on both L1 and L2</strong>.</p></li><li><p>Implementing a P2P gossiping network for private and public mempools. The private mempool requires customization for searchers and dApps, such as whitelisting. <strong>The public</strong> <code>UserOperation</code> mempool standard is still not completed.</p></li></ul><p>What are the differentiating factors for Bundler service providers:</p><ul><li><p>Is the service built specifically for a wallet or by a pure play infrastructure provider</p><ul><li><p>Bundler is only one out of many things a wallet provider needs to build, so they are more likely to focus on building a minimal viable Bundler that’s only used by the wallet.</p></li><li><p><strong>Pure play infrastructure providers need to focus on building permissionless and modular Bundlers</strong> that provide stellar service in all contexts.</p></li></ul></li><li><p>Similar to Ethereum nodes, Bundler services are implemented in different languages, and Bundler diversity is good for the ecosystem by preventing single points of failure.</p></li><li><p>Support for private and public mempools and level of customization allowed for private mempool.</p></li><li><p>Support for L1 and L2 chains, each with slightly different interface implementation requirements.</p></li></ul><h2 id="h-6-lets-talk-about-innovation" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">6. Let’s Talk About Innovation</h2><p>This session will list the most needed innovations in smart contract wallet and account abstraction infrastructure.</p><p><strong>Permissionless and Modular EIP 4337 Infrastructure</strong></p><p>To picture the end game of EIP 4337 infrastructure:</p><ul><li><p>Many providers of Bundlers, Paymaster, and Signature Aggregators compete for the lowest fees in an open market</p></li><li><p>There will be a mixture of publicly exposed Bundler, Paymaster, and Signature Aggregators end points, as well as specialized ones deployed just for a single smart contract wallet or dApp</p></li><li><p><strong>Smart contract wallets, dApps, and individual users can deploy these infrastructures in a permissionless, modular, and user friendly way</strong>, i.e. there will be infrastructure providers that allow easy and customizable deployment of Bundler, Paymaster, and Signature Aggregator from arbitrary addresses</p></li></ul><p>At the current market state, <strong>many smart contract wallets have already built out their own infrastructures that are not designed for third party use</strong>. Pure play infrastructure providers such as Stackup are working on modular Bundlers and Paymasters. However, the deployment process is still far from permissionless. With EIP 4337 still in the shift, the modular features of these infrastructures are not fully defined yet. Besides, <strong>given the low volume of</strong> <code>UserOperation</code> transactions, Signature Aggregator enabled wallets such as BLS Wallet are still not the mainstream.</p><p><strong>Adjacent EIP 4337 Infrastructures</strong></p><p>These include infrastructures not defined in EIP 4337 but are required by EIP 4337 infrastructures: for example, fiat ramp aggregators and DeFi aggregators that can be integrated to Paymasters. Because these solutions already exist, <strong>innovations will most likely happen within existing providers</strong>, by simply redefining their exposed end points.</p><p><strong>dApp SDKs and Scaffolding</strong></p><p>While existing smart contract wallets all built out their own client SDKs for dApp integration, there still lacks:</p><ul><li><p><strong>Standard libraries such as ether.js for dApp development</strong>, except that account abstraction features are also enabled. For example:</p><ul><li><p>Wallet creation and social recovery using Web2 social media account and email</p></li><li><p>Creating, signing, sending, as well as the event handling of <code>UserOperations</code></p></li><li><p>Quick deployment of Paymaster and Signature Aggregator</p></li></ul></li><li><p><strong>SDKs and UI tools that aggregate all major smart contract wallets</strong></p></li><li><p><strong>Scaffolding tools for quick front end deployment</strong>, so that dApp developers can focus on the business logics of their products</p></li><li><p><strong>Templates for new types of dApps empowered by account abstraction</strong>, such as gas abstracted free-to-play games</p></li></ul><p><strong>Something More Radical: Decoupling Account from Smart Contract Wallet</strong></p><p>EIP 4337’s smart contract wallet interface only requires a <code>validateOp</code> function, <strong>leaving all core logics, such as user registration, access control, and social recovery, to the wallet developer’s free will</strong>. While this grants more flexibility, <strong>different smart contract wallets can become walled gardens</strong> where one can’t easily port data from one to the other. dApps could also exacerbate this division by supporting some smart contract wallets but not others.</p><p>Besides, although users can log in smart contract wallets using familiar Web2 flow using credentials like their email, they still need to go through unfamiliar user flow like “connect wallet” to log in dApps.</p><p><strong>One radical solution to these problems is to decouple user’s account from smart contract wallet, by creating a new account standard</strong>, such as EIP 6662 advocated by Hexlink. EIP 6662 defines an <code>IAccountMetadata</code> interface, where users can customize their own authentication methods, thereby moving authentication from wallet contract logics to a separate account interface. Smart contract wallets supporting this interface can allow users to easily port their account data to another wallet. dApps supporting this interface can allow users to log in their Web3 account using Web2 credentials defined in the account layer. dApp can verify a signature from a Web2 credential, look up the Web3 account address, push a notification to the account, and get connected to the Web3 account. Users don’t need to create different wallets for different dApps. Rather, <strong>dApps are automatically connected to users’ Web3 accounts linked to their Web2 credentials</strong>. Users are no longer tied to wallets. Rather, <strong>wallets become essentially dApps that users can log in for their asset management functionalities</strong>.</p><h2 id="h-conclusion" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Conclusion</h2><ul><li><p>EIP 4337 standardizes smart contract wallets and their related infrastructures into <strong>six standardized interfaces</strong>: the smart contract wallet itself, Bundler, Entry Point Contract, Paymaster, Wallet Factory, and Signature Aggregator. <code>UserOperation</code> is the new transaction type supported by EIP 4337.</p></li><li><p>There are two types of players in the account abstraction market:</p><ul><li><p><strong>Smart contract wallets</strong> with features including social login, social recovery, gas abstraction, transaction batching, as well as integration and aggregation of third party services such as fiat ramps and DeFi protocols.</p></li><li><p><strong>Pure play providers</strong> <strong>of infrastructures</strong> such as Bundler and Paymaster, focused on modular design.</p></li></ul></li><li><p>Given similar features offered and low technical barrier, <strong>smart contract wallet is a very competitive market</strong>. <strong>Bundlers are hard-to-profit but important public goods that we need more of to diversify the execution of</strong> <code>UserOperation</code><strong>.</strong> With adoption still very low, EIP 4337 incomplete, and many L2s yet to announce any integration plans, <strong>account abstraction is still an early market</strong>, with many needed innovations such as: <strong>permissionless and modular infrastructures, integration with existing fiat and DeFi services, dApp SDKs, and a potential separate account layer</strong>.</p></li></ul><h2 id="h-references" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">References</h2><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://ethereum.org/en/roadmap/account-abstraction/">https://ethereum.org/en/roadmap/account-abstraction/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://eips.ethereum.org/EIPS/eip-4337">https://eips.ethereum.org/EIPS/eip-4337</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://antalphaventures.notion.site/2edc5e36f69a44fe9a27dad0ef6ac3fb?v=a0fad60e889a4b2f831a2349d92ca11b">https://antalphaventures.notion.site/2edc5e36f69a44fe9a27dad0ef6ac3fb?v=a0fad60e889a4b2f831a2349d92ca11b</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.stackup.sh/blog/a-guide-to-the-top-erc-4337-bundlers-features-performance-and-more">https://www.stackup.sh/blog/a-guide-to-the-top-erc-4337-bundlers-features-performance-and-more</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/PaymagicXYZ/awesome-account-abstraction">https://github.com/PaymagicXYZ/awesome-account-abstraction</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://camiinthisthang.substack.com/p/account-abstraction-for-everyone">https://camiinthisthang.substack.com/p/account-abstraction-for-everyone</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://research.web3caff.com/zh/archives/4660">https://research.web3caff.com/zh/archives/4660</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://research.web3caff.com/zh/archives/3212">https://research.web3caff.com/zh/archives/3212</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/blog/account-abstraction">https://www.alchemy.com/blog/account-abstraction</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/blog/account-abstraction-paymasters">https://www.alchemy.com/blog/account-abstraction-paymasters</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/blog/account-abstraction-wallet-creation">https://www.alchemy.com/blog/account-abstraction-wallet-creation</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/blog/account-abstraction-aggregate-signatures">https://www.alchemy.com/blog/account-abstraction-aggregate-signatures</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.starknet.io/documentation/architecture_and_concepts/Account_Abstraction/approach/">https://docs.starknet.io/documentation/architecture_and_concepts/Account_Abstraction/approach/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://era.zksync.io/docs/dev/developer-guides/aa.html#example-of-using-the-library">https://era.zksync.io/docs/dev/developer-guides/aa.html#example-of-using-the-library</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.alchemy.com/account-abstraction">https://www.alchemy.com/account-abstraction</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.zerodev.app/">https://docs.zerodev.app/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://eips.ethereum.org/EIPS/eip-4361">https://eips.ethereum.org/EIPS/eip-4361</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://beta-docs.0xpass.io/">https://beta-docs.0xpass.io/</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://braavos.notion.site/Public-Docs-d98f625edb2e4399acab2e30d060ef8e">https://braavos.notion.site/Public-Docs-d98f625edb2e4399acab2e30d060ef8e</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/proofofsoulprotocol/soul-wallet-contract">https://github.com/proofofsoulprotocol/soul-wallet-contract</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.wallet.unipass.id/introduction/intro">https://docs.wallet.unipass.id/introduction/intro</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.blocknative.com/4337-tools/blocknative-bundler">https://docs.blocknative.com/4337-tools/blocknative-bundler</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.candidewallet.com/develop/getting-started">https://docs.candidewallet.com/develop/getting-started</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.stackup.sh/docs/packages/bundler/introduction">https://docs.stackup.sh/docs/packages/bundler/introduction</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/web3well/bls-wallet">https://github.com/web3well/bls-wallet</a></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.etherspot.dev/">https://docs.etherspot.dev/</a></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/9c657a28c26abfc6c48120c32592d570feb0e1da45ce0c91af6caf06b80bce6a.webp" alt="Image credit to Wealth Nation" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Image credit to Wealth Nation</figcaption></figure>]]></content:encoded>
            <author>steveisemployed@newsletter.paragraph.com (SteveIsEmployed)</author>
        </item>
    </channel>
</rss>