The Bitcoin Dev Kit for Browser and Node
Built with 🦀🕸 by The Rust and WebAssembly Working Group
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 bitcoindevkit
NPM package, 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
.
yarn add bitcoindevkit
On MacOS, you should replace the default llvm
with the one from brew
:
brew install llvm
We recommend creating a .cargo
folder at the root of the repo with the following config.toml
file:
[env]
AR = "/opt/homebrew/opt/llvm/bin/llvm-ar"
CC = "/opt/homebrew/opt/llvm/bin/clang"
wasm-pack build
Choose your desired features when building:
--features "esplora"
wasm-pack test --headless --firefox
Works with
--firefox
,--chrome
orsafari
.
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
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.