# Accounts

The account contains complete information about a user's private wallet. It is linked by the intermediate key $$\eta$$ derived from the spending key $$\sigma$$owned by the user. The holder of the spending key is called an account owner.

The account holds the current balance value and `spent offset` which separates all notes into spent and unspent. This is sufficient data to retrieve a wallet state.

An account is a tuple $$(d, P\_d, i, b, e)$$ where:

* $$d$$ (10 bytes) is a random diversifier which is updated every time an account is updated. It acts like a salt.
* $$P\_d$$ (32 bytes) is diversified public key (a value derived from the $$d$$ and intermediate key $$\eta$$): $$P\_d = \eta \* \text{ToSubGroupHash}\_{E(F\_r)}(d)$$
* $$i$$(6 bytes) is the spent offset. It separates used (spent) and unused notes in the [Merkle tree](/implementation/untitled.md) . Note that indexes below $$i$$ are considered to be spent.
* $$b$$(8 bytes) is the current account balance
* $$e$$(8 bytes) is an [energy](/roadmap/exploratory-features/xp.md)(XP) unit ("integral" account balance)

The raw account size is 64 bytes.

Account transaction data never appears unencrypted in a public field. Only the account owner can decrypt it.

{% hint style="info" %}

#### Zero account

When a user creates their first transaction there will not be an existing account in the Merkle tree. In this case a zero account should be used where all fields are zero except $$\eta$$.​
{% endhint %}


---

# Agent Instructions: 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.zkbob.com/implementation/account-and-notes/accounts.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.
