# Secp256k1.createKeyPair

Creates a new secp256k1 ECDSA key pair consisting of a private key and its corresponding public key.

## Imports

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

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

## Examples

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

const { privateKey, publicKey } = Secp256k1.createKeyPair()
```

## Definition

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

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

## Parameters

### options

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

The options to generate the key pair.

#### options.as

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

Format of the returned private key.

## Return Type

The generated key pair containing both private and public keys.

`createKeyPair.ReturnType<as>`
