> For the complete documentation index, see [llms.txt](https://docs.unix.market/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unix.market/account-model.md).

# Account Model

UniX uses a main / sub-account model. The main account creates UniX-generated sub-accounts, and each sub-account has no independent private key.

All read endpoints are public and require no authentication. Write endpoints are signed transactions: the node recovers `signer_address` from `signature`, resolves the target account, and checks whether the signer has permission for that operation.

## Account Types

| Type             | What it means                                                                       | Has its own private key? | Who can sign for it?                                                                         |
| ---------------- | ----------------------------------------------------------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------- |
| **Main account** | User-controlled TradeVM account. It can create sub-accounts and approve Agent Keys. | Yes                      | Main private key, or an Agent Key approved for the main account.                             |
| **Sub-account**  | Child account created by `POST /v1/account/create-sub`.                             | No                       | Main private key, main-account Agent, or an Agent approved specifically for the sub-account. |

## Main / Sub-Account

A sub-account is an on-chain account address generated by UniX. It cannot sign directly because it has no private key.

| Constraint  | Rule                                                          |
| ----------- | ------------------------------------------------------------- |
| Creation    | Main private key signs `POST /v1/account/create-sub`.         |
| Private key | No independent private key.                                   |
| Control     | Main account has full control.                                |
| Nesting     | A sub-account cannot create sub-accounts. Maximum depth is 2. |
| `label`     | Required, unique under the main account.                      |

## Permission Matrix

Read this table as "Can the signer perform this action?"

| Action                                     | Main private key | Main Agent | Sub-account Agent |
| ------------------------------------------ | :--------------: | :--------: | :---------------: |
| Trade main account                         |        Yes       |     Yes    |         -         |
| Trade sub-account                          |        Yes       |     Yes    |        Yes        |
| Transfer / withdraw from main account      |        Yes       |      -     |         -         |
| Transfer sub-account funds to main account |        Yes       |      -     |         -         |
| Create sub-account                         |        Yes       |      -     |         -         |

> Sub-accounts have no independent private key. All sub-account operations are executed by the main account or by an Agent Key authorized for the relevant account scope.

## Relationship Queries

| Endpoint                                  | What it returns                                                                                  |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `GET /v1/account/children?address=<main>` | Sub-accounts under the provided main account.                                                    |
| `GET /v1/account/main?address=<sub>`      | The main account address for a sub-account. Main accounts and unrelated addresses return `null`. |


---

# 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 dynamically by asking a question.

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

```
GET https://docs.unix.market/account-model.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.
