bitcoindevkit / bitcoindevkit/bdk-cli

Improve error message / accept descriptor key expressions in descriptor command

Open
#303 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
141
Forks
99
Avg merge
6d 14m
Merged PRs (30d)
1

Description

**Describe the enhancement**

`bdk-cli key derive` returns a descriptor key expression (e.g. `[fingerprint/path]xpub.../*`), while `bdk-cli descriptor` expects a raw `xpub`/`xprv`. Passing the output of `key derive` directly to `descriptor` results in:

```text
BIP32 error: base58 encoding error
```

The error doesn't explain that the input is a descriptor key expression rather than a raw extended key.

It would be helpful if `descriptor` either:-

* detected descriptor key expressions and emitted a more descriptive error or
* accepted descriptor key expressions directly.
---
**Use case**

A natural workflow is:

```text
key restore

key derive

descriptor
```

Since `key derive` produces a key intended for descriptors, it's reasonable to expect its output to be consumable by `descriptor`.

Instead, users encounter a low-level Base58 parsing error without any indication that the command expects a different representation.

---

**Additional context**

Reproducer:

```bash
bdk-cli key derive --xprv "tprv..." --derivation_path "m/84h/1h/0h"
```

Output:

```text
[bd2eb472/84'/1'/0']tprv.../*
```

Then:

```bash
bdk-cli descriptor --type wpkh "[bd2eb472/84'/1'/0']tprv.../*"
```

produces:

```text
BIP32 error: base58 encoding error
```

The same descriptor key expression works correctly when wrapped in a descriptor and passed to:

```bash
bdk-cli wallet config --ext-descriptor "wpkh([bd2eb472/84'/1'/0']tprv.../*)"
```

which suggests the underlying parsing is already supported in that context.

Contributor guide

Open the contributing guide

Research direction

Run the documented `key derive` and `descriptor` reproducer first, then trace the `bdk-cli key derive`, `descriptor`, and `wallet config` entry points to compare how their inputs are parsed. Done means descriptor key expressions are either accepted directly by `descriptor` or rejected with an explicit explanation of the expected representation, with command tests covering the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.