bdk-ffi icon indicating copy to clipboard operation
bdk-ffi copied to clipboard

Feature request: bdk::descriptor::policy::PkOrF

Open andreasgriffin opened this issue 2 years ago • 8 comments

The structure bdk::descriptor::policy::PkOrF contains fingerprint and xpub (if I understand correctly), which are currently unavailable in bdk-ffi (if the descriptor was created from a seed).

I do not know if it makes sense to create the binding before the new bdk release...

andreasgriffin avatar May 18 '23 19:05 andreasgriffin

Hi Andreas!

Do you mind giving me an example of your use for the feature? I'm trying to wrap my mind around it and seeing how I should expose it and whether we should add anything else, or if simply adding the struct will be enough for you. Let me know what you're building (if you can, but don't worry if you prefer not to say) and how you need the enum.

Cheers!

thunderbiscuit avatar May 30 '23 20:05 thunderbiscuit

Hi thunderbiscuit

thanks for the question. When creating a descriptor from a mnemonic

mnemonic = bdk.Mnemonic.from_string(test_seed)
network = bdk.Network.REGTEST
descriptor = bdk.Descriptor.new_bip84(
            secret_key=bdk.DescriptorSecretKey(network, mnemonic, ''),
             keychain=bdk.KeychainKind.EXTERNAL,
             network=network,
)

I did not find a way to get the Fingerprint and the xpub. Is bdk::descriptor::policy::PkOrF the correct struct to hold this information, or can I find the Fingerprint and the xpub somewhere else (apart of course of the descriptor.as_string())?

PS: I am writing a wallet in python https://github.com/andreasgriffin/bitcoin-safe , and extracting the fingerprint and xpub from a mnemonic is required.

andreasgriffin avatar May 30 '23 20:05 andreasgriffin