> For the complete documentation index, see [llms.txt](https://docs.fetcch.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fetcch.xyz/universal-identity-layer/how-it-works/how-is-it-stored.md).

# How is it stored?

Fetcch Identities are stored using an efficient onchain storage system that ensures verifiability, interoperability, and minimal gas costs. This approach enables Fetcch to cover the gas expenses for users, contributing to a seamless experience.

### Storage Structure

<figure><img src="/files/g5ozOWgKAuJzh039Mixh" alt=""><figcaption></figcaption></figure>

1. **Versioned Format**: Identities are stored in a version-based format, such as v1, v2, etc. This allows tracking of historical changes to identities, ensuring changes adhere to protocol rules.
2. **Content Identifier (CID)**: The metadata of each identity is stored using a CID from IPFS or Arweave. This CID provides a reference to the offchain location of the identity's metadata.
3. **Default Address**: The default address associated with the identity is stored as bytes.
4. **Secondary Addresses**: An array of secondary addresses related to the identity is stored as bytes.
5. **Timestamp**: The timestamp indicating when the identity was created.
6. **Merkle Root**: For each identity version, a Merkle root is generated. This root serves multiple purposes:
   1. It enables verification of whether an address is part of an identity by generating Merkle proofs.
   2. It verifies the validity of identities obtained from offchain sources.

### Storage Process

1. **User Interaction**: Wallets initiate either a POST or PATCH request to `/v1/identity` to create or modify identities.
2. **Private Data Encryption**: Fetcch encrypts private data within the identity and stores all data on decentralized storage platforms like IPFS or Arweave.
3. **Proof Generation**: Necessary proofs for the identity, requests, and address books are generated. These proofs contribute to the overall integrity and security of the identity.
4. **Data Sequencing**: All required data, including metadata, proofs, and roots, are organized into a sequence, ensuring coherent and structured storage.
5. **Regular Onchain Updates**: At regular intervals of approximately 10 minutes, Fetcch initiates onchain transactions to update each identity present in the sequence. This keeps the onchain identity information up to date and aligned with offchain changes.

This meticulous storage mechanism ensures that Fetcch Identities maintain a high degree of security, verifiability, and interoperability while effectively managing gas costs for users. For further technical details, you can refer to the associated resources.


---

# 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.fetcch.xyz/universal-identity-layer/how-it-works/how-is-it-stored.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.
