LtbLightning / bdk-rn

Bitcoin Development Kit - React Native Module
MIT License
49 stars 13 forks source link

Create descriptors for standard wallet types(bip44/49/84) #32

Open BitcoinZavior opened 1 year ago

BitcoinZavior commented 1 year ago

Currently, CreateDescriptors creates descriptors based on the path and script type specified by the user. This is probably not as useful as having the ability to create a descriptor based on a standard BIP. Because it assumes that the user knows the path and script type for a specific wallet type.

It will be more useful to have the ability to create descriptors for standard wallet types(bip44/49/84) based on BDK templates already available:

https://docs.rs/bdk/latest/bdk/descriptor/template/index.html

Templates currently available:

Bip44 BIP44 template. Expands to pkh(key/44'/{0,1}'/0'/{0,1}/) Bip44Public BIP44 public template. Expands to pkh(key/{0,1}/) Bip49 BIP49 template. Expands to sh(wpkh(key/49'/{0,1}'/0'/{0,1}/)) Bip49Public BIP49 public template. Expands to sh(wpkh(key/{0,1}/)) Bip84 BIP84 template. Expands to wpkh(key/84'/{0,1}'/0'/{0,1}/) Bip84Public BIP84 public template. Expands to wpkh(key/{0,1}/) P2Pkh P2PKH template. Expands to a descriptor pkh(key) P2Wpkh P2WPKH template. Expands to a descriptor wpkh(key) P2Wpkh_P2Sh P2WPKH-P2SH template. Expands to a descriptor sh(wpkh(key))

Reference for descriptors: https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md

BitcoinZavior commented 1 year ago

Will be implemented once api is added to bdk-ffi https://github.com/bitcoindevkit/bdk-ffi/issues/165