# deserializeSortedBlock

> **deserializeSortedBlock**(`bytes`): [`SortedBlock`](/reference/knotkit/sorted-block/interfaces/sortedblock/)

Defined in: [packages/sorted-block/src/serialization.ts:95](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/sorted-block/src/serialization.ts#L95)

Decode bytes written by [serializeSortedBlock](/reference/knotkit/sorted-block/wire/functions/serializesortedblock/).

The payload is validated in full before a block is returned, in O(byte length): the trailer and restart-table geometry, restart offsets that start at 0, strictly ascend, and land on entry boundaries, canonical uint32 varints, entries inside the entries section, a zero shared prefix at every restart point and none longer than the previous key, strictly ascending rebuilt keys, and an entry count equal to the trailer’s. The block owns a copy of the bytes.

## Parameters

### bytes

`Uint8Array`

## Returns

[`SortedBlock`](/reference/knotkit/sorted-block/interfaces/sortedblock/)

## Throws

With `CORRUPT_BLOCK_PAYLOAD` when the payload breaks one of those rules, `INVALID_PACKAGE_HEADER` for a malformed header, `UNKNOWN_KIND` for a kind tag this release does not read, or a shared wire code from `SORTED_BLOCK_PARSE_ERROR_CODES` for a malformed envelope.
