> 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/canton-zk-evm/run-it-locally.md).

# 在本地运行它

运行检查、无 GPU 的演练，以及在 GPU 上的本地 Ostia 演示。

所提供的脚本会运行一个本地测试网络。Canton 将其状态保存在内存中，因此每次重启都会丢弃该状态并创建一个新网络。GPU 演示会对区块进行证明。演练使用替代证明，不需要 GPU。

本页介绍 commit `a84e84e439a5cc669c0ae61facf7c8c995d9d564`. 请阅读完整的 [网络指南](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/network/README.md) 和 [演示指南](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/demo/README.md)。请从以下位置运行下面的命令： `canton-zk-evm` 仓库根目录。

## 所需内容

| 工作          | 要求                                                                                                |
| ----------- | ------------------------------------------------------------------------------------------------- |
| 仓库检查        | Docker、 `bash`, `curl`, `jq`, `openssl` 以及 Python 3。Rust 测试使用 `rust-toolchain.toml`.              |
| Canton 集成测试 | Linux x86-64、Java 21 和网络访问。                                                                       |
| 演示演练        | Linux x86-64、Docker、Java 21、Rust 和 Python 3.12 或更新版本。                                             |
| Explorer 测试 | Node 22.18 或更新版本。                                                                                 |
| GPU 网络和演示   | Linux x86-64、已安装其驱动程序的 NVIDIA GPU、Docker、Rust、Python 3.12 或更新版本， `jq`, `curl`, `openssl` 以及 ZisK。 |

上面的 [仓库 README](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/README.md#running-the-tests) 列出了测试前置条件。GPU 安装程序使用 `sudo` 和 `apt` 在 Debian 或 Ubuntu 上运行，并需要大约 100 GB 的可用磁盘空间。它会安装系统包并修改内存锁定限制。如果缺少 Java 21，网络的工具获取器会安装它。请参阅 [证明主机](/zh/canton-zk-evm/prover-host.md) 以了解已测试的硬件；最低 GPU 内存尚未确定。

## 运行测试

先从 [CONTRIBUTING.md](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/CONTRIBUTING.md#building-and-testing):

```sh
tests/static.sh                  # 固定版本、创世区块和许可证行一致
tests/refuses_missing_flag.sh    # reth 启动会拒绝缺失或错误的标志
tests/fixtures.sh                # 记录的证明是一致的
gateway/build.sh --check         # 仓库中提交的 gateway 代码就是 Gateway.sol 编译后的结果（Docker）
```

仓库 README 也给出了这些检查。它们不需要 GPU：

```sh
tests/udp_control.sh             # 在带有 UDP 监听器的容器上，UDP 检查会失败（无 reth）
tests/discovery.sh               # 启动固定版本的 reth，检查它没有对等节点，然后停止它
tests/network_static.sh          # 仅通过 launch.sh 启动 reth、Canton 配置、记录的 smoke 结果
tests/network_checks.sh          # 编译器固定版本检查、DAR 的 id、在另一个程序上停止VK（无 GPU）
tests/canton_network.sh          # 固定版本的 Canton、真实的 Daml 包和一个 Advance（Linux x86-64、Java 21、Python 3；无 GPU）
gateway/tests/run.sh             # 在真实 reth 上运行 gateway，且在关闭对等发现的情况下启动（Docker、curl、jq、带有 demo/requirements.txt 中包的 Python 3）
tests/guest-repro.sh             # guest 构建在一个固定文件夹中运行，因此源文件夹不会影响 ELF（ZisK 工具的替代品；在真实 ZisK 上的相同检查已于 2026-10-04 通过，参见 guest/README.md）
tests/demo_static.sh             # 演示的固定版本、篡改开关和创世覆盖，以及其记录结果（无 GPU）
tests/demo_explorer_static.sh    # Explorer 的镜像是固定的，以及其容器获得的内容（无 Docker）
(cd explorer && npm ci && npm test)  # Explorer 的测试，基于模拟对象（Node 22.18+；CI 使用 PINS 中的 EXPLORER_NODE_IMAGE）
(cd guest/rules && cargo test)   # 链规则及其哈希（需要 Rust）
```

## 在不使用 GPU 的情况下进行演练

```sh
tests/demo_rehearsal.sh          # 使用替代证明的演示和 Explorer（Linux x86-64、Docker、Java 21、Rust、Python 3.12+；无 GPU）
```

这会运行真实的 reth、Canton、Daml 包、token standard 和 builder。sidecar 会根据存储证明检查 gateway 的腿，而一个替代对象会响应证明的 `验证` 调用。该演练既不证明区块，也不验证真实的零知识证明。

它还会检查 Explorer 和 faucet。Explorer 的 Verify 检查必须拒绝替代证明。 [演示 README](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/demo/README.md#the-rehearsal) 描述了该演练的覆盖范围。

## 在 GPU 上启动本地网络

在启动网络之前，使用 `prover/install.sh` 安装 ZisK。始终通过所提供的启动器启动 reth； `network/up.sh` 会使用它。

```sh
network/up.sh       # 工具、guest 构建、reth、sidecar、prover、Canton、链
CZE_SOURCE_COMMIT=$(git rev-parse HEAD) network/smoke.sh    # 一个空区块，已证明并提交
network/down.sh
```

`up.sh` 会构建 guest，并拒绝与记录值不同的程序键、ZisK root 或规则哈希。该网络有一个同步器和三个参与方。operator 和 confirmer 参与方各自运行一个 sidecar。名为 users 的参与方托管测试方和读者。

smoke 测试提交一个空区块，检查链头和读者的区块记录，并检查 reth 已将其标记为最终确定。状态和日志输出到 `state/`，或 `CZE_STATE_DIR` （如果已设置）。

## 在 GPU 上运行五个演示案例

为演示使用一个新的本地网络：

```sh
demo/prepare.sh
CZE_GENESIS_FILE=$PWD/state/demo/genesis.json network/up.sh
CZE_SOURCE_COMMIT=$(git rev-parse HEAD) network/smoke.sh      # 可选：先执行一个空区块
CZE_SOURCE_COMMIT=$(git rev-parse HEAD) demo/run.sh
network/down.sh
```

准备脚本会创建测试密钥和带资金的创世配置供运行使用。演示会运行其设置区块、存款、支付、提现、分配拒绝以及篡改证明拒绝。如果检查失败，脚本会停止，并将结果写入 `demo/results/`.

对于不包含 `.git`的源码导出，设置 `CZE_SOURCE_COMMIT` 为用于导出时的完整提交哈希。若要包含 faucet，其带资金的创世配置必须在网络启动前准备好；请参阅 [区块浏览器](/zh/canton-zk-evm/explorer.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/canton-zk-evm/run-it-locally.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.
