> For the complete documentation index, see [llms.txt](https://docs.velio.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.velio.xyz/documentation/zh-cn/security/design-rationale.md).

# 设计理念

为什么采用这套架构？

永续合约交易同时面对两种需求：交易系统需要持续处理订单与风险变化，账户记录则需要有可供核对的依据。从用户发出指令，到资产与持仓更新，再到链上确认，每个环节承担的工作并不相同。

Velio Fabric 的设计思路，是将交易执行、账户状态证明与链上确认分开，再以同一份账户状态变更将它们连接起来。这让执行系统专注处理交易，也让账户更新有明确的验证流程。

### 让交易执行专注于市场操作

订单撮合、风险检查与持仓更新需要紧密协作。把这些工作放在链下执行层，可以将交易处理与主链的确认节奏分开安排；账户变更再进入后续证明与验证流程。

### 为账户变更提供可验证的依据

账户余额与持仓是交易结果的核心记录。ZK 对账电路将更新前后的状态、变更事件与所需授权连接起来，让链上合约能核对这次账户更新是否符合电路定义的关系。

### 以链上确认建立共同的状态基准

执行结果产生后，仍需要一个明确的接受步骤。验证合约在证明通过后更新状态根，为后续更新提供共同的起点。执行完成与链上确认的区分，也让每个阶段的责任更清楚。

### 让证明与数据各自发挥作用

证明用来核对状态变更，重建账户则需要实际数据。因此，架构另外将账户变更写入 DA 层。在具备起始状态与完整的账户变更数据时，可以沿着变更记录重建账户状态。

### 分工之后，如何连成完整流程？

执行层产生账户变更，证明引擎核对变更，链上合约接受通过验证的新状态。这些模块通过状态与事件数据衔接，形成从交易操作到账户状态确认的完整路径。

1. **执行交易**：处理指令与账户变更
2. **产生证明**：核对变更与所需授权
3. **链上确认**：接受通过验证的状态

三个阶段分工运作，以账户状态变更相互衔接。


---

# 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.velio.xyz/documentation/zh-cn/security/design-rationale.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.
