# Merkle persistence

The provable outputs ([vouchers](/cmio/reference/emit-voucher) and [notices](/cmio/reference/emit-notice)) live in an **outputs merkle tree** whose root summarizes everything the application has ever attested. Three methods persist, restore and reset that tree — needed when an application snapshots its own state and must bring the tree along.

Most applications never call these: inside the machine, the tree's lifecycle is handled by the machine snapshotting itself.

## rollup.saveMerkle

Stores the current outputs merkle tree state to a file.

```ts twoslash
import { Rollup } from '@deroll/cmio';
const rollup = new Rollup();
// ---cut---
rollup.saveMerkle('/state/outputs.merkle');
```

## rollup.loadMerkle

Restores the outputs merkle tree state from a file written by `saveMerkle`.

```ts twoslash
import { Rollup } from '@deroll/cmio';
const rollup = new Rollup();
// ---cut---
rollup.loadMerkle('/state/outputs.merkle');
```

## rollup.resetMerkle

Resets the outputs merkle tree to its pristine (empty) state.

```ts twoslash
import { Rollup } from '@deroll/cmio';
const rollup = new Rollup();
// ---cut---
rollup.resetMerkle();
```

## Returns

All three return `void`.

## Parameters

### file (`saveMerkle` / `loadMerkle`)

* Type: `string`
* Required

Path of the merkle state file.

## Errors

| Condition | Error |
| --- | --- |
| File not writable / not readable / corrupt | `RollupError` with negative `errno` |
