> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# HdKey.fromSeed

:::info
`HdKey.fromSeed` is a re-export of ox's [`HdKey.fromSeed`](https://oxlib.sh/api/HdKey/fromSeed). Refer to the ox documentation for the full reference.
:::

Creates a HD Key from a master seed.

## Imports

```ts
import { HdKey } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { HdKey, Mnemonic } from 'viem/utils'

const seed = Mnemonic.toSeed(
  'test test test test test test test test test test test junk'
)
const hdKey = HdKey.fromSeed(seed)
```

### Path Derivation

You can derive a HD Key at a specific path using `derive`.

```ts twoslash
// @noErrors
import { HdKey, Mnemonic } from 'viem/utils'

const mnemonic = Mnemonic.toSeed(
  'test test test test test test test test test test test junk'
)
const hdKey = HdKey.fromSeed(mnemonic).derive(HdKey.path())

console.log(hdKey.privateKey)
// @log: '0x...'
```

## Definition

```ts
function fromSeed(
  seed: Hex.Hex | Bytes.Bytes,
  options?: fromSeed.Options,
): HdKey
```

## Parameters

### seed

* **Type:** `Hex.Hex | Bytes.Bytes`

The master seed to create the HD Key from.

### options

* **Type:** `fromSeed.Options`
* **Optional**

Creation options.

#### options.versions

* **Type:** `Versions | undefined`
* **Optional**

The versions to use for the HD Key.

## Return Type

The HD Key.

`HdKey.HdKey`
