Skip to content

Improve error message / accept descriptor key expressions in descriptor command #303

Description

@EliteCoder18

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:

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:

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:

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

Output:

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

Then:

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

produces:

BIP32 error: base58 encoding error

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

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions