# 智能合約錢包

智能合約錢包（SCW）係以太坊同其他 EVM 鏈上下一代嘅錢包。傳統錢包（外部擁有帳戶，EOA）只係一個私鑰 + 地址配對。相比之下，SCW 係可編程嘅合約，可以持有資金、定義自訂規則，同埋圍繞交易執行邏輯。對於 goodcryptoX 呢個產品，呢項技術係最終令非託管 DEX 交易成為可能嘅關鍵。

***

### 快速回顧：EOA vs 智能合約錢包

* EOA（外部擁有帳戶）：一個標準嘅以太坊錢包（如 MetaMask 等）。由私鑰直接控制。只有 EOA 可以簽署交易。
* SCW（智能合約錢包）：一個部署喺鏈上嘅合約。唔同於 EOA，佢係可編程嘅——意思係佢可以驗證同埋執行由 EOA 或 [會話密鑰](/goodcryptox-yue/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/hui-hua-mi-yue.md)授權嘅操作。呢種可編程性令到進階功能成為可能，例如 [交易合併（transaction batching）](/goodcryptox-yue/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/jiao-yi-pi-ci-chu-li.md)、以 [除 ETH 以外嘅代幣支付 gas](/goodcryptox-yue/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/yong-ren-he-dai-bi-zuo-wei-gas.md)，以及靈活嘅授權機制。

喺 goodcryptoX，當你設定一個 EVM 錢包時，你會得到兩樣嘢：

* 一個 EOA（簽署者）
* 一個配對嘅智能合約錢包（資金係度存放）

***

### 點解佢哋重要

智能合約錢包喺 2023 年初採用 ERC-4337 帳戶抽象後變得實用。呢個標準引入咗：

* EntryPoint 合約：SCW 交易嘅入口閘
* Bundlers：收集 SCW 交易並提交到鏈上嘅節點

兩者一齊，解鎖咗構建完全非託管交易體驗嘅能力——呢樣嘢係我哋喺推出 DEX 功能之前一直等緊嘅。

***

### 佢哋喺 goodcryptoX 裡面帶嚟嘅可能性

以下係 SCW 喺 goodcryptoX 裡面為你打開嘅功能：

* 非託管交易

  核心好處：你保留對資金嘅控制權。 [會話密鑰（Session keys）](/goodcryptox-yue/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/hui-hua-mi-yue.md) 允許你喺唔暴露私鑰嘅情況下授權交易。
* [會話密鑰（Session keys）](/goodcryptox-yue/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/hui-hua-mi-yue.md)

  具有限制權限、鏈上可驗證嘅密鑰，令非託管交易順暢同安全。
* [交易合併（Transaction batching）](/goodcryptox-yue/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/jiao-yi-pi-ci-chu-li.md)

  多個動作打包成一個交易。例子：批准（approvals） + 換幣（swap）合併成一次點擊完成。慳時間同埋慳 gas，因為多個步驟喺同一個交易入面執行。
* 支付代付者（Paymasters）同 [gas 抽象（gas abstraction）](/goodcryptox-yue/qian-bao/nei-zhi-qian-bao/zhi-neng-he-yue-qian-bao/yong-ren-he-dai-bi-zuo-wei-gas.md)

  讓你可以用除 ETH 以外嘅代幣支付 gas —— 呢一步對可用性至關重要。
* [MEV 保護](/goodcryptox-yue/dex-jiao-yi-xian-huo/ding-dan-ji-zhi/mev-bao-hu.md)

  SCW 交易係經由私有池提交，令佢哋天然對抗搶先交易（front-running）同夾心攻擊（sandwich attacks）。
* 未來彈性

  由 [分組提款（grouped withdrawals）](/goodcryptox-yue/dex-jiao-yi-xian-huo/ji-jiang-tui-chu-gong-neng/pi-liang-zhuan-zhang.md) 到更進階嘅 [交易合批（trade batching）](/goodcryptox-yue/dex-jiao-yi-xian-huo/ji-jiang-tui-chu-gong-neng/pi-liang-ding-dan.md)，SCW 為我哋開啟咗用 EOA 單靠自己做唔到嘅功能大門。

***

### 折衷考慮

SCW 亦有啲缺點：

* SCW 每筆交易會消耗稍多嘅 gas——喺以太坊主網上比較明顯，但喺 L2 上幾乎可以忽略不計。
* 新增基礎設施：EntryPoints 同 bundlers 仲喺成熟化階段，增加咗複雜性。

但好處遠超過成本，特別係隨住生態系統標準化之後。

***

### 發展方向

發展趨勢好清晰：

* EVM 鏈
  * 第一步：ERC-4337 引入咗獨立嘅 SCW。
  * 第二步：EIP-7702 允許 EOA 同時變成 SCW。
  * [終局](https://vitalik.eth.limo/general/2021/12/06/endgame.html?utm_source=chatgpt.com): *每個錢包預設都會成為智能合約錢包*.
* Solana

  喺 Solana 上，錢包已經喺底層依賴程序邏輯。不過，會話密鑰基礎設施同 gas 抽象仲未夠成熟，未能實現我哋喺 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-yue/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.
