Organic UTXO consolidation (in the course of regular payments)

  • For UTXO-based cryptocurrencies, such as Bitcoin or Litecoin, it is important to have the set of managed Unspent Transaction Outputs in optimal shape, because if you have too much small UTXO, you will have to create bigger transactions to send the same amount of funds, and hence pay bigger network fee, or even need to send several transactions to transfer the needed amount.

    Typical approach to handle this is to do periodical sweep of UTXO, bundling them all together, at the time when network fee is low.

    We implemented another approach, that does not require manual UTXO consolidation, and at the same time, conserves network fee - when fee in the network is high, the algorithm tries to use less UTXO per transaction, and when network fee is low, it will create bigger transaction, effectively performing UTXO consolidation along with regular payments. This organic UTXO consolidation allows to maintain healthy UTXO set automatically, without manual consolidation runs.

    We implemented it this way:

    Define a rate that you are OK to pay in terms of monetary percentage: we call it “fee per full coin”. Basically, you say, “to send 1 btc, I am willing to pay 0.001 btc”

    When building a transaction, we calculate optimal tx size like this:

    optimal_tx_vsize = utxo_sum * fee_per_full_coin / fee_per_kb

    The closer candidate transaction to the optimal size, the better score it will get.

    Of course we cannot always find the optimal transaction, but we will try to choose the one with best score, depending on available UTXO set.

    The resulting effect is that when fee_per_kb is high, optimal_tx_vsize will be low (may be even zero), and we will try to find the smallest tx possible with current UTXO set. When fee_per_kb is low, optimal_tx_vsize will be high, and we will choose transactions with more UTXO, performing organic UTXO consolidation.

    If more wallets implement this type of optimizations, it will result in more healthy global UTXO set.

    submitted by /u/dgpv
    [link] [comments]

Who's Online [Full List]

0 users active right now (0 members and 0 guests).

Board Statistics

Our members have made a total of 11.5k posts in 11.2k topics.
We currently have 410 members registered.
Please welcome our newest member, infinitemlm.
The most users online at one time was 239 on Mon Jul 30 2018.

The developers of are creating their very own cryptocurrency startup --!

Show your support by posting on our BitcoinTalk thread, following us on Twitter, and subscribing to our Telegram channel to get regular project updates and talk directly with the team! by the Team