Skip to content

Consider enabling a config file for each wallet #209

@thunderbiscuit

Description

@thunderbiscuit

The bdk-cli tool currently requires users provide arguments to all commands (or set environment variables active for each call).

I was using it this week to set up a signet test wallet, and the result of it is that I had to build and save a file of pre-built commands ready to go because the commands are long and not easy to remember/type.

For example, here is how I start the repl on my signet wallet with a Kyoto client (different descriptor than here):

bdk-cli --datadir ~/temp/ --network signet repl --wallet "test1" --client-type cbf --cbf-skip-blocks 100000 --database-type sqlite --ext-descriptor "tr(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/86h/1h/0h/0/*)"

Using a config file

The cli could potentially build a fully-fledged toml config file for each wallet it creates. When the user calls the cli using the --wallet <name> option, most arguments could then be filled out for them, keeping the call site simple and clean. This config file can live in the directory associated with the wallet (example: ~/.bdk-cli/test1/config.toml). Config file example:

name = "test1"
network = "signet"
client-type = "cbf"
cbf-skip-blocks = 100000
database-type = "sqlite"

This would make the call site much simpler:

bdk-cli --datadir ~/temp/ repl --wallet "test1" --ext-descriptor "tr(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/86h/1h/0h/0/*)"

There are potentially some other things you could do with this (saving the public descriptors?) enabling balance and sync without even providing the descriptors again. Not sure of tradeoffs there. I know the wallet is meant as test and whatnot, so in general I'm not worried about privacy and having the config file in plain text, but maybe that's worth thinking about a bit more.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions