> For the complete documentation index, see [llms.txt](https://docs.eniac.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eniac.network/getting-started/quickstart/account-structure.md).

# Account Structure

On ENI, accounts are represented by two address formats:

* ENI **native Bech32** (`eni...`)
* **EVM-compatible Hex** (`0x...`)

Both addresses for a single account are derived from the same **public key**.Because eni is fully compatible with Ethereum and the Ethereum ecosystem is prosperous, it is recommended to use an eth address.

***

#### Deriving Addresses from Public Key

**ENI Address Derivation**

**ENI native addresses** are derived from the **public key** using the following steps:

1. Hash the public key using the `Keccak256` algorithm.
2. Extract the **first 20 bytes** of the resulting hash.
3. Encode the extracted bytes in **Bech32 format** with the **"eni" prefix.**

Example implementation:

```ts
import { bech32 } from 'bech32';
import { keccak256 } from 'ethereumjs-util';

export function deriveEniAddress(publicKey: Buffer): string {
  const hash = keccak256(publicKey);
  const words = bech32.toWords(hash.slice(0, 20));
  return bech32.encode('eni', words);
}
```

#### **EVM Address Derivation**

The EVM-compatible address is derived as follows:

1. Hash the public key using the `Keccak256` algorithm.
2. Extract the **last 20 bytes** of the resulting hash.
3. Prefix the extracted bytes with `0x` to obtain the EVM address.

Example implementation:

```ts
import { keccak256 } from 'ethereumjs-util';

export function deriveEVMAddress(publicKey: Buffer): string {
  const hash = keccak256(publicKey);
  return `0x${hash.slice(-20).toString('hex')}`;
}
```

#### **Summary**

* **Public Key Hash**：Both address derivations rely on the **Keccak256 hashing algorithm**.
* **ENI Address**：
  * Extracts the **first 20 bytes** of the hash.
  * Encodes these bytes into **Bech32 format** with the **"eni" prefix**.
* **EVM Address**：
  * Extracts the **last 20 bytes** of the hash.
  * Formats these bytes as **Hex** with the **"0x" prefix**.

#### **Why This Works**

`Keccak256` **hashing** ensures that the process of deriving both address formats from the same public key is **consistent and verifiable**.

This mechanism enables a **single account** to remain **compatible** in both **ENI native** and **EVM environments**.

***

#### **Next Steps**

For a detailed technical explanation on how to perform **account linking**, please refer to the **Wallet Linking** section.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eniac.network/getting-started/quickstart/account-structure.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
