Bitcoin Core's Coin Selection optimizes for minimal change outputs. How does Bitcoin Core prevent Change outputs of sizes below dust threshold from occurring?

  • This question is wrong, as Bitcoin Core actually creates a minimum change of 0.01 BTC, if it can't produce a direct match.
    – Murch
    Oct 19, 2016 at 22:55

2 Answers 2


See these lines:

// We do not move dust-change to fees, because the sender would end up paying more than requested.
// This would be against the purpose of the all-inclusive feature.
// So instead we raise the change and deduct from the recipient.
if (nSubtractFeeFromAmount > 0 && newTxOut.IsDust(::minRelayTxFee))
    CAmount nDust = newTxOut.GetDustThreshold(::minRelayTxFee) - newTxOut.nValue;
    newTxOut.nValue += nDust; // raise change until no more dust
    for (unsigned int i = 0; i < vecSend.size(); i++) // subtract from first recipient
        if (vecSend[i].fSubtractFeeFromAmount)
            txNew.vout[i].nValue -= nDust;
            if (txNew.vout[i].IsDust(::minRelayTxFee))
                strFailReason = _("The transaction amount is too small to send after the fee has been deducted");
                return false;

So Bitcoin core will give slightly less to the recipient rather than spend more than the payer originally requested, in the case of a dust-change output.

  • 1
    Then there's the question of whether or not this is a good policy... I don't believe it is. I think that as infrequently as dust change happens, just let miners have it and get a slightly faster confirmation time.
    – morsecoder
    Sep 1, 2015 at 11:59
  • It might not be good network policy, but it doesn't seem like users have an incentive to destroy dust UTXO's sent to them.
    – Nick ODell
    Sep 2, 2015 at 4:00

Bitcoin Core actually creates a minimum change of 0.01 BTC (if it has sufficient funds), if it can't produce a direct match.

In the rare case that it doesn't have sufficient funds to produce a non-dust change output, it will do the weird stuff Stephen mentions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.