@bitcoindevkit/bdk-wallet-node

中文文档
0.4.0发布于 2026/10/29MIT OR Apache-2.0TypeScriptCommonJS零依赖构建来源已验证近 30 天下载 2645

A modern, lightweight, descriptor-based wallet library in WebAssembly for browsers and Node

原始使用文档
文档目录12 节
  1. About
  2. Installation
  3. Browser/Web
  4. Node.js
  5. Notes on WASM Specific Considerations
  6. WASM Considerations Overview
  7. Development Environment
  8. Requirements
  9. Build with wasm-pack build
  10. Test in Headless Browsers with wasm-pack test
  11. License
  12. Contribution

The Bitcoin Dev Kit: WebAssembly

The Bitcoin Dev Kit for Browsers, Node, and React Native

NPM Package (Web) NPM Package (Node) MIT or Apache-2.0 Licensed Rustc Version 1.88.0+ Chat on Discord

About

The bdk-wasm library aims at providing access to the excellent BitcoinDevKit to JS and Node environments (and eventually any device supporting WebAssembly). It specializes in compiling BDK on the wasm32-unknown-unknown target and use wasm-bindgen to create TypeScript bindings.

This repo handles the packaging and publishing of the bdk-wallet-web (for browsers) and bdk-wallet-node (for Node.js) NPM packages, using wasm-pack.

This library offers all the desired functionality to build a Bitcoin wallet out of the box:

  • UTXO management
  • Coin selection
  • Wallet upates by syncing and scanning the chain data
  • Bitcoin descriptors for flexibility in the definition of spending conditions. Supports all address types from legacy to Taproot.
  • State update and persistence
  • Transaction creation, signing and broadcasting
  • Dynamic addresses
  • and much more

For a lightweight library providing stateless utility functions, see bitcoinjs.

Installation

Browser/Web

yarn add @bitcoindevkit/bdk-wallet-web

Node.js

yarn add @bitcoindevkit/bdk-wallet-node

Notes on WASM Specific Considerations

[!WARNING] There are several limitations to using BDK in WASM. Basically any functionality that requires the OS standard library is not directly available in WASM. However, there are viable workarounds documented below. Some key limitations include:

  • No access to the file system
  • Network access is limited to http(s)

WASM Considerations Overview

No access to the file system

With no direct access to the file system, persistence cannot be handled by BDK directly. Instead, an in memory wallet must be used in the WASM environment, and the data must be exported using wallet.take_staged(). This will export the changeset for the updates to the wallet state, which must then be merged with current wallet state in JS (will depend on your persistence strategy). The persisted ChangeSet can be passed to wallet.load() to recover the wallet.

Network access is limited to http(s)

This essentially means the library only supports Esplora as blockchain client. Both RPC and Electrum clients require sockets and will not work for BDK in a WASM environment out of the box.

Development Environment

Requirements

MacOS special requirement

Refers to this section.

Build with wasm-pack build

[!IMPORTANT] You need the wasm32-unknown-unknown toolchain to be installed:

rustup target add wasm32-unknown-unknown

To build for browser/web:

wasm-pack build --target bundler --features "esplora"

To build for Node.js:

wasm-pack build --target nodejs --all-features

Test in Headless Browsers with wasm-pack test

wasm-pack test --headless --firefox

Works with --firefox, --chrome or --safari.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

版本与发布记录

@bitcoindevkit/bdk-wallet-node 共发布 3 个版本,首次发布于 2025/08/26;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.0latest2026/10/299 天前
0.3.02026/03/177 个月前
0.2.02025/08/261.2 年前

关于 @bitcoindevkit/bdk-wallet-node 的常见问题

@bitcoindevkit/bdk-wallet-node 是什么?

A modern, lightweight, descriptor-based wallet library in WebAssembly for browsers and Node

如何安装 @bitcoindevkit/bdk-wallet-node?

在项目目录运行 npm install @bitcoindevkit/bdk-wallet-node,或使用 pnpm add / yarn add / bun add。

@bitcoindevkit/bdk-wallet-node 支持 TypeScript 吗?

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

@bitcoindevkit/bdk-wallet-node 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bitcoindevkit/bdk-wallet-node 可以商用吗?

@bitcoindevkit/bdk-wallet-node 使用 MIT OR Apache-2.0 许可。可在 MIT、Apache-2.0 中任选其一遵守。选择 MIT 时,宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bitcoindevkit/bdk-wallet-node 的下载量有多少?

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

@bitcoindevkit/bdk-wallet-node 还在维护吗?

最新版本 0.4.0 发布于 2026/10/29(9 天前);至今共发布 3 个版本,其中过去 12 个月发布了 2 个;首次发布于 2025/08/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。