Repository navigation
Backlog
Description
Summary
create_tx, create_sp_tx, and create_dns_tx currently accept any recipient amount and rely on bdk_wallet's dust check at build time. That gives two gaps:
- There is no way to enforce a higher minimum output than the relay dust threshold, e.g. 1,000 sats, to avoid creating uneconomical UTXOs.
- The error surfaced for a too-small output is not useful:
bdk_walletreturnsCreateTxError::OutputBelowDustLimit(index), whoseDisplayisOutput below the dust limit: {index}. The number is the output index, not the amount or the required threshold, and it does not identify which recipient failed.
For silent-payment and DNS-derived outputs the amount is not written as a plain address:amount pair, so accidentally creating a dust-level output is easy and hard to diagnose.
Current behaviour
bdk_wallet'sTxBuilderchecks recipients againstScript::minimal_non_dust()whenallow_dustis false, which is the default. So below-dust explicit recipients are already rejected at build time.Script::minimal_non_dust()uses Bitcoin Core's default-dustrelayfeeof 3 sat/vB. A node configured differently may accept or reject different outputs.bdk-cliparses amounts inparse_recipient,parse_sp_code_value_pairs, andparse_dns_recipientbut does not validate the value against dust or any configured minimum.--send_alldrains to a single output; change below dust is folded into the fee bybdk_wallet.
Proposal (for discussion)
- Validate every explicit recipient amount at the CLI boundary, before building, using the recipient script's
minimal_non_dust()(OP_RETURN exempt). - Allow a configurable floor above dust, for example:
--min-output-sats <SATOSHIS>on the create commands, and/ormin_output_satsper wallet inconfig.toml.
Effective minimum =max(dust for that script, configured floor). Default remains the dust threshold.
- Apply the same check to DNS and silent-payment derived outputs, using the P2TR dust threshold.
- Return an error that names the recipient (address, silent payment code, or DNS name), the amount, the required minimum, and where the minimum came from (dust vs configured floor).
- Decide
--send_allbehaviour when the drained amount is below the minimum: reject, or allow with a warning. - Decide whether
bump_feeand payjoin need the same guard.
Open questions
- Does a configurable minimum belong in
bdk-cli, inbdk_wallet, or both? Dust is already a wallet concern, but a higher floor is an application/UX choice. - Should the floor apply to change outputs too? Applying it there could silently push change into fees, which may surprise users.
- Should outputs above dust but below the floor be a hard error or a warning?
- Flag/config naming and units (
--min-output-satsvs--min-output, sats vs BTC). - Should an explicit opt-out exist for deliberate dust outputs (e.g. for testing or dust attacks)?
Discussion first
This is a discussion issue, not a ready-to-implement task. Please don't pick it up immediately or open a PR until the scope and API are agreed, especially whether this belongs in bdk-cli, bdk_wallet, or both. I'd rather settle the design here first.
References
- Follows the recipient network validation in Reject recipient addresses from the wrong network #370.
bdk_wallet:TxBuilder::allow_dust,CreateTxError::OutputBelowDustLimit.rust-bitcoin:Script::minimal_non_dust/minimal_non_dust_custom.- Related: coin-select Upgrade for bdk v0.17.0 #81 (
DrainWeights::dust_thresholdbelow Core's P2TR dust limit), bdk_wallet REPL mode never persists wallet changes in the REPL loop #375 (configurable dust filtering for balances).
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsTodo
Activity
victrvondoom commentedon Dec 4, 2026
@emma31-dev, I'd suggest keeping the configurable minimum as a CLI-level policy rather than changing
bdk_wallet's existing dust validation semantics.My preferred approach would be to validate recipient outputs after their destinations have been resolved into scripts, but before passing them to the transaction builder. The effective minimum could be
max(script.minimal_non_dust(), min_output_sats), with OP_RETURN outputs exempt.A few considerations:
--send_all,bump_feeand payjoin as separate scope decisions.Would a wallet-level CLI configuration with an optional per-command override be acceptable, or would you prefer keeping this entirely command-scoped?
I'm interested in contributing the implementation once the intended API and scope are agreed.