# User account

Accounts in Folks Finance are designed to manage users' positions and facilitate lending functionality across multiple blockchains. Each account is uniquely identified and allows for efficient cross-chain operations.

**Account Structure**

* **Unique Identifier:** Each account has a unique `bytes32` identifier.
* **Blockchain Addresses:** Accounts are managed using blockchain addresses, uniquely identified by the tuple `(chain identifier, chain address)`.

**Key Features**

1. **Single Address per Chain:**
   * Each account can have at most one address registered per spoke chain. This simplification ensures that operations are streamlined and user-friendly.
   * For example, if a user is borrowing ETH, they will receive it in their registered Ethereum address without needing to specify which address to use.
2. **Unique Address Registration:**
   * The same `(chain identifier, chain address)` pair cannot be registered to multiple accounts. This prevents confusion and ensures that users do not unintentionally interact with the wrong account.
   * The concept of inviting and accepting is used to manage address registrations. An existing registered address can invite another address from a different spoke chain to join the account. The invited address must then accept the invitation to be registered.
3. **Delegated Addresses:**
   * To enhance composability and allow other protocols to build on top of Folks Finance, accounts can add "delegated addresses." These addresses can manage accounts from the hub chain.
   * Multiple delegated addresses can be added to a single account, and the same address can be delegated to by multiple accounts. This feature is intended for use by other smart contracts on the hub chain that leverage the Folks Finance protocol.

**Account Operations**

1. **Invite and Accept:**
   * An address from one spoke chain can invite another address from a different spoke chain to join the account.
   * The invitee must accept the invitation for the registration to be completed.
2. **Manage Account:**
   * Once registered, addresses can manage the account, including withdrawing, inviting other addresses, and more.
3. **Delegation:**
   * Delegated addresses are given privileges to manage the account, allowing for seamless integration with other protocols and services.

**Security Considerations**

* **Denial of Service Protection:**
  * To prevent denial of service attacks, the same `(chain identifier, chain address)` pair cannot be registered to multiple accounts. This ensures that malicious actors cannot add an address to their account to block its use elsewhere.
* **Trusted Integrators:**
  * It is crucial for users to verify the addresses they delegate to. Malicious addresses can steal funds, so users must be cautious and only delegate to trusted integrators.


---

# 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.xapp.folks.finance/xlending/user-account.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.
