Add an example showing how to open a pre-existing wallet
All the examples I've been able to find show how to initialize a wallet with BDK, but not how to open an existing wallet.
From looking at the examples, I'm not sure how to open an existing wallet without having the seed phrase available to generate the output descriptor needed to pass to new.
Our database doesn't store secrets, just blockchain data. This means that if you want to re-open a wallet you need to give us through new both the private descriptor and the database path (if you're using a persistent database, obviously).
Alternatively, if you don't want to re-create the private descriptor, and you don't care about signing, the public descriptor is enough.
This is what eluded me. Thank you for explaining! If it's a common misconception, it might be worth documenting somewhere. E.g., "Your application will need to arrange to securely store the secret/descriptor/whatever outside of the wallet." "Wallet" makes me think "something that stores secrets", so others might also have this confusion.
You're right, we should probably add this to the rust docs and also maybe somewhere in the tutorials on the website. Thanks!
Our database doesn't store secrets
Since the BDK wallet is able to sign (bdk::wallet::Wallet pub fn sign), are private keys stored in memory?
Are there any recommendations on how to store descriptors/mnemonics to recreate the wallet every time?
I think how descriptors can be stored with private information is entirely an application layer logic.. It can be stored in a simple file in encrypted format.. Or it can be stored in a hardware device.. Depends on how the users wanna use it.. But I agree it would be good to document somewhere that BDK doesn't store private key information anywhere.. It only exists in memory as long as the wallet is in scope.. Its upto the user to fetch the full descriptor and feed it to BDK..