Skip to main content

Try it Live

Run HDWallet examples in the interactive playground

Overview

HD wallets derive child keys from parent keys using HMAC-SHA512. BIP-32 defines two derivation methods: hardened (more secure) and normal (allows public derivation).
Examples:

Derivation Algorithm

Parent → Child Process

Hardened Derivation

Index Range

Hardened indices: 2^31 to 2^32 - 1 (2147483648 to 4294967295)

Notation

Security Properties

Requires Private Key:
Leak Protection:

Normal Derivation

Index Range

Normal indices: 0 to 2^31 - 1 (0 to 2147483647)

Public Derivation

Normal derivation allows deriving children from parent public key:

Use Cases

1. Watch-Only Wallets:
2. Server-Side Address Generation:
3. Auditing:

Sequential Derivation

Single-Level Derivation

Multi-Account Derivation

Batch Derivation

Path-Based Derivation

Full Path

Relative Path

Deterministic Derivation

Same Input = Same Output

Reproducible Wallets

Chain Code Usage

Chain Code in Derivation

Chain Code Secrecy

Advanced Derivation Patterns

Gap Limit Scanning

Parallel Derivation

Cached Derivation

Error Handling

Invalid Index

Hardened from Public Key

Invalid Path Format

Best Practices

1. Use Hardened for Sensitive Levels
2. Cache Intermediate Levels
3. Validate Derivation Results

References