Skip to main content
HDWallet implements BIP-32 hierarchical deterministic key derivation and BIP-44 multi-account paths over secp256k1, backed by @scure/bip32. Every function accepts an ExtendedKey as its first argument rather than attaching methods to the key object.

BIP-39 / BIP-32 / BIP-44 Hierarchy

Imports

HDWallet is exported from @tevm/voltaire/HDWallet and @tevm/voltaire/native (it is not re-exported from the root @tevm/voltaire barrel).

API Reference

Constructors & Serialization

Derivation & Key Inspection

Path Utilities, Mnemonic Helpers, and Constants

  • Path helpers: isHardenedPath(path), isValidPath(path), parseIndex(segment)
  • Mnemonic helpers: generateMnemonic, mnemonicToSeed, validateMnemonic
  • Constants:
    • HARDENED_OFFSET = 0x80000000 (2^31)
    • CoinType = { BTC: 0, BTC_TESTNET: 1, ETH: 60, ETC: 61 }
    • BIP44_PATH = { ETH(account = 0, index = 0), BTC(account = 0, index = 0) }

Security Invariants

In BIP-32 non-hardened derivation, leaking a parent xpub together with any non-hardened child private key reveals the parent private key. Always keep purpose', coin_type', and account' hardened ('), and never expose a master xpub alongside child private keys.
  • Public key format: HDWallet.getPublicKey returns a 33-byte compressed key (0x02/0x03 + x). Decompress with PublicKey.decompress to 64 bytes before hashing for an Ethereum address.
  • Errors: Invalid paths throw InvalidPathError; invalid seeds or keys throw InvalidSeedError / InvalidKeyError; hardened derivation from an xpub throws HardenedDerivationError.