> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kuru.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating Subaccounts

> Create ID-based trading balances and fund them from the root.

A child is an AccountCore ledger entry with a numeric ID. It has no wallet address, deployment, private key, or child-specific signer registry.

## Direct creation

```typescript theme={null}
const hash = await kuru.account.createSubaccount({ rootOwner: owner.address });
const receipt = await publicClient.waitForTransactionReceipt({ hash });
if (receipt.status !== "success") throw new Error("Creation reverted");
const rootAccountId = await kuru.account.getRootAccountId({ rootOwner: owner.address });
const children = await kuru.account.getSubaccounts({ rootAccountId });
```

Use the receipt's `SubaccountCreated` event to identify this transaction's child if several workers can create children concurrently. Do not infer it from the last element of a later list read.

The owner or a live root `TRADE`/`ADMIN` signer may create a child. Only the owner may bootstrap an unregistered root. Creating a child does not advance the root authorization epoch.

## Signed creation

`buildCreateSubaccountTypedData` binds `rootOwner`, `authorizer`, the next `subaccountSeq`, current root `authNonce`, and `deadline`. The owner or authorized root signer signs; there is no child consent signature.

Submit with `createSubaccountBySig`. Read the next sequence and epoch before signing. Two requests for the same sequence compete, so rebuild the losing request after one succeeds. The sequence is a `uint16`; a root supports at most 65,535 children. IDs and sequences are never reused.

The domain is `KuruAccountCore`, version `1`, chain ID, and AccountCore proxy address. EOA and ERC-1271 authorizers are supported by the contract.

## Funding and withdrawals

Deposit into the root, then use `transferBetweenAccounts` with numeric source and destination IDs. Transfer child proceeds back to the root before withdrawing externally. Orders and positions remain attached to their original ID.

All children inherit the root's signers and fee policy. For exact signatures, see [AccountCore](/contracts/account-core).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.