> For the complete documentation index, see [llms.txt](https://docs.rome.builders/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rome.builders/zh/rome-zk-evm/how-it-works.md).

# 工作原理

跟随一个 EVM 区块经历 Solana 数据发布、ZisK 证明和最终结算。

您的排序器通过 JSON-RPC 接受 EVM 交易。它会检查签名、nonce、资金和 gas，然后按到达顺序执行被接受的交易。在返回预确认之前，它会将已签名的子区块及其交易写入一个持久化的有序日志中。排序器嵌入 reth 以生成该链的区块。

预确认会告诉您排序器接受并排序了什么。它不是最终的 Solana 根。其余路径会发布数据，并证明执行这些数据会得到所主张的状态。

```
EVM 交易 -> 排序器 -> 有序日志 -> 批处理器 -> Solana 收件箱
Solana 收件箱 -> 归约 -> reth-verifier -> 区块 + 见证
区块 + 见证 -> 证明者（ZisK 批处理 guest）-> 证明 + 根
证明 + 根 -> Solana 结算（PostRootProved）-> 最终根
```

## 从区块到收件箱批次

批处理器从有序日志中读取连续的区块。示例 `chain.toml` 在 60 个区块处关闭一个批次，或在其第一个区块后的 60 秒处关闭，以先到者为准。它将该批次压缩为帧，将这些帧作为收件箱分片发布到 Solana，然后完成该批次的 Merkle 承诺。

收件箱承诺覆盖链和批次 ID、开启槽位、分片数量、分片的 Merkle 根以及该批次的存款范围。完成一个收件箱批次意味着其数据已被发布。它不会使其状态根最终确定。链权威会签署该批次的完成。

批处理器不能跳过区块编号。结算也会按顺序处理下一个批次。这就是为什么卡住或被放弃的批次会阻塞后续根。重启后，当批处理器能够重建时，它会在相同编号下恢复一个部分写入的批次。

## 归约、验证与证明

`归约` 从 Solana 读取已最终确定的收件箱批次。它重建区块，并驱动一个独立的 `reth-verifier` 节点再次执行这些区块。该节点为批处理证明者提供所需的执行见证，也为退出证明者提供所需的状态证明。它运行 reth 的测试 API，因此必须远离公共网络。

证明者读取每个已最终确定的收件箱批次，从验证节点获得区块和见证，并在 ZisK 中运行该链的批处理 guest。该 guest 会检查区块是否与收件箱数据匹配并正确执行。它会提交该批次的公开值，包括生成的状态根。您的创世配置和费用接收者都被编译进此 guest，因此每条链都有其自己的 guest 和 `programVK`.

证明者会在本地检查证明，然后发送 `PostRootProved`。结算程序会检查为该链注册的活动验证密钥以及该密钥所指定的 ZisK 版本。它还会根据链 ID、区块范围、前驱、收件箱承诺和所主张的根检查证明的公开值。

Veritas 是 Rome 的 ZisK PLONK 证明验证器。结算将其验证器代码链接进来，并在 `PostRootProved`中运行它；它不会调用单独部署的 Veritas 程序。有效的证明会写入一个 `最终` 根，并在同一个 Solana 交易中推进最终性头。无许可链的创世根本身并不最终确定。其第一个最终根需要一个已证明的批次。

## 跨越边界的资金

存款从 Solana 开始。桥接程序将存入的代币从存款人转入该链的金库，并附加一条带编号的存款记录。排序器读取已最终确定的 Solana 存款，并按顺序将金额记入所命名的 EVM 地址。批处理器将存款范围与该批次一并提交。当区块封口时，余额会出现在链上，但只有当该批次的根在 Solana 上被证明后，其入账才算最终确定。

提款从链上的退出门户开始。该门户记录一条消息并销毁原生资产。退出证明者会监视该消息，并从验证节点获取针对最终根的以太坊存储证明。它会在本地检查该证明，然后发送 `ProveExit` 到 Solana 结算。

结算会检查门户、消息、最终根和退出上限，并防止同一退出被证明两次。随后退出证明者发送桥接的释放交易。桥接在一笔原子交易中消费已证明的退出，并从该链的金库向接收方付款。接收方来自已证明的记录，因此发送释放的人无法更改它。

阅读完整的 [v0.3.0 架构](https://github.com/rome-protocol/solana-zk-evm/blob/v0.3.0/docs/ARCHITECTURE.md) 以了解线格式、组件边界以及每条指令的检查。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rome.builders/zh/rome-zk-evm/how-it-works.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
