Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metamask/bdk-wasm
The Bitcoin Dev Kit for Browsers and Node
https://github.com/metamask/bdk-wasm
bdk bitcoin descriptors js node wasm webassembly
Last synced: about 1 month ago
JSON representation
The Bitcoin Dev Kit for Browsers and Node
- Host: GitHub
- URL: https://github.com/metamask/bdk-wasm
- Owner: MetaMask
- License: other
- Created: 2024-11-05T12:16:00.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-11T10:13:40.000Z (about 1 month ago)
- Last Synced: 2024-12-11T10:20:55.746Z (about 1 month ago)
- Topics: bdk, bitcoin, descriptors, js, node, wasm, webassembly
- Language: Rust
- Homepage: https://bitcoindevkit.org/
- Size: 79.1 KB
- Stars: 8
- Watchers: 34
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE_MIT
Awesome Lists containing this project
README
The Bitcoin Dev Kit: WebAssembly
The Bitcoin Dev Kit for Browsers and Node
Built with 🦀🕸 by The Rust and WebAssembly Working Group
## About
The `bdk-wasm` library aims at providing access to the excellent [BitcoinDevKit](https://github.com/bitcoindevkit/bdk) 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`](https://github.com/rustwasm/wasm-bindgen) to create TypeScript bindings.This repo handles the packaging and publishing of the `bdk` 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 moreFor a lightweight library providing stateless utility functions, see [`bitcoinjs`](https://github.com/bitcoinjs/bitcoinjs-lib).
## Browser Usage
```sh
yarn add bdk
```## Development Environment
### Requirements
- Install [Rust](https://www.rust-lang.org/tools/install)
- Install [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)#### MacOS special requirement
On MacOS, you should replace the default `llvm` with the one from `brew`:
```sh
brew install llvm
```We recommend creating a `.cargo` folder at the root of the repo with the following `config.toml` file:
```toml
[env]
AR = "/opt/homebrew/opt/llvm/bin/llvm-ar"
CC = "/opt/homebrew/opt/llvm/bin/clang"
```### Build with `wasm-pack build`
```sh
wasm-pack build
```> Choose your desired features when building: `wasm-pack build --features "esplora default snap bitcoind"`
### Test in Headless Browsers with `wasm-pack test`
```sh
wasm-pack test --headless --firefox
```> Works with `--firefox`, `--chrome` or `safari`.
## License
Licensed under either of
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or )
- MIT license ([LICENSE-MIT](LICENSE-MIT) or )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.