> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monad.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# 面向开发者的部署摘要

> 面向开发者的部署摘要

export const CopyToClipboard = ({value, children}) => {
  const [copied, setCopied] = useState(false);
  const handleCopy = async () => {
    try {
      await navigator.clipboard.writeText(value);
      setCopied(true);
      setTimeout(() => setCopied(false), 1000);
    } catch {
      const textarea = document.createElement("textarea");
      textarea.value = value;
      textarea.style.position = "fixed";
      textarea.style.opacity = "0";
      document.body.appendChild(textarea);
      textarea.select();
      document.execCommand("copy");
      document.body.removeChild(textarea);
      setCopied(true);
      setTimeout(() => setCopied(false), 1000);
    }
  };
  return <span style={{
    display: "inline",
    whiteSpace: "nowrap"
  }}>
      {children}
      <button onClick={handleCopy} title={copied ? "Copied!" : "Copy to clipboard"} style={{
    background: "none",
    border: "none",
    cursor: "pointer",
    padding: "2px",
    display: "inline-flex",
    alignItems: "center",
    verticalAlign: "middle",
    marginLeft: "4px",
    opacity: copied ? 1 : 0.4,
    transition: "opacity 0.15s"
  }} onMouseEnter={e => {
    if (!copied) e.currentTarget.style.opacity = "0.8";
  }} onMouseLeave={e => {
    if (!copied) e.currentTarget.style.opacity = "0.4";
  }}>
        {copied ? <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#22c55e" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
            <polyline points="20 6 9 17 4 12" />
          </svg> : <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
            <rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
            <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
          </svg>}
      </button>
    </span>;
};

本页面总结了在 Monad 上开发或部署智能合约时您需要了解的内容。

## 从这里开始

* [网络信息](/zh/developer-essentials/network-information) - 用于 RPC 和区块浏览器 URL,以及权威合约部署。
* [Monad 与以太坊的差异](/zh/developer-essentials/differences)
* [`protocols` 仓库](https://github.com/monad-crypto/protocols)(添加您的项目!)
* [`token-list` 仓库](https://github.com/monad-crypto/token-list)(添加您的项目!)
* [RPC API](/zh/reference/json-rpc/overview) - 交互式参考

## 支持的工具和基础设施

以下是一些最常请求的工具:

| 工具                                                       | 状态 | 说明                                                                        |
| -------------------------------------------------------- | -- | ------------------------------------------------------------------------- |
| [Tenderly](https://dashboard.tenderly.co/explorer)       | ✅  |                                                                           |
| [Safe](https://app.safe.global)                          | ✅  |                                                                           |
| [Monadscan](https://monadscan.com)(由 Etherscan 提供)       | ✅  |                                                                           |
| [MonadVision](https://monadvision.com)(由 Blockvision 提供) | ✅  |                                                                           |
| [Foundry](https://getfoundry.sh)                         | ✅  | 使用 [Foundry v1.8+](/zh/tooling-and-infra/toolkits/foundry) 并启用 Monad 执行网络 |
| [Viem](https://github.com/wevm/viem)                     | ✅  | `viem >= 2.40.0`                                                          |

<br />

有关完整的支持列表,请参见[工具和基础设施](/zh/tooling-and-infra),包括:

| 类别                                                                      |
| ----------------------------------------------------------------------- |
| [AA 基础设施](/zh/tooling-and-infra/wallet-infra/account-abstraction)       |
| [分析](/zh/tooling-and-infra/analytics)                                   |
| [区块浏览器](/zh/tooling-and-infra/block-explorers)                          |
| [跨链](/zh/tooling-and-infra/cross-chain)                                 |
| [托管](/zh/tooling-and-infra/custody)                                     |
| [嵌入式钱包](/zh/tooling-and-infra/wallet-infra/embedded-wallets)            |
| [索引器 - 通用数据](/zh/tooling-and-infra/indexers/common-data)(例如代币余额、转账、交易)  |
| [索引框架(包括 Subgraph)](/zh/tooling-and-infra/indexers/indexing-frameworks) |
| [Onramps](/zh/tooling-and-infra/onramps)                                |
| [Oracle](/zh/tooling-and-infra/oracles)                                 |
| [RPC 提供商](/zh/tooling-and-infra/rpc-providers)                          |

## 账户

<div class="mintlify-table-wrapper">
  <table class="mintlify-table">
    <thead>
      <tr>
        <th />

        <th />
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>地址空间</td>
        <td>与以太坊相同的地址空间(ECDSA 公钥的最后 20 字节)</td>
      </tr>

      <tr>
        <td>EIP-7702</td>
        <td>支持。参见 [EIP-7702 参考](/zh/developer-essentials/eip-7702)</td>
      </tr>
    </tbody>
  </table>
</div>

## 智能合约

有关部署和验证指南,请参见:

* [部署合约](/zh/guides/deploy-smart-contract)
* [验证合约](/zh/guides/verify-smart-contract)
* [MonadVision 验证指南](https://docs.blockvision.org/reference/verify-smart-contract-on-monad-explorer)

<div class="mintlify-table-wrapper">
  <table class="mintlify-table">
    <thead>
      <tr>
        <th />

        <th />
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>Opcodes</td>
        <td>支持截至 Fusaka 分叉的所有 [opcode](https://www.evm.codes/)。</td>
      </tr>

      <tr>
        <td>预编译</td>
        <td>截至 Fusaka 分叉的所有以太坊预编译(`0x01` 到 `0x11`),加上 `0x0100` 的 P256 签名验证([EIP-7951](https://eips.ethereum.org/EIPS/eip-7951))和 `0x1000` 的质押预编译。参见[预编译](/zh/developer-essentials/precompiles)</td>
      </tr>

      <tr>
        <td>最大合约大小</td>
        <td>128 kb(以太坊为 24.5 kb)</td>
      </tr>
    </tbody>
  </table>
</div>

## 交易类型

完整文章:[交易](/zh/developer-essentials/transactions)

<div class="mintlify-table-wrapper">
  <table class="mintlify-table">
    <thead>
      <tr>
        <th />

        <th />
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>交易类型</td>
        <td>支持:
        <ul><li>0("legacy")</li>
        <li>1("EIP-2930")</li>
        <li>2("EIP-1559",以太坊上的"默认")</li>
        <li>4([`EIP-7702`](/zh/developer-essentials/eip-7702))</li></ul>
        不支持:
        <ul><li>3("EIP-4844")</li></ul></td>
      </tr>
    </tbody>
  </table>
</div>

## Gas 限制

<div class="mintlify-table-wrapper">
  <table class="mintlify-table">
    <thead>
      <tr>
        <th />

        <th />
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>每交易 gas 限制</td>
        <td>30M gas</td>
      </tr>

      <tr>
        <td>区块 gas 限制</td>
        <td>150M gas</td>
      </tr>

      <tr>
        <td>区块 gas 目标</td>
        <td>80%(120M gas)</td>
      </tr>

      <tr>
        <td>Gas 吞吐量</td>
        <td>500M gas/秒(150M gas/区块 ÷ 0.3 秒/区块)</td>
      </tr>
    </tbody>
  </table>
</div>

## Gas 定价

完整文章:[Gas 定价](/zh/developer-essentials/gas-pricing)

<div class="mintlify-table-wrapper">
  <table class="mintlify-table">
    <thead>
      <tr>
        <th />

        <th />
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>收取的 gas</td>
        <td>收取的是**gas 限制**。即:从发送者余额中扣除的代币总量为 `value + gas_price * gas_limit`。参见[讨论](/zh/developer-essentials/gas-pricing#gas-limit-not-gas-used)。</td>
      </tr>

      <tr>
        <td>EIP-1559 动态</td>
        <td>Monad 兼容 EIP-1559;base fee 和优先费的工作方式与以太坊相同。[EIP-1559 说明](/zh/developer-essentials/gas-pricing#eip-1559-compatibility)</td>
      </tr>

      <tr>
        <td>Base fee</td>
        <td>最低 base fee 为 100 MON-gwei(100 \* 10^-9 MON)。<br />Base fee 控制器类似于以太坊,但保持较高水平的时间更短([详情](/zh/developer-essentials/gas-pricing#base_price_per_gas-controller))。</td>
      </tr>
    </tbody>
  </table>
</div>

## Opcode 定价

完整文章:[Opcode 定价](/zh/developer-essentials/opcode-pricing)

Opcode 定价与以太坊相同(参见:[evm.codes](https://www.evm.codes/)),**除了**以下由于 Monad
优化需要重新定价以重新平衡资源相对稀缺性的调整。

<div class="mintlify-table-wrapper">
  <table class="mintlify-table">
    <thead>
      <tr>
        <th>项目</th>
        <th>以太坊</th>
        <th>Monad</th>
        <th>说明</th>
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>冷访问成本 - 账户</td>
        <td>2,600</td>
        <td>10,100</td>
        <td>受影响的 opcode:`BALANCE`、`EXTCODESIZE`、`EXTCODECOPY`、`EXTCODEHASH`、`CALL`、`CALLCODE`、`DELEGATECALL`、`STATICCALL`、`SELFDESTRUCT`<br />参见[详情](/zh/developer-essentials/opcode-pricing#cold-access-cost)</td>
      </tr>

      <tr>
        <td>冷访问成本 - 存储</td>
        <td>每 slot 2,100</td>
        <td>每 128 个 slot 一页 8,100</td>
        <td>受影响的 opcode:`SLOAD`、`SSTORE`。存储的 warm 单位是每 128 个连续 slot 一页,因此冷成本按页支付一次。<br />参见[存储](/zh/developer-essentials/differences#storage)与[详情](/zh/developer-essentials/opcode-pricing#storage-pages)</td>
      </tr>

      <tr>
        <td>`SSTORE` 写入与状态增长</td>
        <td>全新 slot 20,000<br />覆盖 2,900</td>
        <td>每页首次写入 2,800<br />每页新增净 slot 17,000</td>
        <td>在上述冷访问成本之上收取。<br />参见[详情](/zh/developer-essentials/opcode-pricing#sstore)</td>
      </tr>

      <tr>
        <td>内存扩展成本</td>
        <td>`3*w + w^2/512`</td>
        <td>`w/2`</td>
        <td>`w` 是以 32 字节字为单位的内存大小。每笔交易的内存上限为 8 MB。<br />参见[详情](/zh/developer-essentials/opcode-pricing#memory-expansion)</td>
      </tr>

      <tr>
        <td>`ecRecover`、`ecAdd`、`ecMul`、`ecPairing`、`blake2f`、`point_eval` 预编译</td>

        <td />

        <td />

        <td>参见[详情](/zh/developer-essentials/opcode-pricing#precompiles)<br /><br />预编译 `0x01`、`0x06`、`0x07`、`0x08`、`0x09`、`0x0a`</td>
      </tr>
    </tbody>
  </table>
</div>

## 时间考量

<div class="mintlify-table-wrapper">
  <table class="mintlify-table">
    <thead>
      <tr>
        <th />

        <th />
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>出块频率</td>
        <td>300 ms</td>
      </tr>

      <tr>
        <td>`TIMESTAMP` opcode</td>
        <td>与以太坊一样,`TIMESTAMP` 是秒级粒度的 unix 时间戳。由于区块每 300 ms 出一次,这意味着 3-4 个区块可能具有相同的时间戳。</td>
      </tr>

      <tr>
        <td>最终性</td>
        <td>区块在两个区块后(600 ms)最终确认。一旦区块被最终确认,就不能被重组。参见 [MonadBFT](/zh/monad-arch/consensus/monad-bft) 以了解更完整的讨论。</td>
      </tr>

      <tr>
        <td>推测性最终性</td>
        <td>当区块被标记为处于 `Voted` 阶段时,它可以在一个区块后(300 ms)[推测性最终确认](/zh/monad-arch/consensus/monad-bft#speculative-finality)。<br /><br />
        推测性最终性在非常罕见的情况下可能会回滚(参见[更完整的讨论](/zh/monad-arch/consensus/monad-bft#speculative-finality))。</td>
      </tr>
    </tbody>
  </table>
</div>

## Mempool

完整文章:[本地 Mempool](/zh/monad-arch/consensus/local-mempool)

Monad 没有全局 mempool,因为这种方法不适合高性能区块链。

每个验证者维护一个包含其所知交易的本地 mempool。当 RPC 收到交易时,它会策略性地转发给即将
到来的 leader,并在未观察到交易被包含时重复此过程。

尽管这是 Monad 设计的重要部分,但通常不应影响智能合约开发者在其系统设计中的工作。

## 并行执行和 JIT 编译

Monad 利用[并行执行](/zh/monad-arch/execution/parallel-execution)和
[JIT 编译](/zh/monad-arch/execution/native-compilation)来提高效率,
但智能合约开发者无需为此做任何更改。

在 Monad 中,交易仍然是线性排序的,执行的唯一正确结果与串行执行交易的结果相同。
智能合约开发者可以将并行执行的所有方面视为实现细节。
参见[进一步讨论](/zh/monad-arch/execution/parallel-execution)。

## 异步执行

完整文章:[异步执行](/zh/monad-arch/consensus/asynchronous-execution)

Monad 利用异步执行以提高效率,但大多数开发者不应需要做任何更改。

具有大量链下财务逻辑的开发者(例如交易所、跨链桥和稳定币/RWA 发行方)应该等到区块达到
[`Verified`](/zh/monad-arch/consensus/block-states#verified)阶段(即状态根最终性),
比[`Finalized`](/zh/monad-arch/consensus/block-states#finalized)晚三个区块,
以确保整个网络认同其自己节点对最终确认区块的本地执行。

<Accordion title="异步执行和区块阶段">
  异步执行是一种技术,通过将共识与执行解耦,允许 Monad 大幅提高执行吞吐量。
  在异步执行中,验证者**先投票,后执行** - 因为一旦交易顺序确定,状态就确定了。
  之后,每个节点在本地执行。三个区块后有一个[延迟 merkle 根](/zh/monad-arch/consensus/asynchronous-execution#delayed-merkle-root)
  确认网络得到了与本地执行相同的状态 trie。

  从开发者的角度来看:

  * 有人通过您的前端提交了一笔与您的智能合约交互的交易。您记下哈希。
  * 一个包含该交易的区块被[`Proposed`](/zh/monad-arch/consensus/block-states#proposed)。
  * 一个区块后,该区块被[`Voted`](/zh/monad-arch/consensus/block-states#voted)(推测性最终确认)。(`T+1`)
  * 一个区块后,该区块被[`Finalized`](/zh/monad-arch/consensus/block-states#finalized)(`T+2`)
  * 三个区块后,该区块被[`Verified`](/zh/monad-arch/consensus/block-states#verified)(状态根最终确认)(`T+5`)

  您通过调用 [`eth_getTransactionReceipt`](/zh/reference/json-rpc/api) 来监听交易收据。
  收据将在区块变为 `Proposed`(推测性执行)后首次可用。

  您选择何时更新 UI 以向用户提供反馈取决于风险偏好,但对于大多数应用,
  在区块变为 `Proposed` 时这样做是合理的,因为推测性最终性回滚极其罕见。更保守的方法是等到
  区块 `Finalized`,因为那时您就永远不必处理重组。通常不需要等到 `Verified`
  (除了前面提到的具有链下财务逻辑的开发者)。
</Accordion>

## 储备余额

完整文章:[储备余额](/zh/developer-essentials/reserve-balance)

Monad 引入了储备余额机制以支持异步执行。

储备余额机制在共识时对交易何时可以被包含施加轻度限制,并对交易在执行时回滚的条件施加一些约束。

储备余额机制旨在在保持异步执行下的安全性的同时不干扰正常使用模式。大多数用户和开发者
无需担心储备余额约束。

| 参数     | 值      |
| ------ | ------ |
| 默认储备余额 | 10 MON |

## EIP-7702

支持 EIP-7702;完整说明请参见[此处](/zh/developer-essentials/eip-7702)。

有两个注意事项:

1. 如果一个 EOA 被 EIP-7702 委托,由于[储备余额](/zh/developer-essentials/reserve-balance)规则,
   其余额不能降至 10 MON 以下。(如果委托被移除,则允许低于 10 MON。)
   [讨论](/zh/developer-essentials/eip-7702#delegated-eoas-can%E2%80%99t-dip-below-10-mon)。

2. 如果一个 EOA 被 EIP-7702 委托,当它被当作智能合约调用时,
   `CREATE` 和 `CREATE2` opcode 会被禁止。[讨论](/zh/developer-essentials/eip-7702#delegated-contract-code-cannot-call-create/create2)。

## 读取区块链数据

支持以下方法读取区块链数据:

<div class="mintlify-table-wrapper">
  <table class="mintlify-table">
    <thead>
      <tr>
        <th />

        <th />
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>JSON-RPC</td>
        <td>参见 [RPC API](/zh/reference/json-rpc/overview)。Monad 支持所有来自以太坊的标准 RPC 方法。差异在 [RPC 差异](/zh/reference/json-rpc/overview) 中说明。速率限制请参见[此处](/zh/reference/json-rpc/overview)。</td>
      </tr>

      <tr>
        <td>WebSocket</td>
        <td>参见 [WebSocket 指南](/zh/reference/json-rpc/overview)。<br /><br />
        Monad 使用以下订阅类型实现 `eth_subscribe` 方法:<ul>
        <li>`newHeads` 和 `logs`</li>
        <li>`monadNewHeads` 和 `monadLogs`(类似,但包含跟踪每个区块通过共识进度的额外数据)</li></ul>
        不支持 `syncing` 和 `newPendingTransactions` 订阅类型。
        有关更多详情,请参见[实时数据源](/zh/monad-arch/realtime-data/data-sources)。</td>
      </tr>

      <tr>
        <td>执行事件</td>
        <td>参见[执行事件](/zh/execution-events)。<br /><br />
        执行事件系统允许开发者构建高性能应用,这些应用通过共享内存队列从 Monad 节点接收最低延迟的事件数据。</td>
      </tr>
    </tbody>
  </table>
</div>

您也可以使用支持的[索引器](/zh/tooling-and-infra/indexers)。

## 历史数据

Monad 全节点提供对所有历史账本数据(区块、交易、收据、事件和 trace)的访问。
Monad 全节点不提供对任意历史状态的访问,如[此处](/zh/developer-essentials/historical-data)所述。

有一个特殊的 RPC 服务位于 <CopyToClipboard value="https://rpc-mainnet.monadinfra.com">[`https://rpc-mainnet.monadinfra.com`](https://rpc-mainnet.monadinfra.com)</CopyToClipboard>
提供对历史数据的访问。

## 推荐的开源工具版本

* `foundry >= 1.8.0`:启用 [Monad 执行网络](/zh/tooling-and-infra/toolkits/foundry) 以获得 Monad 的 gas 定价、hardfork 和预编译
* `viem >= 2.40.0`(只是为了引入 [monad.ts](https://github.com/wevm/viem/blob/main/src/chains/definitions/monad.ts))
* `alloy-chains >= 0.2.20`

## 权威合约地址

参见[权威合约](/zh/developer-essentials/network-information#canonical-contracts)

## 源代码

* [`monad-bft`](https://github.com/category-labs/monad-bft)(共识)
* [`monad`](https://github.com/category-labs/monad)(执行)

## 运行全节点

参见[节点运维](/zh/node-ops)

## 需要帮助?

请在[开发者 discord](https://discord.gg/monaddev) 中提问。我们随时准备提供帮助!
