How bitcoin node selects the output unspent transactions when sending bitcoin?

0
9


By default, Bitcoin Core will solely spend international inputs which have no less than six confirmations, and alter outputs which have no less than one affirmation. If you wish to use youthful international inputs, you need to use the minconf parameter current e.g. on sendmany.

Past that, Bitcoin Core will break up its UTXO pool by output sort, after which for every output sort makes use of a number of algorithms to assemble one enter set candidate. Amongst all of those candidate enter units, it chooses the least wasteful per the waste metric.

The algorithms in use in Bitcoin Core v25.1 are knapsack algorithm, single random draw, and department and certain.

  • Knapsack will carry out quite a few random walks on all UTXOs with quantities decrease than the goal to assemble an enter set that overshoots goal + min_change the least, or decide the lowest bigger UTXO if that’s nearer to goal + min_change.
  • SRD will shuffle all UTXOs and decide from this shuffled listing till it has collected sufficient funds to fund the transaction
  • BnB will try to seek out an enter set that avoids creating change. If there are a number of options, it’ll choose the least wasteful.

Not one of the above algorithms really reduce the enter set weight. Therefore, I’m proposing that we add an algorithm that minimizes the enter set weight in PR#27877, which on the very least must be run at excessive feerates. The draw back of such an algorithm can be that it might bloat a pockets’s UTXO pool when used excessively, however it will guarantee an optimum consequence within the short-term. To this point, this proposal has not gotten enough help to be added to Bitcoin Core.

There are at present no configuration choices that straight have an effect on the overall coin choice habits. You would need to carry out coin choice manually or externally and construct uncooked transactions to optimize price expenditure.

LEAVE A REPLY

Please enter your comment!
Please enter your name here