# 设置 OP Geth 节点

这个 OP Geth 节点作为一个不参与投票的 RPC 节点，用于执行 Eth L2 交易。

* 搭建 OP Geth 节点需要 OP Geth、Rhea、Hercules、Light Client（又称 Proxy）和 Postgres。
* OP Geth 已经过修改，可根据所需的 Solana 计算量来计算 gas。它通过查询 Light Client 获取所需的 gas 值。
* Rhea 从 OP Geth mempool 中获取 L2 交易，将其组装为 Solana 交易，并提交到 Solana 进行排序。
* Solana 的共识投票节点会执行并对这些交易的排序进行投票。Hercules 从 Solana 节点读取状态，并在 OP Geth 上确认 L2 交易及其排序。

## 机器规格

我们建议使用一台符合以下规格的 Ubuntu 机器。不过，也支持 macOS。

{% tabs %}
{% tab title="最低配置" %}
4 核，8GB 内存，1TB 存储，8MBit/秒网络带宽

Ubuntu，x86\_64，1 TB SSD
{% endtab %}

{% tab title="推荐配置" %}
8 核、16GB 内存、16 核、1 TB SSD、25 MBit/秒网络带宽

Ubuntu，x86\_64，1 TB SSD
{% endtab %}
{% endtabs %}

## 使用一条命令运行 Docker 容器

```bash
docker compose up -d
```

## 或者，按顺序运行下面的 Docker 容器

{% stepper %}
{% step %}

#### Postgres

```bash
docker compose up -d postgres_rome
docker logs postgres_rome -f
```

等待日志输出“database system is ready to accept connections”。
{% endstep %}

{% step %}

#### 应用迁移

```bash
docker compose up apply_migrations
```

{% endstep %}

{% step %}

#### Light Client

Light Client 提供一个 Ethereum 接口，用于访问 Solana 状态。

这包括向 Geth 提供 gas 估算。

```bash
docker compose up -d proxy_rome
docker logs proxy_rome -f
```

等待日志输出“Starting the RPC server at 0.0.0.0:9090”。
{% endstep %}

{% step %}

#### Geth

Geth 是接收并执行 Eth L2 交易的 rollup 客户端，并向用户提供交易结果。它是一个不参与投票的 RPC 节点。

```bash
docker compose up -d geth
docker logs geth -f
```

等待日志输出“HTTP server started”。
{% endstep %}

{% step %}

#### Rhea

Rhea 从 Geth 获取 rollup 交易，将其打包为 Rome Solana 交易，并提交到 Solana 进行排序。

```bash
docker compose up -d rhea
docker logs rhea -f
```

等待日志输出“Polling: [http://geth:8545”。](https://docs.rome.builders/zh/legacy/rome-l2-setup/setup-your-l2/http:/geth:8545”。)
{% endstep %}

{% step %}

#### Hercules

Hercules 从 Solana 节点读取状态，并在 OP Geth 上确认 L2 交易及其排序。

```bash
docker compose up -d hercules
docker logs hercules -f
```

等待日志输出“SolanaBlockLoader is in sync with Solana validator”。
{% endstep %}

{% step %}

#### 存款界面

存款界面允许用户存入和提取 SOL，以换取 rSOL；rSOL 用于在 Rome 上支付 gas 费用。

```bash
docker compose up -d depositui
docker logs depositui -f
```

{% endstep %}

{% step %}

#### Nginx

```bash
docker compose up -d romenginx
docker logs romenginx -f
```

等待日志输出“Configuration complete; ready for start up”。
{% endstep %}
{% endstepper %}

## 如有需要，重启服务

```bash
docker compose down -d
```

```bash
docker compose up -d
```

## Docker 容器概览

你运行的 Docker 容器如下所示。

| Docker 容器         | 用途           |
| ----------------- | ------------ |
| proxy\_rome       | Light Client |
| geth              | OP Geth      |
| rhea              | Rhea         |
| hercules          | Hercules     |
| postgres\_rome    | Postgres 数据库 |
| apply\_migrations | Postgres 迁移  |
| deposuitui        | 存款界面         |
| romenginx         | Nginx 代理     |


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rome.builders/zh/legacy/rome-l2-setup/setup-your-l2/setup-op-geth-node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
