> 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 上被证明后，其记账才算最终确定。

提款从链上的退出门户开始。该门户会记录一条消息并销毁原生资产。退出证明器会监视该消息，并相对于一个最终根从验证器节点获取 Ethereum 存储证明。它会在本地检查该证明，然后发送 `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.
