# @polkadot-labs/hdkd

> Hierarchical deterministic (HD) account derivation library compatible with the Polkadot and Substrate ecosystems, supporting the sr25519, ed25519, and ecdsa signature schemes.

Latest version **0.0.32** (published 2026-09-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @polkadot-labs/hdkd
pnpm add @polkadot-labs/hdkd
yarn add @polkadot-labs/hdkd
bun add @polkadot-labs/hdkd
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.32 |
| Published | 2026-09-06 |
| First published | 2023-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 6 |
| Author | kratico |
| Maintainers | kratico |
| Keywords | sr25519, ed25519, ecdsa, hdkd, ss58, bip39, schnorrkel, polkadot, substrate |

## Links

- npm: https://www.npmjs.com/package/@polkadot-labs/hdkd
- Repository: https://github.com/polkadot-labs/hdkd
- Homepage: https://github.com/polkadot-labs/hdkd#readme
- Issues: https://github.com/polkadot-labs/hdkd/issues
- npm.io page: https://npm.io/package/@polkadot-labs/hdkd

## Dependencies (1)

- [@polkadot-labs/hdkd-helpers](https://npm.io/package/@polkadot-labs/hdkd-helpers.md) ~0.0.34

## Recent versions

- 0.0.32 (latest) — 2026-09-06
- 0.0.31 — 2026-08-16
- 0.0.30 — 2026-08-13
- 0.0.29 — 2026-07-05
- 0.0.28 — 2026-04-13
- 0.0.27 — 2026-03-22
- 0.0.26 — 2025-12-10
- 0.0.25 — 2025-09-29
- 0.0.24 — 2025-09-07
- 0.0.23 — 2025-08-30
- 0.0.22 — 2025-08-18
- 0.0.21 — 2025-08-09
- 0.0.20 — 2025-07-23
- 0.0.19 — 2025-06-20
- 0.0.18 — 2025-06-20
- … 17 more at https://npm.io/package/@polkadot-labs/hdkd/versions

## README

# @polkadot-labs/hdkd

[![NPM Version](https://img.shields.io/npm/v/%40polkadot-labs%2Fhdkd)](https://www.npmjs.com/package/@polkadot-labs/hdkd) [![GitHub License](https://img.shields.io/github/license/polkadot-labs/hdkd)](https://github.com/polkadot-labs/hdkd/blob/main/LICENSE) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/polkadot-labs/hdkd/ci.yml)

`@polkadot-labs/hdkd` is a Hierarchical Deterministic (HD) account derivation library compatible with the Polkadot and Substrate ecosystems.
It supports the sr25519, ed25519, and ecdsa signature schemes, providing a comprehensive solution for HD account derivation.
It is built on top of `@polkadot-labs/hdkd-helpers`.

## Features

- **HD Derivation**: Utilities for deriving HD accounts with hard and soft derivation.
- **sr25519**: Support for the sr25519 signature scheme.
- **ed25519**: Support for the ed25519 signature scheme.
- **ecdsa**: Support for the ecdsa signature scheme.

## Installation

To install the library, you can use npm or yarn or pnpm:

```sh
npm install @polkadot-labs/hdkd
```

## Usage

Here is an example of how to use the library:

```ts
import { sr25519CreateDerive } from "@polkadot-labs/hdkd"
import {
  sr25519,
  DEV_PHRASE,
  entropyToMiniSecret,
  mnemonicToEntropy,
} from "@polkadot-labs/hdkd-helpers"

const entropy = mnemonicToEntropy(DEV_PHRASE)
const miniSecret = entropyToMiniSecret(entropy)
const derive = sr25519CreateDerive(miniSecret)

// Example usage for generating a sr25519 keypair with hard derivation
const keypair = derive("//Alice")

// Example usage for signing a message
const message = new TextEncoder().encode("Hello")
const signature = keypair.sign(message)

// Example usage for verifying a signature
const isValid = sr25519.verify(signature, message, keypair.publicKey)
console.log("Is valid:", isValid)
```

## License

This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for details.

---
_Source: https://npm.io/package/@polkadot-labs/hdkd · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
