You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- update wallet initialization to use `bdk-cli
wallet init` command directly and read walletopts
- update README for how to use the bdk-cli wallet
init command
- fix clippy warnings
- update CHANGELOG
[Issue: #192]
This is available for wallet, key, repl and compile features. When ommitted, outputs default to `JSON`.
205
-
### Initializing a Wallet with `just`
206
205
207
-
When using `bdk-cli`, repeatedly specifying parameter values for each command can be tedious. The `just` command allows you to initialize a wallet with configuration values once, saving them for reuse in subsequent `bdk-cli` commands.
208
-
This eliminate the need to provide repetitive arguments. To set up a wallet with persistent configuration values, use the following just command:
206
+
### Initializing Wallet Configurations with `bdk-cli wallet init`
209
207
210
-
```shell
211
-
just init <wallet_name><ext_descriptor><int_descriptor><database_type><client_type><url><rpc_user><rpc_password> [--force]
212
-
```
213
-
The arguments must be provided in the order shown above. Replace each placeholder with the corresponding value:
214
-
215
-
> *`wallet_name`: The unique name for your wallet (e.g., my_wallet)
216
-
> *`ext_descriptor`: The external descriptor for generating receiving addresses (e.g., tr(tprv.../0/*)#checksum)
217
-
> *`int_descriptor`: The internal descriptor for generating change addresses (e.g., tr(tprv.../1/*)#checksum)
218
-
> *`database_type`: The database type for wallet persistence (e.g., sqlite). Defaults to `sqlite` if omitted
219
-
> *`client_type`: The blockchain backend (e.g., electrum, esplora, rpc, cbf)
220
-
> *`url`: The server URL for the blockchain backend (e.g., ssl://mempool.space:60602 for Electrum).
221
-
> *`rpc_user`: The RPC username for rpc client type (e.g., user). Defaults to user if omitted.
222
-
> *`rpc_password`: The RPC password for rpc client type (e.g., password). Defaults to password if omitted.
223
-
> *`--force`: Optional. Overwrites existing configuration for the specified <wallet_name> if set. By default, `just init` fails if the wallet config values already exists.
224
-
225
-
#### Example
208
+
The `bdk-cli wallet init` command simplifies wallet setup by saving configuration parameters to `config.toml` in the data directory (default `~/.bdk-bitcoin/config.toml`). This allows you to run subsequent `bdk-cli` wallet commands without repeatedly specifying configuration details, easing wallet operations.
226
209
227
-
To initialize a wallet named `my_wallet` with `electrum` as the backend:
210
+
To initialize a wallet configuration, use the following command structure:
228
211
229
212
```shell
230
-
just init my_wallet "tr(tprv8Z.../0/*)#dtdqk3dx""tr(tprv8Z.../1/*)#ulgptya7" sqlite electrum "ssl://mempool.space:60602" user password
You can omit the following arguments to use their default values:
223
+
To overwrite an existing wallet configuration, use the `--force` flag at the end of the command.
240
224
241
-
`database_type`: Defaults to sqlite.
242
-
`rpc_user`: Defaults to user.
243
-
`rpc_password`: Defaults to password.
225
+
You can omit the following arguments to use their default values:
244
226
245
-
For example, to initialize a wallet with default database_type, rpc_user, and rpc_password:
227
+
`network`: Defaults to `testnet`
246
228
247
-
```shell
248
-
just init-wallet my_wallet "tr(tprv8Z.../0/*)#dtdqk3dx""tr(tprv8Z.../1/*)#ulgptya7" electrum "ssl://mempool.space:60602"
249
-
```
229
+
`database_type`: Defaults to `sqlite`
250
230
251
231
#### Using Saved Configuration
252
232
253
-
After initializing a wallet with `just init`, the configuration is saved in `~/.bdk-bitcoin/config.toml`. You can then run `bdk-cli` wallet commands without specifying the parameters, referencing only the wallet name and network.
233
+
After a wallet is initialized, you can then run `bdk-cli` wallet commands without specifying the parameters, referencing only the wallet subcommand.
254
234
255
-
With the wallet `my_wallet` initialized, generate a new address and sync the wallet as follow:
235
+
For example, with the wallet `my_wallet` initialized, generate a new address and sync the wallet as follow:
cargo run --features electrum wallet -w my_wallet sync
261
241
```
262
242
263
-
#### Notes:
243
+
Note that each wallet has its own configuration, allowing multiple wallets with different configurations.
264
244
265
245
* Each wallet has its own configuration, allowing multiple wallets with different settings (e.g., different descriptors or backends).
266
246
* You can override saved configuration values for a single command by specifying them explicitly (e.g., `--client-type esplora` or `--url https://mempool.space/signet/api`).
0 commit comments