# Bls.randomPrivateKey

Generates a random BLS12-381 private key.

## Imports

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

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

## Examples

```ts twoslash
import { Bls } from 'ox'

const privateKey = Bls.randomPrivateKey()
```

## Definition

```ts
function randomPrivateKey<as>(
  options?: randomPrivateKey.Options<as>,
): randomPrivateKey.ReturnType<as>
```

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

## Parameters

### options

* **Type:** `randomPrivateKey.Options<as>`
* **Optional**

The options to generate the private key.

#### options.as

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

Format of the returned private key.

## Return Type

The generated private key.

`randomPrivateKey.ReturnType<as>`
