[#wallet-GenerateChangeTarget] = xref:wallet.adoc[wallet]::GenerateChangeTarget :relfileprefix: ../ :mrdocs: Choose a random change target for each transaction to make it harder to fingerprint the Core wallet based on the change output values of transactions it creates. Change target covers at least change fees and adds a random value on top of it. The random value is between 50ksat and min(2 * payment_value, 1milsat) When payment_value <= 25ksat, the value is just 50ksat. == Synopsis Declared in `<wallet/coinselection.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] xref:CAmount.adoc[CAmount] GenerateChangeTarget( xref:CAmount.adoc[CAmount] payment_value, xref:CAmount.adoc[CAmount] change_fee, xref:FastRandomContext.adoc[FastRandomContext]& rng); ---- == Description Making change amounts similar to the payment value may help disguise which output(s) are payments are which ones are change. Using double the payment value may increase the number of inputs needed (and thus be more expensive in fees), but breaks analysis techniques which assume the coins selected are just sufficient to cover the payment amount ("unnecessary input" heuristic). == Return Value The randomly‐chosen change target amount. [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *payment_value* [in] | Average payment value of the transaction output(s). | *change_fee* [in] | Fee for creating a change output. | *rng* [in] | Randomness source used to pick the random component of the target. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#