@exodus/bip32

中文文档
4.3.1发布于 2026/09/17MITTypeScriptES Module近 30 天下载 6.9万

Exodus BIP32 modules.

原始使用文档
文档目录6 节
  1. Install
  2. Usage
  3. Static Methods
  4. Constants
  5. Instance Methods
  6. Instance Properties

@exodus/bip32

This package helps you work with BIP32 keys.

Install

pnpm add @exodus/bip32

Usage

Typical usage revolves around loading a serialized BIP32 xpub, xpriv or master key, deriving child keys from it, and using the child key's publicKey/privateKey.

Example:

const key = BIP32.fromXPub(
  'xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8'
)

const childKey = key.derive('m/0/0')

Static Methods

fromMasterSeed(seed: Buffer): BIP32

Import a BIP32 key from a seed.

import { fromMasterSeed } from '@exodus/bip32'

const key = fromMasterSeed(Buffer.from('000102030405060708090a0b0c0d0e0f'))

BIP32.fromXPub(base58xpub: string): BIP32

Import a BIP32 key from an extended public key.

import BIP32 from '@exodus/bip32'

const key = BIP32.fromXPub(
  'xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8'
)

BIP32.fromXPriv(base58xpriv: string): BIP32

Import a BIP32 key from an extended private key.

import BIP32 from '@exodus/bip32'

const key = BIP32.fromXPub(
  'xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi'
)

Constants

HARDENED_OFFSET: number

Constant offset value for hardened derivation indices.

import { HARDENED_OFFSET } from '@exodus/bip32'

console.log(HARDENED_OFFSET) // 0x80000000

Instance Methods

derive(numOrPath): BIP32

Derives a child key. Example:

const childKey = masterKey.derive(`m/0'/0'`)

wipePrivateData(): void

⚠️ Warning: destructive

Wipes all private key data from the instance.

toJSON(): { xpriv: string, xpub: string }

⚠️ Warning: returns sensitive xpriv data.

Converts the instance to a JSON object.

inspect(): { xpriv: string, xpub: string }

Alias to toJSON().

toString(): string

⚠️ Warning: returns sensitive xpriv data.

Returns a stringified version of the instance.

Instance Properties

privateKey: Buffer

Returns the private key.

publicKey: Buffer

Returns the public key.

chainCode: Buffer

Returns the chain code.

xPub: string

Returns the extended public key (xpub) in Base58 format.

identifier: Buffer

Returns the key identifier (hash160 of the public key).

fingerprint: number

Returns the fingerprint of the key (first 4 bytes of the identifier). See spec.

版本与发布记录

@exodus/bip32 共发布 23 个版本,首次发布于 2022/03/23;过去 12 个月发布了 4 个版本。

版本发布日期距今
4.3.1latest2026/09/171 个月前
4.3.02026/06/194 个月前
4.2.22026/05/285 个月前
4.2.12026/05/136 个月前
4.2.02025/07/251.3 年前
4.1.02025/07/181.3 年前

关于 @exodus/bip32 的常见问题

@exodus/bip32 是什么?

Exodus BIP32 modules.

如何安装 @exodus/bip32?

在项目目录运行 npm install @exodus/bip32,或使用 pnpm add / yarn add / bun add。

@exodus/bip32 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@exodus/bip32 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@exodus/bip32 可以商用吗?

@exodus/bip32 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@exodus/bip32 的下载量有多少?

根据 npm 官方下载统计,@exodus/bip32 在 2026/10/14 – 2026/11/12 这 30 天内被下载 68,922 次,日均约 2,297 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@exodus/bip32 还在维护吗?

最新版本 4.3.1 发布于 2026/09/17(1 个月前);至今共发布 23 个版本,其中过去 12 个月发布了 4 个;首次发布于 2022/03/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。