# BinaryStateTree.merkelize

Merkelizes a Binary State Tree.

## Imports

:::code-group
```ts [Named]
import { BinaryStateTree } from 'ox'
```

```ts [Entrypoint]
import * as BinaryStateTree from 'ox/BinaryStateTree'
```
:::

## Examples

```ts twoslash
import { BinaryStateTree, Bytes } from 'ox'

const tree = BinaryStateTree.create()

BinaryStateTree.insert(
  tree,
  Bytes.fromHex(
    '0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54'
  ),
  Bytes.fromHex(
    '0xd4fd4e189132273036449fc9e11198c739161b4c0116a9a2dccdfa1c492006f1'
  )
)

const hash = BinaryStateTree.merkelize(tree) // [!code focus]
```

## Definition

```ts
function merkelize(
  tree: BinaryStateTree.BinaryStateTree,
): Bytes.Bytes
```

**Source:** [src/core/BinaryStateTree.ts](https://github.com/wevm/ox/blob/main/src/core/BinaryStateTree.ts#L281)

## Parameters

### tree

* **Type:** [`BinaryStateTree.BinaryStateTree`](/api/BinaryStateTree/types#binarystatetreebinarystatetree)

Binary State Tree instance.

#### tree.root

* **Type:** `Node`

## Return Type

Merkle hash.

`Bytes.Bytes`
