> 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/run-a-rollup.md).

# 运行一个 rollup

使用 v0.3.0 rollup runner 在 Solana devnet 上注册并运行你自己的 Rome ZK EVM 链。

这些 `./rollup` runner 在 Rome 共享的 Solana devnet 程序上启动一条链。你运行它的节点并承担其 Solana 成本。你无需自己部署结算程序。注册是无许可的，但已证明的根需要由 Rome 注册的链特定验证密钥。

本页面使用 **v0.3.0**。该 [完整的 devnet 指南](https://github.com/rome-protocol/solana-zk-evm/blob/v0.3.0/docs/RUN-ON-DEVNET.md) 涵盖每一项设置、故障和恢复步骤。

## 开始之前

请使用一台 x86-64 Linux 机器，安装 bash 4 或更新版本、Git、Docker Engine 28 或更新版本（含 Compose）、curl、jq、openssl、Solana CLI 以及 Python 3.11 或更新版本。你需要一个 Solana devnet RPC 端点、一个已注资的 Solana payer 密钥对（它也将是你的链权限方）以及一个排序器签名密钥。请将这两个文件妥善保密，并确保容器用户 999 可读取。指南会说明如何创建它们。

预算约 **devnet 上的 7 SOL** 用于 payer。注册会锁定 5 SOL； `./rollup check` 并且预计至少还剩 1 SOL 用于发布和租金。在第一次最终根或已发布十个根之后，这笔押金将可退还。如果在那之前链被回收，押金将归入国库。该链还需要一个你控制的 EVM 费用接收地址。

要结算根，你需要一台 prover 主机，配备一块内存超过 30 GB 的 NVIDIA GPU。24 GB 的显卡对于最终证明步骤来说太小了。 [Prover 主机](https://docs.rome.builders/zh/rome-zk-evm/prover-host.md) 提供 RAM 和磁盘预算。在 prover 就绪之前，节点可以运行并发布批次，但其中没有任何根会成为最终根。

## 启动节点

克隆发布版本并在其 rollup 目录中工作：

```sh
git clone --branch v0.3.0 https://github.com/rome-protocol/solana-zk-evm.git
cd solana-zk-evm/deploy/rollup
cp .env.example .env
cp chain.toml.example chain.toml
```

设置 Solana RPC、签名者位置以及 `ROME_ZK_TAG=v0.3.0` 在 `.env`。保持 `PROGRAMS_JSON=programs.devnet.json`。设置 `ROME_ZK_GUEST_TAG=v0.3.0` 和 `ZISK_RELEASE=1.3.1-alpha` 用于后续的 guest 构建。首次本地运行时，将 RPC 绑定到回环地址。暂时保持 `PROVER` 未设置，直到 guest 及其密钥准备就绪。

设置 `genesis.fee_recipient` 在 `chain.toml` 指向你的 EVM 地址。不要选择链 ID。结算会根据 payer 及其注册次数推导出一个链 ID； `init` 在发送任何内容之前会先读取它。大约一半的 ID 对 MetaMask 来说过大。如果你的 ID 属于这种情况， `init` 会以 `ChainIdNotWalletSafe`结束；请新建一个 payer 密钥，指向 `PAYER_KEYPAIR_PATH` 到它，然后再次运行 `init` 。

一条新链最初没有任何余额。如果你为在存款开放前获取 gas 而声明了一个有背书的余额，请在请求验证密钥之前，将等额的 wrapped SOL 锁入该链的 vault。

```sh
./rollup init
./rollup register --dry-run
./rollup register --confirm
./rollup up
./rollup check
```

`init` 会渲染 genesis 和服务配置。 `register --confirm` 锁定 5 SOL 押金并创建批次游标。 `up` 启动排序器、batcher、derive 和 verifier 节点。 `check` 会列出任何缺失的服务，然后比较链 ID、头部、batcher 的进度、inbox 和根。在批次有时间关闭后再次运行它；其第一次批次进度检查只会记录一个样本。

没有 prover 时，排序器提供 RPC，batcher 将交易数据发布到 inbox，derive 重建链。inbox 批次并不是最终结算根。即使是 genesis 根也需要等待证明。

## 从批次过渡到最终根

为你的链的 genesis 构建 guest：

```sh
./rollup guest-build
```

该构建使用 v0.3.0 guest 和 ZisK 1.3.1-alpha。它会生成该链的 guest 程序和验证密钥元数据。计算 `programVK` 需要 ZisK proving keys 以及约 36 GB RAM。注册链并不会注册验证密钥。请在构建完成后发送 [verification-key request](https://docs.rome.builders/zh/rome-zk-evm/verification-key.md) 。Rome 会检查你的 genesis 和 guest，然后在一个激活槽位上注册该密钥。

在 prover 主机上，设置 `PROVER=on` 以及完整运行手册中所述的 guest、验证元数据和 ZisK 设置。密钥激活后：

```sh
./rollup init
./rollup up
./rollup check
```

检查 `服务 prover` 和 `验证密钥` 这些项是否通过。prover 会按顺序处理 inbox 批次。每个有效证明都会发布一个根，而该根在其 Solana 交易落地后立即成为最终根。

## 生成第一个区块

如果没有带背书的 genesis 余额，在存款开放之前，这条链就没有用于交易的 gas。存款需要一个已证明的首个根。默认的 `empty_block_interval_secs = 0` 会让空闲链没有区块，因此请将其设置为 `60` 低于 `[profile]` 在 `chain.toml` 在密钥激活且 prover 运行后。渲染并重启：

```sh
./rollup init
./rollup up
./rollup check
```

一旦第一个根成为最终根，请将间隔改回 `0` 并重新运行 `init` 和 `up` ，除非你希望定期生成空区块。在等待 Rome 注册密钥时开启它们会造成积压。每个批次都必须按顺序证明。

在 60 秒空区块间隔和 60 秒批次关闭时间下，该链大约每分钟生成一个批次，即每天约 1,440 个。在 devnet 上，一个已证明的根会使 payer 产生约 **0.003 SOL**：其中约 0.002 SOL 是待处理账户租金，0.001 SOL 是结算费用，外加一笔交易费。按照这个频率，在计算 inbox 发布成本之前，每天大约需要 4.4 SOL。默认设置下，待处理账户租金会被锁定。关闭空区块后，空闲链不会封存任何批次，也不会产生发布成本。

要接受存款，接下来创建 vault，等待其延迟后激活退出配置，并打开存款队列。这些命令和检查都在 [存款和取款](https://docs.rome.builders/zh/rome-zk-evm/deposits-and-withdrawals.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/run-a-rollup.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.
