> 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/12-launch-your-own-chain.md).

# 启动你自己的链

App Sovereignty 为你带来什么（你自己的链 ID、任意 SPL 代币作为 gas、gas 收入归你的应用所有），它适合什么场景，哪些保持不变，以及如何开始。

到目前为止，所有内容都运行在共享链上：测试使用 Hadrian，生产环境使用 Rubicon。Rome 还允许单个应用运行自己的链。本课将概述这一方案，也是本课程的最后一课。

## 你将学到

* App Sovereignty 能为你的应用带来什么。
* 什么时候适合拥有自己的链，什么时候在 Rubicon 上部署应用就足够了。
* 开发者和用户的哪些体验保持不变、如何开始，以及 gas 代币如何定价。

## 开始之前

* 完成 [11. 部署到 Rubicon](https://docs.rome.builders/zh/rome-xue-yuan/11-ship-to-rubicon.md)。在考虑创建自己的链之前，先在共享链上部署一个应用。
* 快速浏览 [4. Rome 如何运行你的代码](https://docs.rome.builders/zh/rome-xue-yuan/04-how-rome-runs-your-code.md)。你的链以相同的方式运行。

## 你将获得

App Sovereignty 允许 Solana 应用启动自己的 EVM 环境：

* **自己的链 ID。** 你的应用拥有独立的链。
* **自己的 gas 代币。** 任意 SPL 代币：你的项目代币、USDC 或 SOL。
* **Gas 收入。** 交易手续费归入你的金库，而不是共享协议。
* **完整的 EVM 工具链。** 用户使用你的链 ID 连接 MetaMask。开发者使用 Hardhat 或 Foundry。
* **共享状态。** EVM 用户和 Solana 用户共享相同的应用状态和流动性。

产品页面 [App Sovereignty](https://docs.rome.builders/zh/chan-pin/app-sovereignty.md)给出了一个示例：一个希望吸引 EVM 用户的 Solana 预测市场。该市场使用自己的代币支付 gas，EVM 用户通过调用 Solana 程序的合约访问市场，而市场则赚取 gas 手续费。

## 适用场景

大多数应用都不需要自己的链。在 Rubicon 上部署应用，就已经可以触达 EVM 钱包和 Solana 钱包、共享流动性，并使用本课程介绍的工具。以下情况适合拥有自己的链：

* 你希望用户使用你的代币而非 USDC 支付 gas。
* 你希望应用产生的 gas 手续费归你所有。
* 你希望拥有自己的链 ID，并让你的应用成为整条链。

## 保持不变的部分

* 你仍然使用相同的工具部署 Solidity。
* 合约仍通过相同的预编译合约调用 Solana，而访问 Solana 程序的方式与第 8 课所示相同。
* 代币仍是相同的 SPL 代币。你的链有自己的包装合约，因此请从其注册表条目中获取合约地址，就像第 11 课中为 Rubicon 获取地址一样。
* 限制也相同，因为它们来自 Solana：原子操作预算、账户数量上限和交易大小。请参阅 [限制](https://docs.rome.builders/zh/he-xin-gai-nian/constraints.md).

这条链会记录在公开的 [Rome 注册表](https://github.com/rome-protocol/rome-registry) 中，其中包含链 ID、RPC 和合约地址，与 [Hadrian](https://docs.rome.builders/zh/wang-luo/hadrian.md) 相同。变化的是链 ID、gas 代币以及手续费的归属方。用户需要持有你的代币来支付 gas，而不是 USDC，因此请规划好他们如何获取该代币。

## 如何开始

1. **通过 Sovereign Portal 完成接入。** Rome 会为你开通门户访问权限，你可以在其中设置链 ID 和 gas 代币（任意 SPL 铸币代币）。 [App Sovereignty](https://docs.rome.builders/zh/chan-pin/app-sovereignty.md) 页面提供了该门户的链接。
2. **由 Rome 启动这条链。** Rome 团队负责配置并运营这条链的基础设施，你无需自行运行。
3. **部署合约。** 标准 Solidity 部署方式，如 [第 3 课](https://docs.rome.builders/zh/rome-xue-yuan/03-first-contract-on-hadrian.md).
4. **用户连接。** 使用配置了你的链 ID 的 MetaMask，或任何 EVM 钱包。

## Gas 代币的定价方式

Solana 使用 SOL 收取费用，而 Rome 将每个 gas 单位按一个 lamport 的 Solana 成本计算。用户使用你的代币付款，因此链需要一个价格，用于在你的代币和 SOL 之间进行换算。通常使用 Meteora 流动性池作为价格来源：代理会读取该池，在你的 gas 代币和 SOL 之间进行换算。价格预言机和固定价格也是其他可选来源。请参阅 [Gas 与定价](https://docs.rome.builders/zh/kuai-su-ru-men/architecture.md#gas-and-pricing) 和 [Gas 代币定价](https://docs.rome.builders/zh/chan-pin/app-sovereignty.md#gas-token-pricing).

## 状态

App Sovereignty 已上线：这是一款与合作伙伴共同推出的活跃产品。

## 检验一下

<details>

<summary>1. 你的 Solana 应用只想吸引 EVM 用户。你需要自己的链吗？</summary>

不需要。部署在 Rubicon 上的应用可触达 EVM 钱包和 Solana 钱包。只有在你需要自己的 gas 代币、获得 gas 收入或使用自己的链 ID 时，才选择创建自己的链。

</details>

<details>

<summary>2. 为什么链需要知道你的代币价格？</summary>

Solana 交易费用以 SOL 支付。Rome 会将每笔交易的 SOL 成本换算成你的 gas 代币，而价格来源则提供换算所需的价格。

</details>

## 下一步

本课程到此结束，另有 [13. 在 Solgate 上构建](https://docs.rome.builders/zh/rome-xue-yuan/13-build-on-solgate.md) 作为关于跨链桥的额外课程。开始下一个项目时，可以参考这些指南和示例应用：

* 将你的应用提交到 [Arena](https://arena.mainnet.romeprotocol.xyz)，Rome 团队会在这里审核应用并提供资助。
* 返回指南，查看每节课背后的代码。 [构建双通道应用](https://docs.rome.builders/zh/kai-fa-zhe-zhi-nan/dual-lane-app.md) 和 [集成 Solana 程序](https://docs.rome.builders/zh/kai-fa-zhe-zhi-nan/integrate-solana-program.md) 是你最常会重新查阅的两个指南。
* 在以下文档中查找确切数值： [预编译合约](https://docs.rome.builders/zh/can-kao/precompiles.md), [合约地址](https://docs.rome.builders/zh/can-kao/contract-addresses.md) 和 [Rubicon](https://docs.rome.builders/zh/wang-luo/rubicon.md).
* 在以下组织的 GitHub 仓库中阅读示例应用： [rome-protocol](https://github.com/rome-protocol) GitHub 组织：rome-dex、aerarium 和 cardo。
* 如有疑问或要报告问题，请通过 [社区](https://docs.rome.builders/zh/zi-yuan/community.md) 页面上的渠道联系我们。

[返回课程地图](https://docs.rome.builders/zh/rome-xue-yuan/academy.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/12-launch-your-own-chain.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.
