LtbLightning / bdk-rn

Bitcoin Development Kit - React Native Module
MIT License
50 stars 15 forks source link

Ability to choose functionality selectively from BDK #1

Open BitcoinZavior opened 2 years ago

BitcoinZavior commented 2 years ago

The binary size of BDk for Android and IOS is quite large by default. It would be great to have smaller binaries with different set of functionalities so that they can be used selectively for different applications.

This will be very useful for using BDK in mobile applications and Browsers(via WASM) and hardware wallets.

Below is an example of how functionality can be separated so that an application can select a suitable set of functionalities thereby reducing binary size. This is only an example, a better grouping of logical (and technically linked) components can be created based on BDK architecture.

  1. HD Wallet functionality This would only require functionality to generate seed, derive keys and addresses and ability to sign messages

  2. Transaction creation and signing Creating and signing all supported transaction types

  3. Bitcoin Electrum Node Interaction Ability to receive and parse block information from Electrum nodes Ability to broadcast transactions to Electrum node

  4. Bitcoin Core Interaction Ability to receive and parse block information from Bitcoin Core Ability to broadcast transactions

  5. Bitcoin Electrs Interaction Ability to receive and parse data from Electrs indexer Ability to broadcast transactions to Electrs

notmandatory commented 2 years ago

This should be possible, there is already work underway with the bdk rust project to split up the core wallet functionality from the blockchain and database modules. Once that's done it's how I'd start with splitting it up for the downstream languages too. If that goes well we can follow the same pattern if we need to break things up more. I suspect most of the size currently is related to those two modules so if we can separate them out we may not need to break down much more, but we'll have to see.