> For the complete documentation index, see [llms.txt](https://docs.xyb.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xyb.co/xyb-platform-1/xyb-ledger/integrate-with-xyb-ledger/understanding-the-ledger-structure-charts-accounts-wallets/how-to-create-wallets-in-the-ledger-system.md).

# How to Create Wallets in the Ledger System

A wallet is a collection of funds associated with a ledger account. Each wallet is uniquely identified by its address and is characterized by:

* **Currency:** The type of currency the wallet supports (e.g., USD, GBP).
* **Accounting Type:** Indicates the financial category (Asset, Liability, Revenue, Expense, Equity).
* **Decimal Places:** Specifies the precision for balances.

Wallets enable:

* Segregation of funds by purpose (e.g., operational funds vs. reserves).
* Accurate accounting for transactions and balances.

***

## **When to Create Wallets**

Wallets should be created in the following scenarios:

* **Setting Up New Accounts:** Every account needs at least one wallet to store funds.
* **Handling Multiple Currencies:** Separate wallets are required for each currency under an account.
* **Isolating Transactions:** Use distinct wallets for different types of funds or transactions (e.g., revenue vs. expenses).

***

## How to Create Wallets

#### **1. Prepare the Parent Account**

Before creating a wallet, ensure that a parent account (chart or group) is already set up. Wallets cannot exist independently and must be associated with an account.

**Example Command (Create Parent Account):**

```bash
./luca create-chart-account company operational-account
./luca transition /chart/company/operational-account OPEN
```

***

2. **Define Wallet Attributes**

Determine the following attributes for the wallet:

* **Wallet Name:** A unique identifier for the wallet under the account.
* **Currency:** Specify the currency code (e.g., GBP, USD).
* **Accounting Type:** Choose one of the following:
  * **ASSET:** Owned resources.
  * **LIABILITY:** Obligations to third parties (e.g., customer balances).
  * **REVENUE:** Income streams.
  * **EXPENSE:** Costs incurred.
  * **EQUITY:** Owner’s residual interest in assets.
* **Decimal Places:** Define the precision for balance calculations.

***

**3: Create the Wallet**

Use the `luca` command-line tool to create the wallet. Include the parent account, wallet name, currency, accounting type, and decimal places.

**Example Command:**

```bash
./luca create-chart-wallet --create-parent company operational-account default GBP ASSET --decimal-places=2
```

This creates a wallet named `default` under the `operational-account` with:

* Currency: GBP
* Accounting Type: ASSET
* Decimal Places: 2

***

**4: Verify the Wallet**

After creation, verify that the wallet has been set up correctly by retrieving its details.

**Example Command:**

```bash
./luca read-chart-account company operational-account
```

***

**Best Practices**

* **Use Clear Wallet Names:** Names like `default`, `sales`, or `savings` make it easier to identify wallets later.
* **Ensure Accurate Decimal Places:** Use sufficient precision to avoid errors in large transactions (e.g., cryptocurrency wallets may require up to 8 decimal places).
* **Plan Currency and Accounting Types:** Define these attributes during account setup to prevent unnecessary modifications later.

***

#### **Troubleshooting Wallet Creation**

* **Error:** `Parent account does not exist.`

  * Ensure the parent account is created and transitioned to `OPEN`.

  **Command to Create Parent:**

  ```bash
  ./luca create-chart-account company reserve-account
  ./luca transition /chart/company/reserve-account OPEN
  ```
* **Error:** `Invalid accounting type.`
  * Confirm the accounting type matches one of the predefined types: ASSET, LIABILITY, REVENUE, EXPENSE, EQUITY.
* **Error:** `Wallet already exists.`

  * Use the `--modify-if-exists` flag to update the wallet.

  **Command:**

  <pre class="language-bash"><code class="lang-bash"><strong>./luca create-chart-wallet --modify-if-exists company operational-account default GBP ASSET --decimal-places=2
  </strong></code></pre>


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.xyb.co/xyb-platform-1/xyb-ledger/integrate-with-xyb-ledger/understanding-the-ledger-structure-charts-accounts-wallets/how-to-create-wallets-in-the-ledger-system.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
