# Blobs.toCommitments

Compute commitments from a list of [`Blobs.Blobs`](/api/Blobs/types#blobs).

## Imports

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

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

## Examples

```ts twoslash
// @noErrors
import { Blobs } from 'ox'
import { kzg } from './kzg'

const blobs = Blobs.from('0xdeadbeef')
const commitments = Blobs.toCommitments(blobs, { kzg }) // [!code focus]
```

### Configuring Return Type

It is possible to configure the return type with the `as` option.

```ts twoslash
// @noErrors
import { Blobs } from 'ox'
import { kzg } from './kzg'

const blobs = Blobs.from('0xdeadbeef')
const commitments = Blobs.toCommitments(blobs, {
  as: 'Bytes', // [!code focus]
  kzg
})
// @log: [Uint8Array [ ... ], Uint8Array [ ... ]]
```

## Definition

```ts
function toCommitments<blobs, as>(
  blobs: blobs | Blobs<Bytes.Bytes> | Blobs<Hex.Hex>,
  options: toCommitments.Options<as>,
): toCommitments.ReturnType<as>
```

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

## Parameters

### blobs

* **Type:** `blobs | Blobs<Bytes.Bytes> | Blobs<Hex.Hex>`

The [`Blobs.Blobs`](/api/Blobs/types#blobs) to transform to commitments.

### options

* **Type:** `toCommitments.Options<as>`

Options.

#### options.as

* **Type:** `"Bytes" | "Hex" | as`
* **Optional**

Return type.

#### options.kzg

* **Type:** `Pick`

KZG implementation.

## Return Type

The commitments.

`toCommitments.ReturnType<as>`
