LtbLightning / bdk-rn

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

Create a wallet with any descriptor #4

Closed testerez closed 2 years ago

testerez commented 2 years ago

As far as I understand, bdk-rn currently allows to create a wallet only from a mnemonic. Would it make sense to have createWallet taking a simple descriptor and expose generateExtendedKey and restoreExtendedKey so that the client app has more control?

Is it what this comment is about? https://github.com/LtbLightning/bdk-rn/blob/edb9ebf64c8012bb89f56bdc17df5f645b17e8d3/android/src/main/java/io/ltbl/bdkrn/BdkFunctions.kt#L104

BitcoinZavior commented 2 years ago

@testerez Shortly the following method will be added, to create wallet with descriptor or with mnemonic:

const response = await BdkRn.createWallet({
  mnemonic: 'daring erase travel point pull loud peanut apart attack lobster cross surprise',
  password: '',
  descriptor: '',
  useDescriptor: false,
  network: '',
  blockChainConfigUrl: '',
  blockChainSocket5: '',
  retry: '',
  timeOut: '',
  blockChainName: ''
});
testerez commented 2 years ago

Ok, so the consumer will choose to use either mnemonic or descriptor. Is it something you plan to implement soon? Can I help? Also, would it make sense to rather stick to the bdk API?

BitcoinZavior commented 2 years ago

Yes, A PR is open with the new changes, refer to the readme for the new interface: https://github.com/LtbLightning/bdk-rn/tree/modify-create-wallet-interface#generatemnemomic

The bdk API will still work, in terms of bitcoin applications, there could be a number of scenarios where product team might want to use a descriptor or a mnemonic, This will provide flexibility to implement any use case.

BitcoinZavior commented 2 years ago

Fixed by https://github.com/LtbLightning/bdk-rn/pull/6