Feat: Add bip329 wallet labels#266
Open
Musab1258 wants to merge 4 commits intobitcoindevkit:masterfrom
Open
Conversation
- Loads the \'Labels\' state from \'<wallet>.labels.jsonl\' after \'load_wallet_config\'. - Updates \'handle_offline_wallet_subcommand\' to accept mutable label state. - Exports and saves the in-memory labels to disk before the command return.
- Injects label lookups into the `unspent` and `transactions` match arms. - Updates the `--pretty` table formatting to include a new 'Label' column (using an em dash for missing labels). - Appends the label string to the standard JSON output
- Introduces the `Label` variant to `OfflineWalletSubCommand` with strict `clap` conflict rules. - Adds a `parse_txid` helper to utils.rs. - Implements an `add_or_add_update_label` helper in `handlers.rs` to mutate the in-memory label state in place.
Author
|
Hi @tvpeter, I am done with this. You can check it out when you are free. I will start working on the follow-up PR to add import and export of label files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds BIP-329 wallet label support to
bdk-cli, to partially address issue #184. It uses the[bip329]crate to manage label data, persists it in a separatelabels.jsonlfile within the wallet's data directory (e.g.~/.bdk-bitcoin/<wallet_name>/labels.jsonl), and keeps it decoupled from the wallet's SQLite/redb database.This PR includes the following functionality:
labeloffline subcommand to attach a human-readable label to either a transaction ID, address, or UTXO (outpoint).unspentandtransactionscommands now include aLabelcolumn in both--prettytable output and standard JSON output, showing the stored label or an em dash if none exists.Notes to the reviewers
labels.jsonlfile rather than inside the wallet database. This keeps the label format portable and interoperable with other BIP-329 compliant wallets.Labelimport frombip329is aliased asBipLabelinhandlers.rsto avoid a name clash with theOfflineWalletSubCommand::Labelvariant brought into scope viause crate::commands::OfflineWalletSubCommand::*.Changelog notice
Added
labelsubcommand toOfflineWalletSubCommandfor tagging transactions, addresses, and UTXOs with human-readable labels.labels.jsonlfile in the wallet data directory.Labelcolumn inunspentandtransactionsoutput (both--prettyand JSON).parse_txidhelper inutils.rs.bip329 = "0.4.0"dependency inCargo.toml.Checklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features:
CHANGELOG.mdBugfixes: