# Ed25519.fromMnemonic

Derives an Ed25519 private key from a BIP-39 mnemonic.

This is equivalent to passing `Mnemonic.toSeed(mnemonic, { passphrase })` to [`Ed25519.fromSeed`](/node/crypto/Ed25519/fromSeed).

## Imports

:::code-group
```ts [Named]
import { Ed25519 } from 'ox/node'
```

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

## Examples

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

const privateKey = Ed25519.fromMnemonic(
  'test test test test test test test test test test test junk'
)
```

## Definition

```ts
function fromMnemonic<as>(
  mnemonic: string,
  options?: fromMnemonic.Options<as>,
): fromMnemonic.ReturnType<as>
```

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

## Parameters

### mnemonic

* **Type:** `string`

BIP-39 mnemonic phrase.

### options

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

Options.

#### options.as

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

Format of the returned private key.

#### options.passphrase

* **Type:** `string`
* **Optional**

Optional BIP-39 passphrase.

## Return Type

An Ed25519 private key.

`fromMnemonic.ReturnType<as>`
