Uh oh!
There was an error while loading. Please reload this page.
Add saving wallet config with bdk-cli wallet config - #203
Conversation
9e56084 to
b3966e3ComparePull Request Test Coverage Report for Build 21153320925Details
💛 - Coveralls |
b3966e3 to
bf14df8CompareI like the approach for loading the config file parameters if the file exists, but is there a reason you didn't add a CLI Creating the config file in rust should be easier to maintain/keep in sync than your |
tvpeter
commented
Jun 24, 2025
Alright, I will update. |
bf14df8 to
36ee973Comparebdk-cli wallet init5125cf8 to
fcf7ce8Comparetvpeter
commented
Jun 27, 2025
@notmandatory I have updated the PR |
f77b1da to
70a5390Compare9461e85 to
5d9feb0Comparethunderbiscuit
commented
Sep 3, 2025
I need to start keeping track of all these awesome new features I honestly see the PRs come in and can't keep up. This is super cool. |
tvpeter
commented
Sep 3, 2025
Thank you @thunderbiscuit |
9549e09 to
0f6b320Comparenotmandatory
commented
Sep 6, 2025
I spent some time today reviewing and even though this looks like a workable way to do it and is based on my suggestion I'm afraid it's going to be a hassle to maintain. I've been experimenting with somehow using the different clap parsing functions (https://docs.rs/clap/latest/clap/trait.Parser.html) but so far haven't figured out a better way. I'd like to keep thinking about it. We might have to simplify the problem somehow such as by not trying to merge loaded and CLI args. |
tvpeter
commented
Sep 6, 2025
Thank you @notmandatory. Also, for the Parser trait, I read that it does not allow interacting with an external resource such as reading a file as I would want it. I will also be trying out other approaches in case there is a cleaner way to handle it. |
How about something like:
|
7cd062b to
28796caCompare77864b4 to
c5c4fdbCompare
notmandatory
left a comment
There was a problem hiding this comment.
I found an error when testing with testnet4, and a couple small nits should be fixed too. Otherwise this looks good.
In the future if everyone prefers the config approach it should probably become the only way to use the wallet features.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
c5c4fdb to
7be9a30Comparetvpeter
commented
Oct 27, 2025
Thank you for catching all these.
Yes, I agree. |
7be9a30 to
805d075Compare- add config.rs to store and retrieve values - add toml and serde crates for desearilizing and reading values - update utils, commands and handlers files to use values from config.toml -refactor prepare_wallet_db fn - fix clippy issues [Issue: bitcoindevkit#192]
- rename init to config and move walletopts as config options
a95a621 to
4f58575Compare
thunderbiscuit
left a comment
There was a problem hiding this comment.
Thanks for this! I'll use it for sure once it gets in. I have two little things I want to ask, take them or leave them they're not blockers at all.
Question
When I run the example in the readme, I get the following config file:
network = "signet"
[wallets.my_wallet]
wallet = "my_wallet"network = "signet"ext_descriptor = "tr(tprv8Z.../0/*)#dtdqk3dx"int_descriptor = "tr(tprv8Z.../1/*)#ulgptya7"database_type = "sqlite"client_type = "electrum"server_url = "ssl://mempool.space:60602"batch_size = 10The network is somehow added as a top-level key, but I suspect it's meant to only be added under the specific wallet config maybe? It doesn't prevent the cli from working as expected however so all is good there.
Comment
I always find it hard when applications require a config file but it's empty by default. I have to search in their docs to find what's available, and even then it's hard to know if you miss anything. A nicer approach is when the config file comes pre-populated, with all keys commented out to start with but they're at least all there so I can use the config file to sort of "discover" what's available in the wallet. This is not always possible for all keys, but could be cool here. When doing this you could do it 2 ways:
- Your config file could just come pre-made with a top-level commented section that has all keys available and the rest works as it currently does (easiest to implement). Note that you could also just add this as a codeblock in the readme (a complete list of available config options).
- Each newly created wallet comes with its own section of complete config keys, some active and the rest commented out.
tvpeter
commented
Jan 16, 2026
Thank you for the review @thunderbiscuit |
tvpeter
commented
Jan 17, 2026
I have done a quick review of configure_me, and from my perspective, it may not be suitable for the CLI's use case. It uses a declarative approach to define the config file and generates a static file that updating it requires manually editing and recompiling. It is more suitable for an application-wide configuration and will be challenging to use for a per-wallet configuration. Also, I have not seen how it can handle conditional features. Lastly, I am not sure it can integrate with clap as they seemed to serve the same purpose (might be wrong). But there are improvements that we can pick from the library, things like validation and maybe how we merge fetched values into the CLI values. |
notmandatory
commented
Jan 17, 2026
thanks for looking into it, I agree we should stick with our simpler toml file approach. |
tvpeter
commented
Jan 18, 2026
Thank you for noting this. It has been fixed now
I have considered this approach and agree that having a configuration file for an app is beneficial. However, I’m not sure it applies to this tool for two reasons. Firstly, we do not expect users to manually edit the config file because we want Secondly, this configuration is intended specifically for the wallet and does not pertain to broader application settings. Users who are not testing their wallet flows may find the config file entirely irrelevant. |
- add wallets command - add warning for using priv descriptors - update readme - add loading network from config - fix review comments
- refactor config by impl TryFrom trait for WalletOpts - fix top-level network duplicate in config file
ac61b94 to
be31c14Compare87472e3 to
ceb9332Comparenotmandatory
commented
Jan 19, 2026
I pushed ceb9332 to update README examples to use new wallet config feature. |
notmandatory
left a comment
There was a problem hiding this comment.
ACK ceb9332
Looks good! much easier to use.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Description
This PR adds
bdk-cli wallet configcommand to save wallet configuration information toconfig.tomlfile in the data directory.Fixes#192
Notes to the reviewers
serdecrate frombdk_walletdid not offer thederivefeatureshortenfnChangelog notice
configto save wallet configswalletscommand to show all saved wallet configsChecklists
Features
wallet [-f] [-w <name>] config <wallet opts>wallet [-w <name>] sync | balance | new_address |etc...repl [-w <name>]walletsAll Submissions:
cargo fmtandcargo clippybefore committingNew Features:
CHANGELOG.md