# 智能合约钱包

智能合约钱包（SCW）是以太坊及其他 EVM 链上钱包的下一代。传统钱包（外部拥有账户，EOA）只是私钥 + 地址的组合。相比之下，SCW 是可编程的合约，能够持有资金、定义自定义规则并在交易周围执行逻辑。对于 goodcryptoX 来说，这项技术最终使非托管的去中心化交易所（DEX）交易成为可能。

***

### 简要回顾：EOA 与 智能合约钱包

* EOA（外部拥有账户）：标准的以太坊钱包（MetaMask 等）。由私钥直接控制。只有 EOA 能签署交易。
* SCW（智能合约钱包）：部署在链上的合约。不同于 EOA，它是可编程的——意味着它可以验证并执行由 EOA 或 [会话密钥](/goodcryptox-zh/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/hui-hua-mi-yao.md)授权的操作。正是这种可编程性使得高级功能成为可能，如 [交易合并（批处理）](/goodcryptox-zh/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/jiao-yi-pi-chu-li.md)、以 [除 ETH 之外的代币支付燃料费](/goodcryptox-zh/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/ren-yi-dai-bi-zuo-wei-gas.md)，以及灵活的授权方案。

在 goodcryptoX 中，当你设置一个 EVM 钱包时，你会同时获得：

* 一个 EOA（签名者）
* 一个配对的智能合约钱包（资金存放于此）

***

### 为何重要

在 2023 年初采纳 ERC-4337 账户抽象后，智能合约钱包变得可行。该标准引入了：

* EntryPoint 合约：SCW 交易的入口网关
* Bundlers：收集 SCW 交易并将其提交上链的节点

二者共同解锁了构建完全非托管交易体验的能力——这是我们在推出 DEX 功能前一直在等待的条件。

***

### 它们在 goodcryptoX 中带来的能力

以下是在 goodcryptoX 中 SCW 为你开启的功能：

* 非托管交易

  核心收益：你保留对资金的控制权。 [会话密钥](/goodcryptox-zh/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/hui-hua-mi-yao.md) 允许你在不暴露私钥的情况下授权交易。
* [会话密钥](/goodcryptox-zh/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/hui-hua-mi-yao.md)

  受限权限、链上可验证的密钥，让非托管交易更顺畅、更安全。
* [交易合并（批处理）](/goodcryptox-zh/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/jiao-yi-pi-chu-li.md)

  将多个操作打包成一笔交易。例如：将授权和兑换合并为一次点击。节省时间和燃料费，因为多个步骤在单笔交易中执行。
* 支付者（Paymasters）与 [燃料费抽象（gas 抽象）](/goodcryptox-zh/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/ren-yi-dai-bi-zuo-wei-gas.md)

  允许你使用除 ETH 以外的代币支付燃料费——这是提升可用性的关键一步。
* [MEV 保护](/goodcryptox-zh/dex-jiao-yi-xian-huo/ding-dan-ji-zhi/mev-bao-hu.md)

  SCW 交易通过私有池提交，使其本质上对前置交易（front-running）和夹层攻击（sandwich attack）具有抵抗力。
* 未来的灵活性

  从 [分组取款](/goodcryptox-zh/dex-jiao-yi-xian-huo/ji-jiang-tui-chu-de-gong-neng/pi-liang-zhuan-zhang.md) 到更高级的 [交易批处理](/goodcryptox-zh/dex-jiao-yi-xian-huo/ji-jiang-tui-chu-de-gong-neng/pi-liang-ding-dan.md)，SCW 为我们提供了仅靠 EOA 无法实现的功能可能性。

***

### 权衡

SCW 确实有一些缺点：

* SCW 每笔交易消耗的燃料费略高——在以太坊主网较为明显，但在 L2 上几乎可以忽略不计。
* 新的基础设施：EntryPoint 和 bundler 仍在成熟中，这增加了复杂性。

但随着生态系统标准化，收益远远超过成本。

***

### 发展方向

发展的方向很清晰：

* EVM 链
  * 第 1 步：ERC-4337 引入了独立的 SCW。
  * 第 2 步：EIP-7702 允许 EOA 同时作为 SCW 使用。
  * [最终目标](https://vitalik.eth.limo/general/2021/12/06/endgame.html?utm_source=chatgpt.com): *每个钱包默认都成为智能合约钱包*.
* Solana

  在 Solana 上，钱包在底层已经依赖程序逻辑。不过，会话密钥基础设施和燃料费抽象尚未足够成熟，无法实现我们在 EVM 上支持的同样非托管交易流程。我们预计 Solana 的钱包基础设施在不久的将来会沿着类似方向演进。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.goodcrypto.app/goodcryptox-zh/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
