# Merkle Tree-based BaaSid Backend System

## Merkle Tree-based BaaSid Backend System

BaaSid's backend system is designed with an **off-chain structure based on Merkle Tree** to effectively verify the authenticity of data. Initially operated through BaaSid's own mainnet, it has now been **migrated to an Ethereum base** to increase token utilization and strengthen connectivity with external ecosystems. Furthermore, it is planned to be upgraded to a **lightweight on-chain verification method** based on Layer 2 such as Arbitrum in the future for more expanded accessibility and processing efficiency. Through this, we aim to build a blockchain data verification infrastructure that satisfies reliability, scalability, and cost efficiency.

<figure><img src="/files/gY6vg11R4wmtUKUWQxit" alt="" width="375"><figcaption></figcaption></figure>

<div align="left"><figure><img src="/files/UDEJOxVZtTBa3MFnSXOd" alt="" width="16"><figcaption></figcaption></figure></div>

## Technical Structure:

* **Merkle Tree generation**: Hash data (responses, votes, etc.) created by users or companies to create a tree structure
* **Root hash storage**: Record only the generated Merkle Root on the blockchain
* **Verification request processing**: Verify whether specific data is included through Merkle Proof provided by users
* **Data forgery prevention**: Able to detect forgery without directly storing original data

<h3 align="center">Voting data verification: Merkle tree</h3>

<p align="center">off-chain storage pattern</p>

<figure><img src="/files/DpHZMfqsnMIcRg7zCltS" alt="" width="375"><figcaption></figcaption></figure>

<p align="center">Cryptographic proof in Merckle tree</p>

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

{% hint style="info" %}
To prove that an element (hK on the picture) is in the hash, we have to assemble the hash again, and it’s mandatory to use the hK hash during the assembling because we want to prove that hK is in the list. If we assemble the top hash with explicit usage of the element’s hash (hK), it means that the element’s hash is contained in the top hash. So, a smart contract function, that wants to check if an element is in the root, should re-create the root hash itself, using the element’s hash and other hashes nearby it, and check, if the result is the same as the root hash. If the result is the same, it means, that the root hash contains the hash of the element.Merkle Root Tree — Structure of hashes, ending with a hash of all hashes in the root. (sauce : Medium Solidity : Merkle Tree)
{% 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://baasid.gitbook.io/baasid-docs/whitepaper/baas-token/merkle-tree-based-baasid-backend-system.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.
