> 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-xue-yuan/01-what-you-are-building.md).

# 1. 你在 Rome 上构建什么

Rome 将 EVM 和 Solana 变成一个统一市场。一个合约如何同时服务 EVM 和 Solana 钱包，以及您将在本课程中构建的应用。

Rome 将 EVM 和 Solana 汇聚成一个市场。你编写 Solidity 合约，使用 Hardhat 或 Foundry 部署，合约便运行在 Solana 上。本课将为你介绍学习其余十二课所需的整体概念。你将构建一个 USDC 金库，接受来自 EVM 和 Solana 钱包的存款。

## 你将学到什么

* Rome 是什么，以及为什么它的状态就是 Solana 状态。
* 两条钱包通道：一个 EVM 密钥、一个 Solana 密钥，共用一个合约。
* 什么是双通道应用，以及你将在第 9 课中构建的示例。
* 你将使用的两个网络：用于测试的 Hadrian 和用于生产环境的 Rubicon。

## 开始之前

这是第一课。请阅读 [课程地图](https://docs.rome.builders/zh/rome-xue-yuan/academy.md) 了解课程的最终目标。无需准备其他内容，你现在也不需要钱包。

## 核心概念

EVM 和 Solana 是两个市场。Rome 将它们合为一个。

Rome 在 Solana 内运行 EVM 链，因此任何 EVM 协议都可以部署一次，并向 Solana 钱包开放。Rome 上的 Solidity 合约可以直接调用 Solana 程序，让 EVM 用户访问 Kamino 和 Solana DEX。Solgate 可在两个方向上连接 Solana 资产与 AggLayer EVM 链，支持主网和测试网。在测试网上，SPL 代币注册无需许可。USDC 使用 CCTP。

Rome 通过在 Solana 程序中嵌入 EVM 解释器来运行 Solidity 合约。部署合约时，其代码和存储会成为 Solana 账户。有人调用合约时，解释器会在 Solana 运行时中执行。一次调用可以在同一笔交易中访问任何 Solana 程序；如果任一步骤失败，整笔交易都会回滚。

状态就是 Solana 状态。在 Rome 内，钱包的 SPL 代币与其 ERC-20 包装代币读取的是同一个代币账户，因此两者之间不会发生铸造或锁定。

阅读 [一个市场](https://docs.rome.builders/zh/kuai-su-ru-men/one-market.md) ，了解这四项核心能力的概念；阅读 [什么是 Rome？](https://docs.rome.builders/zh/kuai-su-ru-men/what-is-rome.md) 获取完整概述。快速浏览 [为什么选择 Rome？](https://docs.rome.builders/zh/kuai-su-ru-men/why-rome.md) ，了解它与其他方案的比较。

## 两条通道

两类用户都可以调用同一个合约。

|         | EVM 通道                    | Solana 通道                   |
| ------- | ------------------------- | --------------------------- |
| 钱包      | MetaMask 或任何 EVM 钱包       | Solana 钱包                   |
| 密钥      | EVM 密钥                    | Solana 密钥                   |
| 合约中的身份  | 常规地址                      | 从 Solana 密钥派生的合成地址          |
| 调用的传递方式 | 已签名的 EVM 交易，发送至 Rome 代理合约 | 由钱包签名的 Solana 交易，发送至 Solana |

在两条通道中 `msg.sender` 都是普通地址，且调用的是同一个合约。Solana 用户不需要 EVM 密钥。Rome 不会关联这两种身份。MetaMask 密钥和 Solana 密钥是两个不同的账户，就像两个 MetaMask 密钥彼此不同一样。

[Solana 与 EVM 如何在 Rome 上交互](https://docs.rome.builders/zh/he-xin-gai-nian/how-solana-and-evm-meet.md) 会介绍合成地址、谁负责签名以及谁支付费用。你将在第 4 课回到这个主题。现在先阅读前两个章节。

## 你将构建的应用

双通道应用是一个 Solidity 合约，EVM 用户和 Solana 用户都可以直接使用。本课程的示例是一个简易金库。用户存入 USDC，之后再将其取出。

这个合约是一个标准的 ERC-20 金库。它使用 `transferFrom` 提取代币，并使用 `transfer`返还代币。它不包含任何 Rome 专属内容。Solana 用户的 USDC 在 EVM 一侧会显示为该 SPL 代币的 ERC-20 包装代币，因此两条通道都能使用同样的这两个调用。

你将在第 9 课中构建它。相关指南是 [构建双通道应用](https://docs.rome.builders/zh/kai-fa-zhe-zhi-nan/dual-lane-app.md)。第 3 至第 8 课将逐一介绍所需的各个部分：

1. 部署到 Hadrian（第 3 课）。
2. Rome 如何执行调用（第 4 课）。
3. 调用 Solana 程序（第 5 课）。
4. 代币与封装器（第 6 课）。
5. Solana 钱包通道（第 7 课）。
6. 反向操作：通过 EVM 钱包访问你的 Solana 程序（第 8 课）。

第 10 和第 11 课将应用带给真实用户，并接入真实资金。第 12 课则简要概述更大的下一步：构建你自己的 Rome 链。

下一课， [你可以构建什么](https://docs.rome.builders/zh/rome-xue-yuan/02-what-you-can-build.md)将介绍这种模式适用的场景。

## 这两个网络

* **Hadrian** 是公共测试网。它在 Solana Devnet 上结算，使用的 USDC 是测试 USDC。你可以先在这里完成所有构建。
* **Rubicon** 是主网。它在 Solana 主网上结算，Gas 使用真实 USDC 支付。

两个网络都使用 USDC 支付 Gas。Rubicon 运行相同的 EVM，因此同一份合约构建产物可以部署到两个网络。链 ID、RPC URL 和区块浏览器链接请参阅 [Hadrian](https://docs.rome.builders/zh/wang-luo/hadrian.md) 和 [Rubicon](https://docs.rome.builders/zh/wang-luo/rubicon.md)。课程会引导你前往这些页面，不再重复列出相关信息。

## 查看实际运行效果

Rome 上的应用展示了这一理念的实际运用。 [Rome 上的应用](https://docs.rome.builders/zh/rome-shang-de-ying-yong/apps.md) 列出了这些应用。现在值得打开看看其中两个：

* Rome DEX：一个同时供 EVM 和 Solana 钱包交易的资金池。
* Aerarium：一个借贷市场，两类用户都可以在其中提供资产和借入资产。

打开其中一个应用，看看它的钱包连接界面。界面支持这两种钱包。

## 自测

试着不看答案回答下面的问题，然后再展开答案。

1. 在 Rome 上部署合约后，合约代码存储在哪里？
2. 一位 Solana 用户和一位 MetaMask 用户调用你的金库合约。对他们各自而言，金库合约收到的 `msg.sender` 是什么？
3. 你应该先在哪个网络上构建，为什么？

<details>

<summary>答案</summary>

1. 合约代码存储在由 Rome EVM 程序拥有的 Solana 账户中。合约在 Solana 运行时内执行。
2. 一个普通地址。对于 MetaMask 用户，这是其 EVM 地址；对于 Solana 用户，这是根据其 Solana 密钥派生出的合成地址。
3. Hadrian。它使用的 USDC 是测试 USDC，因此出错不会造成损失。Rubicon 是生产环境，Gas 使用真实 USDC 支付。

</details>

## 下一步

[2. 你可以构建什么：重要的应用场景](https://docs.rome.builders/zh/rome-xue-yuan/02-what-you-can-build.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-xue-yuan/01-what-you-are-building.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.
