# Data storage formats

ClishaChain offers two formats for storing the world state, [Forest of Tries](#forest-of-tries) and [Bonsai Tries](#bonsai-tries).

## Forest of Tries

Forest of Tries, also called forest mode, is the default storage format.

In forest mode, each node in the trie is saved in a key-value store by hash. For each block, the world state is updated with new nodes, leaf nodes, and a new state root. Old leaf nodes remain in the underlying data store. Data is accessed and stored by hash, which increases the size of the database and increases the resources and time needed to access account data.

![forest\_of\_tries](/files/URPqdRofnZMXTqEZISrd)

### Pruning

Pruning reduces the storage required by removing state trie nodes unreachable from recent blocks.

Pruning is disabled by default, and can be enabled with the `--pruning-enabled` command line option.

Pruning might increase block import times, but it doesn't affect the ability of nodes to stay in sync.

Pruning is being deprecated for [Bonsai Tries](#bonsai-tries) and is currently not being updated.

## Bonsai Tries

Bonsai Tries is a data storage layout policy designed to reduce storage requirements and increase read performance.

Bonsai stores leaf values in a trie log, separate from the branches of the trie. Bonsai stores nodes by the location of the node instead of the hash of the node. Bonsai can access the leaf from the underlying storage directly using the account key. This greatly reduces the disk space needed for storage and allows for less resource-demanding and faster read performance. Bonsai inherently prunes orphaned nodes and old branches.

To run a node with Bonsai Tries data storage format, use the command line option [`--data-storage-format=BONSAI`](https://github.com/ClishaChain/docs/blob/main/docs/besu/reference/cli/options.md#data-storage-format).

![Bonsai\_tries](/files/7xGGvj469PHCCphf0DIe)

### Accessing data

Forest mode must go through all the branches by hash to read a leaf value. Bonsai can access the leaf from the underlying storage directly using the account key. Bonsai will generally read faster than forest mode, particularly if the blocks are more recent.

However, Bonsai becomes increasingly more resource-intensive the further in history you try to read data. To prevent this, you can limit how far Bonsai looks back while reconstructing data. The default limit Bonsai looks back is 512. To change the parameter, use the `--bonsai-maximum-back-layers-to-load` option.

Using `--bonsai-maximum-back-layers-to-load` doesn't affect the size of the database being stored, only how far back to load. This means there is no "safe minimum" value to use with this option.


---

# 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.clishachain.com/operate-a-node/data-storage-formats.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.
