bitcoindevkit / bitcoindevkit/bdk

Bundle size

Open
#1,952 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.1k
Forks
483
Avg merge
20d 3h
Merged PRs (30d)
3

Description

Hi all,

Working on the [BDK-WASM](https://github.com/MetaMask/bdk-wasm) project, we wrap BDK around `wasm-bindgen` and expose its API. We've been very surprised by the size of the final bundle: https://www.npmjs.com/package/@metamask/bitcoindevkit/v/0.1.7?activeTab=code

As can be seen, the generated WASM is >3.2MB, and that's applying all known size optimizations and doing a thorough work on it. Given that we expected BDK to easily integrate in small devices such as hardware wallets, the size is very surprising.

We currently bundle `bdk_wallet` and `bdk_esplora`. `bdk_wallet` alone produces a 2.3MB bundle, with Esplora it takes 3.2MB and best I could do is around 3.1MB by removing some code. It doesn't seem to be inherent to how WASM is compiled either as very small packages can be produced with `wasm-pack`.

Would be great to get your insights on what is causing this size and whether it can be improved.

**Use case**
Usage in browser extensions such as Mozilla Addons require files to be <4MB.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.