# Module Accounts

Certain LagomChain modules have dedicated module accounts, which act as wallets controlled exclusively by their respective modules. These accounts are used to manage minting, burning, staking, and IBC transfers.

***

### **Module Accounts & Permissions**

Each module account has specific permissions that define what operations it can perform.

#### Types of Permissions

* Burner – Can burn (destroy) tokens.
* Minter – Can mint (create) new tokens.
* Staking – Can stake tokens on behalf of users.

These permissions ensure that only authorized modules execute key token-related operations, preventing unauthorized minting or burning.

***

### **IBC Module Accounts in LagomChain**

In addition to standard module accounts, IBC transfers use specialized module accounts to escrow tokens when LagomChain is the source chain of a transfer.

#### How IBC Escrow Accounts Work

1. When an IBC transfer is initiated, the tokens are escrowed into a module account.
2. Each IBC connection has a unique escrow account, derived using SHA256 hashing.
3. The account format follows ADR 028, using the first 20 bytes of the SHA256 hash of the account name.

**Example: Generating an IBC Escrow Address**

```go
// The account name is composed of the IBC version, portID, and channelID
accountName := Version + "\0" + portID + "/" + channelID
addr := sha256.Sum256(accountName)[:20]

// Example for channel-0
addr := sha256.Sum256("ics20-1\0transfer/channel-0")[:20]
```

**Note:**\
These IBC escrow accounts do not appear in standard queries using:

```sh
lagomd q auth module-accounts
```

This is because module accounts are pre-defined at compile time, and dynamically generated IBC accounts are not included in the AccountKeeper's address map.


---

# 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.lagomchain.com/module-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.
