> For the complete documentation index, see [llms.txt](https://docs.onefinity.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.onefinity.network/technology/run-a-onefinity-node/nodes/node-databases.md).

# Node Databases

### **Databases**[​](https://docs.multiversx.com/validators/node-databases#node-databases) <a href="#node-databases" id="node-databases"></a>

Nodes use simple Key-Value type databases.

Nodes use Serial LevelDB databases to persist processed blocks, transactions, and so on.

Data retention can be controlled in `config.toml` using pruning flags. There are two flags for the latest versions:

* `ValidatorCleanOldEpochsData`
* `ObserverCleanOldEpochsData`

For older configurations, the single flag is:

* `CleanOldEpochsData`

Setting these flags to false prevents the deletion of old databases.

By default, validators only keep the last 4 epochs and delete older ones for freeing disk space.

The default databases directory is `<node-working-directory>/db` and it's content should match the following structure:

```
/db
└── <chain id>
    ├── Epoch_X
    │  └── Shard_X -------->
    │        ├── BlockHeaders
    │        │    ├── 000001.log
    │        │    ├── CURRENT
    │        │    ├── LOCK
    │        │    ├── LOG
    │        │    └── MANIFEST-000000
    │        ├── BootstrapData
    │        │    ├── 000001.log
    |     .............
    └── Static
        └── Shard_X -------->
            ├── AccountsTrie
            │     └── MainDB
            │           ├── 000001.log
         .............
```

During startup, nodes check for an existing database and sync any missing data from the network to match the current network height.

### Starting a Node with Existing Databases

When both the configuration and the database shard match, the node inherits the full database state and needs to sync only the remaining items. For example, if a node starts with a database at epoch 255 and the current epoch is 256, it will sync only the missing epoch data.

The configuration of the new node should mirror that of the predecessor, with the exception of the BLS key, which does not depend on the database.

To expedite synchronization, it's possible to copy the fully synced database from another node. This process involves transferring the entire `db/` directory from the source to the target node.


---

# 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.onefinity.network/technology/run-a-onefinity-node/nodes/node-databases.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.
